Results 1 to 7 of 7

Thread: Get images from a QWebView or QWebPage

  1. #1
    Join Date
    Apr 2009
    Posts
    12

    Default Get images from a QWebView or QWebPage

    I'm trying to write a small image ripping tool for the Circuit Tokei section of the Bijin Tokei website (http://www.bijint.com/cc/). Please don't judge me

    My plan is to store off the images so I can use them in a small clock application for my Google sidebar thing. Now, because there is a common theme among the names of the URL you'd think this would be easy. All image URLs are similar to this...

    http://www.bijint.com/assets/pict/cc/590x450/1742.jpg

    ..where 1742 is the the current time of day. When I first started this I thought "Great!" I can just create a program which cycles through all the minutes of the day and calls a simple download on them. Problem is, Bijin Tokei have done a lot of work to stop people from doing exactly what I'm trying to do. First of all, you're forbidden to access the image unless it's the current time of day and second, you can't access the images directly unless you're viewing the website. For example, if I were to try and visit "http://www.bijint.com/assets/pict/cc/590x450/1742.jpg" when it was actually 17:42 I would get a 403 forbidden error UNLESS I actually had the "http://www.bijint.com/cc/" website open. I presume either it's caching the image or storing some cookie off which allows you to view the image.

    Currently, I have a hacky program which has a QWebView pointed at the Circuit Tokei website and I've tried using QHttp to download the images as the website is updated every minute and I've also tried using QNetworkAccessManager to download the images too but I get a 403 forbidden error using both methods. So, I'm thinking the only way I might be able to do this is extract the images directly from either the QWebView object or perhaps the QWebPage or maybe even QWebFrame when they're updated. Thing is, I'm not sure how to do this. There doesn't seem to be any information on how to do anything like this in the docs.

    Any ideas?

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Get images from a QWebView or QWebPage

    See this example: http://labs.trolltech.com/blogs/2009...nd-qt-and-s60/

    For the magnifier-glass, they take an image of the webpage.
    It's nice to be important but it's more important to be nice.

  3. #3
    Join Date
    Apr 2009
    Posts
    12

    Default Re: Get images from a QWebView or QWebPage

    This is actually a workaround I'm using at the minute. I'm rendering the web element to a QPixmap. It works fine but what I don't like is that when I save the QPixmap to my hard drive I'll effectively be incurring any compression artifacts twice. So ideally I'd like a better solution. I get the impression that there isn't one, though

  4. #4
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Get images from a QWebView or QWebPage

    Why do you have compression artifacts at all? If you save as PNG, there shall be no compression artifacts.
    It's nice to be important but it's more important to be nice.

  5. #5
    Join Date
    Apr 2009
    Posts
    12

    Default Re: Get images from a QWebView or QWebPage

    Well, I'm using JPG at the minute. If PNG is lossless though then I'll use that but I don't think it is, is it?

  6. #6
    Join Date
    Apr 2009
    Posts
    12

    Default Re: Get images from a QWebView or QWebPage

    Ok. Wikipedia informs me that PNG is lossless. In which case, will the quality argument of QPixmap::Save() be ignored if I set the format argument to PNG?

  7. #7
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Get images from a QWebView or QWebPage

    I guess it will be ignored at all for image formats that do not have lossy compression.
    It's nice to be important but it's more important to be nice.

Similar Threads

  1. QWebview not showing images
    By manojmka in forum Qt Programming
    Replies: 27
    Last Post: 16th July 2012, 23:22
  2. Replies: 2
    Last Post: 16th June 2010, 15:42
  3. QWebView not displaying images
    By andyp in forum Qt Programming
    Replies: 7
    Last Post: 3rd December 2009, 21:35
  4. Replies: 4
    Last Post: 27th July 2009, 15:45
  5. QWebView shows '?' instead of all images
    By doep in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2009, 10:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.