Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is it possible to download files from from file hosting sites using QNetworkAccessManager
Forum Updated to NodeBB v4.3 + New Features

Is it possible to download files from from file hosting sites using QNetworkAccessManager

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    adnan
    wrote on last edited by
    #1

    I tried my level best to download a file from uploading.com but all in vain. I tried every possible way of redirection, but all in vain. It always ends up with error Moved Permanently and if you try redirections it ends up downloading the web page.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      You've already addressed this issue in a couple of other threads. Please continue the discussion there, rather than opening another thread.

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        adnan
        wrote on last edited by
        #3

        Actually, that thread discusses an issue related to cookies. But this time it is not related to cookies. I tried downloading without a premium account using regular download option and it failed every time. On the other hand, the inbuilt download manager of firefox doesn't seem to have any problem.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #4

          bq. Is it possible to download files from from file hosting sites using QNetworkAccessManager

          Yes. You'll probably need to ensure you obtain and keep relevant cookies, follow a similar path to that a human would take, follow redirections etc.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            adnan
            wrote on last edited by
            #5

            Actually, the problem is with non-premium accounts. They only allow one download at a time. When we try to download using QNetworkAccessManager, it makes a get request on the url, which was already used by firefox, file hosting sites disallow this and redirect all further requests to their webpage. So, redirection causes the page to be downloaded instead of file. Obviously, this problem is with non-premium accounts only.
            Besides, is there any advantage of using redirection feature of QNetworkAccessManager to fetch the new url over using the following method:
            @if(statusCode==307||dSegment[0].replySegment->rawHeaderList().contains("Location"))
            {
            downUrl=reply->header(QNetworkRequest::LocationHeader).toString();
            } @

            1 Reply Last reply
            0
            • JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #6

              Does their website use JavaScript redirection? If I'm not mistaken, QNetworkAccessManager can't handle those.

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              0
              • C Offline
                C Offline
                ChrisW67
                wrote on last edited by
                #7

                What redirection mechanism in QNetworkAccessManager? The QNetworkReply it gives you represents what the server sends. Neither class follows redirections or sends a new request.

                Web browsers follow redirections and execute Javascript by default, which is why Firefox works.

                I fail to see what all the other talk bemoaning the service's anti-leaching/revenue protection measures has to do with Qt.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  adnan
                  wrote on last edited by
                  #8

                  I meant difference between theses two
                  @redirect = reply.attribute(QNetworkRequest.RedirectionTargetAttribute).toUrl()@

                  @downUrl=reply->header(QNetworkRequest::LocationHeader).toString(); @

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved