Youtube GData API:检索公共统计数据

发布于 2024-12-19 18:16:44 字数 327 浏览 1 评论 0 原文

YouTube 现在有一个显示视频统计信息按钮,可以显示视频的统计信息,例如一段时间内的观看次数和人口统计数据。

我查看了 YouTube api,但似乎没有找到检索此数据的方法。 我能想到的最接近的是 http://code.google.com/apis/ youtube/2.0/developers_guide_protocol_insight.html 但这是针对特定用户的。我希望获得公开的数据。

On YouTube now there is a show video statistics button which shows the statistics of video like view count over time and demography .

I have looked through the YouTube api but I didn't seem to find a way to retrieve this data.
The closest I could come to was http://code.google.com/apis/youtube/2.0/developers_guide_protocol_insight.html but this is for particular user . I wished to get data available in public .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

心碎无痕… 2024-12-26 18:16:44

是的,正如 mad_scientist 所说,视频的公共见解不是通过 API

https://developers 提供的。 google.com/youtube/2.0/developers_guide_protocol_insight

“YouTube Insight 是一个分析和报告引擎,提供视频和频道的观看统计数据、受欢迎程度指标和人口统计信息。

A video entry contains a link to Insight data if the authenticated user retrieving the entry owns the video.

A profile entry contains a link to Insight data for the channel if the authenticated user is retrieving his or her own profile."

如果如果您想获得喜欢和不喜欢的信息,并使用 c#,可以使用以下代码:

https://groups.google.com/forum/?fromgroups=#!topic/youtube-api-gdata/UBbiyE3Cw5M

:)

Yes like mad_scientist said, the public insights for a video are not provided via the API

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

"YouTube Insight, an analytics and reporting engine, provides viewing statistics, popularity metrics and demographic information for videos and channels.

A video entry contains a link to Insight data if the authenticated user retrieving the entry owns the video.

A profile entry contains a link to Insight data for the channel if the authenticated user is retrieving his or her own profile."

If you want to get likes and dislikes, and works with c#, you can use this code:

https://groups.google.com/forum/?fromgroups=#!topic/youtube-api-gdata/UBbiyE3Cw5M

:)

时常饿 2024-12-26 18:16:44

不幸的是,视频的公共见解不是通过 API 提供的(我很确定他们不会添加 id,但他们可能有很小的机会在新的分析 API 中实现这一点)。如果您想查询自己视频的统计数据,可以使用 Insights APIInsights API。 从 xml/CDATA-Response 中筛选/解析见解

对于所有其他视频,您可以使用此链接http://www.youtube.com/insight_ajax?action_get_statistics_and_data=1&v=YOURVIDEOID

您应该使用能够解析损坏的 html 的解析器,例如用于 python 的 lxml 或 BeautifulSoup。

Unfortunately, the public insights for a video are not provided via the API (and I´m pretty sure they won´t add id, but maybe there is a small chance they´ll implement this in the new analytics API). If you want to query the statics for your own video, you could use the insights APIInsights API. For all other videos, you could screen-scrape/parse the insights out of the xml/CDATA-Response with this link

http://www.youtube.com/insight_ajax?action_get_statistics_and_data=1&v=YOURVIDEOID

You should use a parser which is capable of parsing broken html, like lxml or BeautifulSoup for python.

横笛休吹塞上声 2024-12-26 18:16:44

现在该服务可用,但现在他需要一个令牌来下载包含所有数据的文件insight ajax.xml。因为如果调用该服务
http://www.youtube.com/insight_ajax?action_get_statistics_and_data=1&v=MYVIDEOID
响应是

<?xml version="1.0" encoding="UTF-8"?>
<root><return_code>
<![CDATA[1]]>
</return_code>
<error_message>
<![CDATA[The request is not valid.]]>
</error_message></root>

POST 调用具有以下格式:

Parameters 
application/x-www-form-urlencoded
session_token   1UEcRYZx-I3xifChIhm5QFOKxfJ8MTM3MjI1MjY3OUAxMzcyMTY2Mjc5
Source
session_token=1UEcRYZx-I3xifChIhm5QFOKxfJ8MTM3MjI1MjY3OUAxMzcyMTY2Mjc5

Now this service is available, but now he need a token for download the file insight ajax.xml with all data. because if a call the service
http://www.youtube.com/insight_ajax?action_get_statistics_and_data=1&v=MYVIDEOID
the response is

<?xml version="1.0" encoding="UTF-8"?>
<root><return_code>
<![CDATA[1]]>
</return_code>
<error_message>
<![CDATA[The request is not valid.]]>
</error_message></root>

the POST call has this fotmat :

Parameters 
application/x-www-form-urlencoded
session_token   1UEcRYZx-I3xifChIhm5QFOKxfJ8MTM3MjI1MjY3OUAxMzcyMTY2Mjc5
Source
session_token=1UEcRYZx-I3xifChIhm5QFOKxfJ8MTM3MjI1MjY3OUAxMzcyMTY2Mjc5
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文