new problem of Video comments object (Wireshark)

This is the problem i have posted in to asp.net forms and also send some copy forward to some api team members

Abstract:
HOWTO get the video comments for a specific video clip…
The request.getcomment(Video) doesnt work

Content:
i met a problem with Youtube video comments.

YouTubeQuery YTquery_MP = new YouTubeQuery();
YTquery_MP.Uri = new Uri(“http://gdata.youtube.com/feeds/api/standardfeeds/most_popular?time=today”);
YTquery_MP.NumberToRetrieve = 20;
YTquery_MP.StartIndex = 1;
i am using Feed v= request.Get(YTquery_MP);

After this, i obtained the video entry which contained 20 videos.
and i saved the vid and title into dataset in the foreach loop, in order to do the paging work.

And i got another page called: display.aspx. ( once user click a video clip picture in first page, hyperlink will redriect to display.aspx page within this url “~/display.aspx?vid=xxx”)

My problem is.. i can display(or embed the video in display page) but im not sure how to get the comments.

i go through the .Net guide, it shows Feed commentlist= request.Getcomments(Video v) could be design to do this job, however, here, i just send the videoid to the display page..
i tried to create a new Video instance called Video v= new Video();
and add the id for it…. v.id=xxx; v. videoid= xxx; to it, and then using the
Feed commentlist= request.Getcomments(Video v) , but the result always turns to null.

and i found Feed commentlist= request.Get() got three overloaded method…
(Feedquery f), ( url ) and ( Feedcomments feed, requestType operation)..
i am not sure how to handle the comments stuff..
cause i can only send this videoid, and vidoeTitle to the display page within url..
Any good way to get the comments information in this case?

some codes like this may help get the basic idea:

if (Request.QueryString["vid"] != null)
{

YouTubeRequestSettings youtubesetting = new YouTubeRequestSettings();
YouTubeRequest requset = new YouTubeRequest(youtubesetting);

string vid = Request.QueryString["vid"];
Video v = new Video();
v.Id = vid;
v.VideoId = vid;
Feed commentlist = requset.GetComments(v); //it doesnt work..

}

The things in vid is like :”l8pSPfZFysg”

Here is the API supporter’s generous reply :
To get the comments, i use the LINK inside the Video entry. so a reqquest.GetComments looks at the comments subelement, and the href attribute in there. With just the videoID, you are lost. There is nothing you can do with that, as far as i know. You might ask in the youtube newsgroup if there is a “shortcut” that computes the link you need to use.

So you either store the above LINK and send that one. Then you can use the query object to take that link and get a feed of comments. Or you need to hold on to the video object etc.. or get the video object based on the videoId (by constructing a query object etc…)

i spent the whole night to figure out the problem, since the request.Get(uri) existed, so, could be some url to handle retrieve the specific video clip’s comments. i wish…
I turn on the Wireshark, wanna find the http request for the feed response. i captured the package and read through the http header:
and found out the url for doing this feed query.
wrieshark1

The the URL after GET / is what we looking for..

The solution i did also for replying the expert’s help:
i did it by using Wireshark Analysis the post http request:
and found it could be easy solve by using Feed c=request.Get(new Uri(“http://gdata.youtube.com/feeds/api/videos/”+vid+”/comments?client=yourclientINFO,HTTP/1.1″));
and its great easy and u only need to know vid there..

Now, i can get a single video page only for displaying video and show out the related comments. :D ..
display

Really haaappy to sort out the problem after almost 5 hr+ looking up. :D


~ by kimialex92 on 2009/04/30.

Leave a Reply