Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3712

Videos sorted by relevance with more views than sorted by View count on YouTube

$
0
0

I'm trying to implement a search of the most popular videos by tag with Youtube API v3, and encountered a problem when videos sorted by Relevance have more views than those that were sorted by View count.

export const videoList = async (p = null, args: any): Promise<VideoItems | undefined> => {try {    const {q, maxResults = 5} = args || {};    const youtube = google.youtube({auth: process.env.GOOGLE_CLIENT_API_KEY, version: 'v3'});    const resp: any = await youtube.search.list({        part: 'snippet',        order: 'relevance',        relevanceLanguage: 'en',        regionCode: 'us',        type: 'video',        q: `#${q}`,        maxResults    });    return {        items: resp?.data?.items?.map((item: VideoItem) => (            {id: item?.id?.videoId, title: item?.snippet?.title})        )    };} catch (err) {    console.log(err);}

This behavior is reproduced in a native YouTube search:

By relevance: https://www.youtube.com/results?search_query=%23Equality+of+triangles&sp=CAA%253D

By View count: https://www.youtube.com/results?search_query=%23Equality+of+triangles&sp=CAM%253D

  1. Is there a better way to get the most popular videos by tag with high numbers of views other than order: 'relevance'?
  2. Why do videos sorted by relevance have more views than those sorted by View count?

Viewing all articles
Browse latest Browse all 3712

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>