且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如果频道具有自定义 url,如何使用 *** 数据 API 获取 *** 频道详细信息

更新时间:2023-11-26 22:32:34

最简单的解决方案,只使用 API,就是使用 *** Data API 的 Search:list 方法.据我所知(请注意,这是我自己的研究,官方文档对此主题没有任何说明!),如果您使用自定义 URL 组件进行搜索,使用频道"结果类型过滤器和相关性"(默认)排序,第一个结果应该就是您要查找的内容.

Simplest solution, using API only, is to just use Search:list method of *** Data API. From what I can tell (mind you, this is from my own research, official docs say nothing on this subject!), if you search using the custom URL component, with "channel" result type filter and "relevance" (default) sorting, first result should be what you're looking for.

所以下面的查询得到 16 个结果,第一个是您要查找的结果.我测试过的所有其他自定义频道网址也是如此,所以我认为这是最可靠的方法.

So the following query gets 16 results, with the first one being the one you're looking for. Same goes for all other custom channel URLs I tested, so I think this is the most reliable way of doing this.

GET https://www.googleapis.com/***/v3/search?part=id%2Csnippet&q=annacavalli&type=channel&key={YOUR_API_KEY}

另一个想法是在自定义 URL 上抓取 *** 页面,您可以在其中找到 ChannelID 在 HTML 代码的元标记之一中.但这是无效、不可靠和 AFAIK 违反 *** 使用条款.

The other idea is just scraping *** page at the custom URL, where you can find ChannelID in one of the meta tags in HTML code. But that's ineffective, unreliable and AFAIK in violation of *** terms of use.

好吧,它不会为较小的频道返回任何结果,因此它根本不可靠.

Well, it returns no results for smaller channels, so it's not reliable at all.