/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef UBOEMBEDPARSER_H
#define UBOEMBEDPARSER_H
#include
#include
#include
#include
#include
#include
#include
#include
/**********************************************************************************
----------------------------------------------------------------
Here is an example of an embed content in an XML representation
----------------------------------------------------------------
http://www.youtube.com/EPISODE 36 Traditional MediumsFZDSCHOOL2704804801.0http://www.youtube.com/user/FZDSCHOOLYouTubehttp://i4.ytimg.com/vi/C3lApsNmdwM/hqdefault.jpgvideo360
***********************************************************************************/
typedef struct{
QString providerUrl;
QString title;
QString author;
int height;
int width;
int thumbWidth;
float version;
QString authorUrl;
QString providerName;
QString thumbUrl;
QString type;
QString thumbHeight;
QString html;
QString url;
}sOEmbedContent;
class UBOEmbedParser : public QObject
{
Q_OBJECT
public:
UBOEmbedParser(QObject* parent=0, const char* name="UBOEmbedParser");
~UBOEmbedParser();
void parse(const QString& html);
void setNetworkAccessManager(QNetworkAccessManager* nam);
signals:
void parseContent(QString url);
void oembedParsed(QVector contents);
private slots:
void onFinished(QNetworkReply* reply);
void onParseContent(QString url);
private:
sOEmbedContent getJSONInfos(const QString& json);
sOEmbedContent getXMLInfos(const QString& xml);
QVector mContents;
QVector mParsedTitles;
QNetworkAccessManager* mpNam;
int mPending;
};
#endif // UBOEMBEDPARSER_H