Here is an example feed that I would like to parse:https://gdata.youtube.com/feeds/api/users/aniBOOM/subscriptions?v=2&alt=json
You can check it with http://json.parser.online.fr/ to see what it contains.
I have a small problem while parsing data feed provided by youtube. First issue was the way the youtube provided the data wrapped inside feed field and because of that I couldn't parse the username straight from original json file so I had to parse first entry field and generate new Json data from that.
Anyway the problem is that for some reason that doesn't include more than the first username and I don't know why because if you check that feed on online parser the entry should contain all the usernames.
data = value["feed"]["entry"];
Json::StyledWriter writer;
std::string outputConfig = writer.write( data );
//This removes [ at the beginning of entry and also last ] so we can treat it as a Json data
size_t found;
found=outputConfig.find_first_of("[");
int sSize = outputConfig.size();
outputConfig.erase(0,1);
outputConfig.erase((sSize-1),sSize);
reader.parse(outputConfig, value2, false);
cout << value2 << endl;
Json::Value temp;
temp = value2["yt$username"]["yt$display"];
cout << temp << endl;
std::string username = writer.write( temp );
int sSize2 = username.size();
username.erase(0,1);
username.erase((sSize2-3),sSize2);But for some reason [] fix also cuts the data I'm generating, if I print out the data without removing [] I can see all the users but in that case I can't extract temp = value2["yt$username"]["yt$display"];
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/lff_wiHYFvsJ.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.
No comments:
Post a Comment