1

How i can get list of popular youtube channels per each country?

this service find solution https://www.channelcrawler.com/eng/results2/281574

I tried youtube api but i didn't find, anyone know solution?

mark8422
  • 25
  • 7
  • AFAIK it's not possible because YouTube Data API v3 [Search: list](https://developers.google.com/youtube/v3/docs/search/list) isn't very accurate so I would suggest you [this perilous method](https://stackoverflow.com/questions/68970958/how-do-i-get-channel-ids-for-all-youtube-channels-in-japan/69259093#69259093). – Benjamin Loison Dec 26 '21 at 22:03
  • I don't know if you are talking about my perilous method or about Search: list endpoint. And saying "this not work" doesn't give me details to give you advices. What doesn't work ? – Benjamin Loison Dec 27 '21 at 00:35

1 Answers1

0

As mentioned, is not possible to get this information using the YouTube API directly, even in the FAQ of the page you shared says:

The Channel Crawler was made to discover new YouTube channels, based on your search criteria.

and:

The Channel Crawler uses advanced data collection methods in order to collect channel information from YouTube and store it in the database. Basically, it just checks the liked videos and comment sections of channels that are already in the database, in order to add more channels to it. You can also manually add a channel.

Following the highlighted information, I have this idea and you can try it too:

  • Use the search endpoint for search channels in a specific country and in a specific videoCategory, then, with the channelId returned in the results of the search, use the channel endpoint for get their country1.

1 take into account that some channels doesn't have the country value; in this case, you have to set another criteria(s) for determine whether the channel matches with your requirements.

Example:

  • Use the search endpoint for search channels in country/region Pakistan and in the videoCategory Sports - test it here:

URL:

https://youtube.googleapis.com/youtube/v3/search?part=id%2Csnippet&order=videoCount&q=Sports&regionCode=PK&key=[YOUR_API_KEY]

The results of this request are as follows:

{
  "kind": "youtube#searchListResponse",
  "etag": "0C7hSI3oNXJt66PsERuviVQcLCo",
  "nextPageToken": "CAUQAA", // Remember the nextPageToken for get the next results. 
  "regionCode": "PK", // Region queried.
  "pageInfo": {
    "totalResults": 1000000, // Look the amount of data you have to check, filter and debug.
    "resultsPerPage": 5 // Set "maxResults" parameter to "50" for get more results per page.
  },
  "items": [
    {
      "kind": "youtube#searchResult",
      "etag": "iSwEnBs_yV6lOIBubmRXVwjjujQ",
      "id": {
        "kind": "youtube#channel", // Make sure that this item is actually an channel.
        "channelId": "UCo2TvjBHS1BtyIkeGGTMe6w"
      },
      "snippet": {
        "publishedAt": "2018-07-28T18:34:04Z",
        "channelId": "UCo2TvjBHS1BtyIkeGGTMe6w", // Use this value for the "channel" endpoint. 
        "title": "ONTime Sports",
        "description": "قناة اون تايم سبورت واحدة من مجم...",
        "thumbnails": { [thumbnails here...] },
        "channelTitle": "ONTime Sports",
        "liveBroadcastContent": "upcoming",
        "publishTime": "2018-07-28T18:34:04Z"
      }
    },
    [other results here...]
  ]
}
  • Use channel endpoint for get the channel detailed information - in this case, their country - test it here:

URL - using the channelId UCo2TvjBHS1BtyIkeGGTMe6w - obtained from the previous search results:

https://youtube.googleapis.com/youtube/v3/channels?part=id%2Csnippet&id=UCo2TvjBHS1BtyIkeGGTMe6w&key=[YOUR_API_KEY]

The results of this request are as follows:

{
  "kind": "youtube#channelListResponse",
  "etag": "8BfUXxlAEBLe7lBmih1JXUwZ394",
  "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 5
  },
  "items": [
    {
      "kind": "youtube#channel",
      "etag": "AFk5NCl9393ui58WyRf7WljoatE",
      "id": "UCo2TvjBHS1BtyIkeGGTMe6w",
      "snippet": {
        "title": "ONTime Sports",
        "description": "large description here...",
        "customUrl": "ontimesportseg",
        "publishedAt": "2018-07-28T18:34:04Z",
        "thumbnails": {[thumbnails here]},
        "localized": {
          "title": "ONTime Sports",
          "description": "large description here..."
        },
        "country": "EG" // This is the regionCode of the country this channels has provided.
      }
    }
  ]
}

Here, you can see that the value "country" for this channel is "EG" = Egypt2.

Then, repeat these steps with all countries and videoCategory for each country.


Considerations:

  1. As I tested, the type parameter in search is not working as one might expect, in this case (for get channels only), use the order=viewCount combination of parameter=value. Even with this combination, make sure to check that the value of the kind attribute is: youtube#channel. Also, I search the videoCategory using its name, no its id - as it should be -, but, the API is not perfect, that's why I used the name of the videoCategory.
  2. Even specifiyng the region parameter with a valid country, you might get results that are either from another countries or doesn't have the country attribute and value at all = and that's due the channel's popularity in the given country and public channel information. A simple example could be: ESPN, they probably have a YouTube channel for each country, but, their main channel is the most popular in all countries, so, in this case, you'll get the ESPN channel in english and that might differ from your expected results. You have to work with what YouTube provides.
  3. As you notice, there are too many channels/results to debug, so, make sure to provide more filters and set your queries/search criteria and (once you get the desired results), store the valid results in a database or similar.
  4. If you know specific channels that you know are popular in a given country, but, when you query that channel using the YouTube Data API, it doesn't bring the country value, you have to save that channel manually in your database and/or collect more information for automatically set if a channel is from a given country - this point is very related to my point # 2.