获取YouTube评论URL


Get YouTube Comments URL?

youtube视频页面的评论是来自Google+的iframe。

是否可以获得iframe的URL ?

URL很长,我看不出其中的模式:

https://apis.google.com/u/0/b/112383300030545024301/wm/4/_/widget/render/comments?usegapi=1&first_party_property=YOUTUBE&href=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DnCgQDjiotG0&owner_id=L8ZULXASCc1I_oaOT0NaOQ&query=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DnCgQDjiotG0&stream_id=UCL8ZULXASCc1I_oaOT0NaOQ&substream_id=nCgQDjiotG0&view_type=FILTERED&width=590&youtube_video_acl=PUBLIC&viewer_id=UC8JjcqxbRmTpP6P-yRPs9_w&hl=de_DE&origin=https%3A%2F%2Fwww.youtube.com&search=%3Fv%3DnCgQDjiotG0&hash=&gsrc=1p&jsh=m%3B%2F_%2Fscs%2Fabc-static%2F_%2Fjs%2Fk%3Dgapi.gapi.en.tj_0ZMtt37Y.O%2Fm%3D__features__%2Frt%3Dj%2Fd%3D1%2Frs%3DAItRSTNq9BUbpcVyrrQw8r5GUHIc2HQyDQ#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh%2Confirsttimeplusonepromo%2Conthumbsup%2Contimestampclicked%2Conready%2Conallcommentsclicked&id=I0_1394888331421&parent=https%3A%2F%2Fwww.youtube.com&pfname=&rpctoken=30117793

你不能通过API获得URL,我已经尝试解析HTML并获得URL,它没有工作,虽然它应该工作。

模式如下:

https://apis.google.com/u/0/wm/4/_/widget/render/comments?width={WIDTH}&first_party_property=YOUTUBE&view_type={FILTER}&sort=1&page_size={COMMENTS_PER_PAGE}&stream_id={CHANNEL_ID}&substream_id={VIDEO_ID}&query=http://youtu.be/{VIDEO_ID}

使用您的{CHANNEL_ID}{VIDEO_ID}{FILTER}的这些值:FILTERED, FILTERED_POSTMOD, UNFILTERED。{COMMENTS_PER_PAGE} = 100的最大值

您可以订阅iframe postMessages并获得一些有用的信息,如渲染后小部件的高度。

使用youtube API v2获取评论

https://developers.google.com/youtube/2.0/developers_guide_protocol_comments