mirror of
https://github.com/metafy-social/python-scripts.git
synced 2024-11-23 20:11:10 +00:00
Added script for fetching Youtube channel info
This commit is contained in:
parent
7d4e1a9cac
commit
53b51676ee
8
scripts/youtube_channel_info/README.md
Normal file
8
scripts/youtube_channel_info/README.md
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Youtube Channel Info
|
||||||
|
This is a simple script that fetches info about a youtube channel.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
- Clone the repo
|
||||||
|
- download the requirements
|
||||||
|
- add the api key and channel id
|
||||||
|
- run python script.py
|
18
scripts/youtube_channel_info/script.py
Normal file
18
scripts/youtube_channel_info/script.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
from googleapiclient.discovery import build
|
||||||
|
|
||||||
|
youtube = build('youtube', 'v3',
|
||||||
|
developerKey='Enter API key')
|
||||||
|
|
||||||
|
ch_request = youtube.channels().list(
|
||||||
|
part='statistics',
|
||||||
|
id='Enter Channel ID')
|
||||||
|
|
||||||
|
ch_response = ch_request.execute()
|
||||||
|
|
||||||
|
sub = ch_response['items'][0]['statistics']['subscriberCount']
|
||||||
|
vid = ch_response['items'][0]['statistics']['videoCount']
|
||||||
|
views = ch_response['items'][0]['statistics']['viewCount']
|
||||||
|
|
||||||
|
print("Total Subscriber:- ", sub)
|
||||||
|
print("Total Number of Videos:- ", vid)
|
||||||
|
print("Total Views:- ", views)
|
Loading…
Reference in New Issue
Block a user