[Solved]Downlaod a whole website by Qt



  • How could I donwload the whole website(like the function of chrome--save as webpage,complete) but not
    only the html by Qt?
    I find out there are wget and libcurl, do Qt provide some API to help us download a complete webpage?
    Thanks



  • Could you be more specific?
    What do you mean by 'whole'?
    Do you want to crawl the website like a search engine does?
    Do you want the HTML, CSS, JavaScript?
    Do you want the images, movies?
    Or a combination! ;-)



  • I want the HTML, CSS, JavaScript and image, if the movie could download it would be better.Thanks

    Sorry, I am pretty ignorant about web, that is why I didn't mention my problem specific.



  • You can use QNetworkAccessManager!



  • I used it already, but I have to parse the contents of the html by myself
    and the html are a bunch of words only, that means I have to parse
    different html with different rules. I want to find out a way to download
    the thumbnails(atleast) of the website without design different rule for
    different website.

    example :
    in the pure html file, I could find a link like
    <img src="thumb/1349462743660s.jpg

    but the true address is
    http://2cat.or.tl/~tedc21thc/live/thumb/1349462743660s.jpg”

    how could I find out the address before "



  • "QUrl documentation":http://doc.qt.digia.com/stable/qurl.html

    QUrl provides resolve() to find the absolute URL from the relative one with a base URL.

    In your example:
    @
    QUrl base("http://2cat.or.tl/~tedc21thc/live/");
    // Or "http://2cat.or.tl/~tedc21thc/live/index.html". resolve() can handle both versions correctly
    QUrl imageUrl = base.resolve("thumb/1349462743660s.jpg");
    // imageUrl is now "http://2cat.or.tl/~tedc21thc/live/thumb/1349462743660s.jpg"
    @

    By the way you're from Taiwan? (Guessed with the website you gave.) Happy to see a fellow countryman! =D



  • Thanks, this is a big help.

    Sorry, I am not a Taiwanese but a Malaysian

    I just quit my job from Taiwan, because I can't bear with the rule
    of "Overworked & Underpaid".My boss don't want me to study
    everything "non-related" to jobs and order me don't participate
    any open source project in my spare times.

    "If you have times to study Qt, study the source codes of those useless project,
    you should spend all of your times on your job, if you don't want to do that,you
    can leave"

    Oh god, I study the books and codes in my spare times, what is the wrong with that?
    They think I am a slave and buy my live already?I don't know how those Taiwanese could
    bear these.



  • I guess most people just don't have a choice you know. Most Taiwanese bosses are just the same, be it hard to believe.

    Godspeed in Malaysia because we're f***ed here in Taiwan.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.