【发布时间】:2014-08-24 16:46:44
【问题描述】:
我已经嵌入了其他人的视频,但我该怎么做才能将它的所有喜欢、cmets 和视图引入我的页面。我想让访问者也可以在我的页面上制作 cmets 并喜欢它,而不必去 youtube。
【问题讨论】:
标签: javascript php html youtube comments
我已经嵌入了其他人的视频,但我该怎么做才能将它的所有喜欢、cmets 和视图引入我的页面。我想让访问者也可以在我的页面上制作 cmets 并喜欢它,而不必去 youtube。
【问题讨论】:
标签: javascript php html youtube comments
根据我的经验,我认为您不能在 cmets 中嵌入视频,但您可以使用 youtube api 拉取它们:
//Retrieving comments for a video
//Each video entry contains a <gd:comments> tag, which encapsulates the URL to which you will send API requests to retrieve or append to the list of comments for the video. The sample XML below shows how this URL appears in an API response:
<feed>
<entry>
...
<media:group>
...
</media:group>
<gd:comments>
<gd:feedLink
href='https://gdata.youtube.com/feeds/api/videos/VIDEO_ID/comments'/>
</gd:comments>
</entry>
</feed>
//Each comment has an author, a title and content. The following XML shows a sample API //response containing a comments feed:
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
xmlns:batch='http://schemas.google.com/gdata/batch'
xmlns:yt='http://gdata.youtube.com/schemas/2007'
xmlns:gd='http://schemas.google.com/g/2005'
gd:etag='W/"DE8HQXo-eip7ImA9WxRQGU4."'>
<id>tag:youtube,2008:video:ZTUVgYoeN_b:comments</id>
<updated>2008-07-18T22:10:57.065Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://gdata.youtube.com/schemas/2007#comment'/>
<title>Comments on 'My Walk with Mr. Darcy'</title>
<logo>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</logo>
<link rel='related' type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b?v=2'/>
<link rel='alternate' type='text/html'
href='https://www.youtube.com/watch?v=ZTUVgYoeN_b'/>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments?v=2'/>
<link rel='http://schemas.google.com/g/2005#post'
type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments?v=2'/>
<link rel='http://schemas.google.com/g/2005#batch'
type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments/batch?v=2'/>
<link rel='self' type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments?...'/>
<link rel='service' type='application/atomsvc+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments?alt=atom-service&v=2'/>
<link rel='next' type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments?...'/>
<author>
<name>YouTube</name>
<uri>http://www.youtube.com/</uri>
</author>
<generator version='2.0'
uri='http://gdata.youtube.com/'>YouTube data API</generator>
<openSearch:totalResults>9051</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>25</openSearch:itemsPerPage>
<entry gd:etag='W/"D0YASX47eCp7ImA9WxRQGU8."'>
<id>tag:youtube,2008:video:xpI6VNvRTII:comment:F53EAC190E4EA5C9</id>
<published>2008-07-18T14:57:59.000-07:00</published>
<updated>2008-07-18T14:57:59.000-07:00</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://gdata.youtube.com/schemas/2007#comment'/>
<title>Walking is fun</title>
<content>I like it a lot.</content>
<link rel='related' type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b?v=2'/>
<link rel='alternate' type='text/html'
href='https://www.youtube.com/watch?v=ZTUVgYoeN_b'/>
<link rel='self' type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments/F53EAC190E4EA5C9?v=2'/>
<author>
<name>GoogleDevelopers</name>
<uri>https://gdata.youtube.com/feeds/api/users/GoogleDevelopers</uri>
</author>
</entry>
<entry>
...
</entry>
...
</feed>
来源:https://developers.google.com/youtube/2.0/developers_guide_protocol_comments
【讨论】: