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

Youtube Data API v3 My list of Subscriber is not complete

$
0
0

I'm trying to get a list of all my subscribers using Youtube Data Api. But a large amount of my public subscribers aren't appearing.

# Disable OAuthlib's HTTPS verification when running locally.# *DO NOT* leave this option enabled in production.os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"api_service_name = "youtube"api_version = "v3"client_secrets_file = "YOUR_CLIENT_SECRET_FILE.json"# Get credentials and create an API clientflow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(client_secrets_file, scopes)credentials = flow.run_console()youtube = googleapiclient.discovery.build(api_service_name, api_version, credentials=credentials)curSubDicList = []nextPageToken = ""while TRUE:    #Loop through all subs and fill out the curSubDicList var    request = youtube.subscriptions().list(part="subscriberSnippet", mySubscribers=True, maxResults=50, pageToken=nextPageToken, order="alphabetical")    response = request.execute()    for x in response["items"]:        print(x["subscriberSnippet"]["title"])        subDic = { "title" : x["subscriberSnippet"]["title"], "channelId" : x["subscriberSnippet"]["channelId"], "pfp" : x["subscriberSnippet"]["thumbnails"]["default"]["url"]}        curSubDicList.append(subDic)    if "nextPageToken" in response:        nextPageToken = response["nextPageToken"]    else:        break

I loop through using each new nextPageToken till there isn't one. But for some reason a lot of my public subscribers aren't appearing. I print out my subs to my file subs.json

jsonSubsTxt = open("subs.json", "w", encoding="utf-8")curSubDicListJsonStr = json.dumps(curSubDicList)jsonSubsTxt.write(curSubDicListJsonStr)jsonSubsTxt.close()

I know that a lot of my public subs are missing by using Youtube Studio's built in subscriber viewer, and CTRL + Fing for them in the subs.json. I have a 2nd youtube account called "LowerLevelLemmy" I made sure that my subscriptions were public and subscribed to myself. I appear as a sub in YT Studio, but not in my subs.json. Here's images of what I mean:

My 2nd channel appears in YT Studio as a public sub.

But CTRL Fing for it shows no results.

Sometimes CTRL+Fing someone I see as a sub in YT Studio works but most times it doesn't. When their username doesn't come up with a match, I try searching with their channel ID, but that doesn't work either.

I'm new to Youtube Data Api and this is my first time submitting a question to Stack Over Flow. I hope I did everything right. Thank you for reading.


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>