pull out a single photo url and thumbnail if it exists
This commit is contained in:
parent
6473657bf8
commit
97ce9579ec
1 changed files with 20 additions and 1 deletions
21
src/Pnut.cpp
21
src/Pnut.cpp
|
@ -559,7 +559,26 @@ QVariantList Pnut::parseStream(QVariantList stream)
|
||||||
item = item["repost_of"].toMap();
|
item = item["repost_of"].toMap();
|
||||||
item.insert("reposted_by", username);
|
item.insert("reposted_by", username);
|
||||||
}
|
}
|
||||||
|
if (item.find("raw") != item.end())
|
||||||
|
{
|
||||||
|
QVariantList rawlist = item["raw"].toList();
|
||||||
|
foreach (QVariant ritem, rawlist) {
|
||||||
|
QVariantMap raw = ritem.toMap();
|
||||||
|
if (raw["type"] == "io.pnut.core.oembed")
|
||||||
|
{
|
||||||
|
QVariantMap value = raw["value"].toMap();
|
||||||
|
if (value["type"] == "photo")
|
||||||
|
{
|
||||||
|
item.insert("photo_url", value["url"].toString());
|
||||||
|
if (value.find("thumbnail_url") != value.end())
|
||||||
|
{
|
||||||
|
item.insert("thumbnail_url", value["thumbnail_url"].toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pstream.append(item);
|
pstream.append(item);
|
||||||
}
|
}
|
||||||
return pstream; // but not really
|
return pstream;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue