YouTube搜索任何查询都需要100个查询吗?

huangapple go评论72阅读模式
英文:

YouTube search for any query cost 100 queries?

问题

在这个页面上看到 -

https://developers.google.com/youtube/v3/determine_quota_cost

在"search"功能下,我看到每次使用需要100个查询。我不知道"search"是否指的是端点中的q查询参数,这就是我想要弄清楚的。当我在我的应用中使用以下网络调用时 -

interface YoutubeApi {

    const val BASE_URL = "https://youtube.googleapis.com/"

    @GET("youtube/v3/search?part=snippet&maxResults=3")
    suspend fun searchYoutubeVideos(
        @Query("q") searchQuery : String,
        @Query("key") apiKey : String
    ) : NetworkResponse<YoutubeSearchResultModel,String>
}

无论我只请求3个对象,我的调用总是需要100个查询,这相当昂贵。我是不是做错了什么,还是这就是YouTube API中每次搜索的价格?

英文:

Looking by this page -

https://developers.google.com/youtube/v3/determine_quota_cost

Under the "search" function I see that it costs 100 queries per use. I don't know if "search" means the q query parameter in the endpoint, and this is why I am trying to figure out. When I am using the following network call in my app -

interface YoutubeApi {

    const val BASE_URL = &quot;https://youtube.googleapis.com/&quot;

    @GET(&quot;youtube/v3/search?part=snippet&amp;maxResults=3&quot;)
    suspend fun searchYoutubeVideos(
        @Query(&quot;q&quot;) searchQuery : String,
        @Query(&quot;key&quot;) apiKey : String
    ) : NetworkResponse&lt;YoutubeSearchResultModel,String&gt;
}

My call always results in costing 100 queries, regardless of me asking only for 3 objects, which is pretty expensive. Am I doing something wrong or this is how it works and this is the price for each search in the YouTube API?

答案1

得分: 1

YouTube Data API v3 Search: list endpoint is very expensive, consider applying for quota extension.

英文:

YouTube Data API v3 Search: list endpoint is very expensive, consider applying for quota extension.

答案2

得分: 1

抱歉,maxResults 与配额成本无关。正如他们的文档清楚说明的那样,它始终是100个点,不管每页的结果数量如何。此外,每次请求下一页时,每个后续调用本身都会消耗100个点(一次单一搜索,3页结果,300个点)。

英文:

Sadly, maxResults is not connected with quota cost. It's always 100 points, as clearly stated in their docs, regardless of the number of results per page.
Also, every subsequent call while requesting the next page has a cost of 100 points itself (one single search, 3 pages of results, 300 points)

huangapple
  • 本文由 发表于 2023年4月10日 21:53:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75977723.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定