November 18, 2010

doforumda doforumda
Lab Rat
161 posts

need help youtube APIs with qt

 

hi

i need some links where i can learn how to use youtube APIs with qt.i google it but i could not find any useful links. Please help
thanks

6 replies

November 18, 2010

xizzhu xizzhu
Lab Rat
58 posts

Basically, you need to send some HTTP request using e.g. QNetworkAccessManager, then parse the received data.

For example, if you send a HTTP GET request like this:

  1. http://gdata.youtube.com/feeds/api/videos?q=football+-soccer&orderby=published&start-index=11&max-results=10&v=2

You can get a ATOM-formatted reply, containing the query result, from which you can parse e.g. the URL of the content and thumbnail, etc., then you can send another request to get the data.

 Signature 

My Blog: http://xzis.me/

November 18, 2010

doforumda doforumda
Lab Rat
161 posts

thanks but any link would be help full

November 18, 2010

xizzhu xizzhu
Lab Rat
58 posts

YouTube API: http://code.google.com/apis/youtube/2.0/developers_guide_protocol_audience.html

 Signature 

My Blog: http://xzis.me/

November 18, 2010

doforumda doforumda
Lab Rat
161 posts

well i have used youtube api in past with PHP. i know how to do this in PHP. but i need to how can i access youtube stuff using QT. I mean i need some examples. if there are any links for this then provide it here i ll really appreciate that.

November 19, 2010

Irfan Irfan
Lab Rat
3 posts

doforumda: Were you able to do it with Qt?? please sher if you got any success

November 20, 2010

xizzhu xizzhu
Lab Rat
58 posts

doforumda, here goes some basic samples to send some request:

  1. class MyObject : public QObject
  2. {
  3.     Q_OBJECT
  4. public:
  5.     explicit MyObject(QObject *parent = 0);
  6.  
  7. private slots:
  8.     void processReply();
  9. };
  10.  
  11. MyObject::MyObject(QObject *parent) :
  12.     QObject(parent)
  13. {
  14.  
  15.     QNetworkRequest request;
  16.     request.setUrl(QUrl("http://gdata.youtube.com/feeds/api/videos?q=football&orderby=published&max-results=1&v=2"));
  17.  
  18.     QNetworkReply *reply = nam->get(request);
  19.     connect(reply, SIGNAL(finished()), SLOT(processReply()));
  20. }
  21.  
  22. void MyObject::processReply()
  23. {
  24.     QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
  25.  
  26.     if (reply->error() != QNetworkReply::NoError) {
  27.         qDebug() << "Error found: " << reply->error();
  28.         return;
  29.     }
  30.  
  31.     QByteArray content = reply->readAll();
  32.     qDebug() << content;
  33.  
  34.     // Here, you can use, e.g. QXmlStreamReader, to parse the received content
  35.  
  36.     reply->deleteLater();
  37. }

 Signature 

My Blog: http://xzis.me/

 
  ‹‹ Combined Nokia SDK and Desktop SDK?      Server-client connection ››

You must log in to post a reply. Not a member yet? Register here!