This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QString atom( | |
"declare namespace atom = \"http://www.w3.org/2005/Atom\";\n" | |
"declare namespace media = \"http://search.yahoo.com/mrss/\";\n" | |
"doc($result)//atom:entry/media:group/media:player/@url/string()\n" | |
); | |
QXmlQuery query; | |
query.bindVariable("result", &buffer); | |
query.setQuery(atom); | |
QStringList results; | |
query.evaluateTo(&results); | |
foreach (QUrl result, results) { | |
QString videoId = result.queryItemValue("v"); | |
QString videoImage = QString(YTIMG) | |
.arg(qrand() % 3 + 1) | |
.arg(videoId); | |
Media media; | |
media.setId(videoId); | |
media.setImage(QUrl(videoImage)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment