Results 1 to 17 of 17

Thread: Download file thru rapidshare API

  1. #1
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Download file thru rapidshare API

    Hi,

    How to download a file thru rapidshare API as a free user. I am using 'sub=download' as specified in http://images.rapidshare.com/apidoc.txt API with fileid and filename but the first response that i am getting is completely empty.

    A sample code will be of better help.

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Download file thru rapidshare API

    Can you still download files as unregistered user from RapidShare?
    I thought they've disabled it after Megaupload takedown.

  3. #3
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Download file thru rapidshare API

    I think we can download file thru Rapidshare as normal registered user.
    We don't need RapidPro user for tat.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Download file thru rapidshare API

    Quote Originally Posted by raj_iv View Post
    Hi,

    How to download a file thru rapidshare API as a free user. I am using 'sub=download' as specified in http://images.rapidshare.com/apidoc.txt API with fileid and filename but the first response that i am getting is completely empty.

    A sample code will be of better help.
    You are probably getting a redirection you should follow. What is the status code of the reply you get from the server?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Download file thru rapidshare API

    yes i am getting redirection with status code 302
    but after handling redirection i m not getting any further reply.
    Please go thru following code what i m doing (manager is defined as QNetworkAccessManager manager; in class WebServiceManager):

    WebServiceManager::WebServiceManager()
    : QObject(0)
    {
    connect(&manager, SIGNAL(finished(QNetworkReply*)),
    SLOT(downloadFinished(QNetworkReply*)));
    }

    void WebServiceManager::downloadFinished(QNetworkReply* reply)
    {
    if(reply->error() > 0)
    {
    qDebug() << reply->errorString();
    }
    else
    {
    int v = reply->attribute(QNetworkRequest::HttpStatusCodeAttribut e).toInt();

    if (v >= 200 && v < 300) // Success
    {
    ... file download code
    }
    else if (v >= 300 && v < 400) // Redirection - i m getting into this block
    {
    // Get the redirection url
    QUrl newUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttri bute).toUrl();
    // Because the redirection url can be relative,
    // we have to use the previous one to resolve it
    newUrl = reply->url().resolved(newUrl);

    QString nurl = newUrl.toString();

    QNetworkAccessManager *manager2 = reply->manager();
    QNetworkRequest redirection(newUrl);
    QNetworkReply *newReply = manager2->get(redirection);

    return; // to keep the manager for the next request
    }
    }
    reply->manager()->deleteLater();
    reply = 0;
    }

    Am i doing something wrong for my code to work after redirection.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Download file thru rapidshare API

    You certainly shouldn't be calling deleteLater on the manager, it will crash your application upon exit.

    So basically you are not getting any response for your second request?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Download file thru rapidshare API

    yes, i m not getting any response for second request.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Download file thru rapidshare API

    Can you show us the url and set of headers set on the second request? You can retrieve them with QNetworkRequest::url() and QNetworkRequest::rawHeaderList() respectively. Also show us the set of headers you get from the reply redirecting you to the new url.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Download file thru rapidshare API

    This is the Url i am getting on the second request:
    https//rs504p10.rapidshare.com/cgi-bin/rsapi.cgi?sub=download&fileid=1117xxxxxx&filename= CPlxxxx.txt

    i am not getting any set of headers on second request, its empty...i m printing it with following code:

    QList<QByteArray> reqHeaders = redirection.rawHeaderList();

    foreach( QByteArray reqName, reqHeaders )
    {
    QByteArray reqValue = redirection.rawHeader( reqName );
    qDebug() << reqName << ": " << reqValue;
    }

    Also, the header list from reply of second request is also empty.

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Download file thru rapidshare API

    I can hardly believe that. No content-length, no cookies, no nothing? Note that the api docs says free download always uses http whereas your url uses https.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Download file thru rapidshare API

    My original url uses http but after redirection i am getting https url.

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Download file thru rapidshare API

    What is the original url?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #13
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Download file thru rapidshare API

    This is original url:
    http//api.rapidshare.com/cgi-bin/rsapi.cgi?sub=download&fileid=1117xxxxxx&filename= CPlxxxx.txt

  14. #14
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Download file thru rapidshare API

    Can anyone pls tell me y i m always redirected to url that begins with https whereas my original url starts with http. How to handle URLs that starts with https using QNetworkAccessmanager.

  15. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Download file thru rapidshare API

    QNetworkAccessManager doesn't care if your URL is http or https based.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  16. #16
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Download file thru rapidshare API

    But with https URL the slot connected to finished() signal not getting fired. It may be my Qt is not configured with SSL support thus nothing happening beyond tat point in my code...its just hanged.

  17. #17
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Download file thru rapidshare API

    It may be the other end of your connection does something different than you expect. Or it may be a dozen of other things. Take a network sniffer and find out.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. I want to download a piece of file?
    By mismael85 in forum General Programming
    Replies: 1
    Last Post: 27th February 2010, 15:35
  2. Download File
    By BalaQT in forum Qt Programming
    Replies: 2
    Last Post: 13th February 2010, 09:53
  3. Rapidshare API...
    By DevGeek++ in forum Newbie
    Replies: 3
    Last Post: 14th August 2009, 20:11
  4. How to download any file through ftp server
    By thomasjoy in forum Qt Programming
    Replies: 1
    Last Post: 24th July 2007, 01:23

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.