Get the number of Youtube subscribers

Copying of Virtual Youtuber data collection using Youtube Data API -Qiita

Channels  |  YouTube Data API  |  Google Developers

nijisanji.py


from googleapiclient.discovery import build

YOUTUBE_API_KEY = '<API KEY>'


def youtube_channel_detail(channel_id, api_key):
    api_service_name = 'youtube'
    api_version = 'v3'
    youtube = build(api_service_name, api_version, developerKey=api_key)
    search_response = youtube.channels().list(
        part='snippet,statistics',
        id=channel_id,
    ).execute()

    return search_response['items'][0]


def main():

    d = youtube_channel_detail('UCHVXbQzkl3rDfsXWo8xi2qw', YOUTUBE_API_KEY)
    print(d['snippet']['title'])
    print(d['statistics']['subscriberCount'])
$ python3 nijisannji.py
Ange Katrina- Ange Katrina -
257000

Recommended Posts

Get the number of Youtube subscribers
Get the number of digits
Get the number of views of Qiita
10. Counting the number of lines
Calculate the number of changes
Get the size (number of elements) of UnionFind in Python
[Python] Get the number of views of all posted articles
Calculation of the number of Klamer correlations
Get the number of specific elements in a python list
Get the attributes of an object
Get the number of occurrences for each element in the list
Get the number of PVs of Qiita articles you posted with API
Get the number of readers of a treatise on Mendeley in Python
Count / verify the number of method calls.
Get the column list & data list of CASTable
Get the minutes of the Diet via API
Get the value of the middle layer of NN
Get the last day of the specified month
[Python] Get the character code of the file
Get the filename of a directory (glob)
[PowerShell] Get the reading of the character string
Count the number of characters with echo
Get the number of searches with a regular expression. SeleniumBasic VBA Python
Get the number of articles accessed and likes with Qiita API + Python
Output the number of CPU cores in Python
[Python] Get / edit the scale label of the figure
[Python] Get the main topics of Yahoo News
Get the caller of a function in Python
Calculate the total number of combinations with python
Divide the string into the specified number of characters
Find the number of days in a month
Minimize the number of polishings by combinatorial optimization
Get only the address part of NIC (eth0)
To get the path of the currently running python.exe
Determine the number of classes using the Starges formula
[Python] Get the day of the week (English & Japanese)
Get the update date of the Python memo file.
Get the title of yahoo news and analyze sentiment
The beginning of cif2cell
python beginners tried to predict the number of criminals
How to know the port number of the xinetd service
[Python] A program that counts the number of valleys
Projecet Euler 12 Find the number of divisors without division.
Get the GNOME version
[Python] Get the official file path of the shortcut file (.lnk)
relation of the Fibonacci number series and the Golden ratio
The meaning of self
[Python] Get the text of the law from the e-GOV Law API
Count the number of parameters in the deep learning model
Calculation of the minimum required number of votes from turnout
Get the image of "Suzu Hirose" by Google image search.
Get the absolute path of the script you are running
[python] Get the list of classes defined in the module
Since there are many earthquakes, get the history of earthquakes
Get the return code of the Python script from bat
Try to estimate the number of likes on Twitter
[C language] [Linux] Get the value of environment variable
The story of sys.path.append ()
Get to know the feelings of gradient boosting trees
Predict the number of people infected with COVID-19 with Prophet
[Python] Get the list of ExifTags names of Pillow library