python get sub count from youtube 1

python get sub count from youtube

HTTP GET: GET https://www.googleapis.com/youtube/v3/channels?part=statistics&id={CHANNEL_ID}&key={YOUR_API_KEY}

Here is what the above code is Doing:
1. We’re importing the requests library, which is a library that allows us to make HTTP requests.
2. We’re importing the json library, which allows us to parse the JSON response we get from the API.
3. We’re defining a function called get_channel_statistics, which takes in a channel ID and an API key.
4. We’re building the URL we need to make the API request.
5. We’re making the API request and storing the response in a variable called response.
6. We’re parsing the JSON response and storing it in a variable called data.
7. We’re returning the data.

Similar Posts