sns-sdks / python-youtube

A simple Python wrapper for YouTube Data API :sparkles: :cake: :sparkles: .
https://sns-sdks.github.io/python-youtube/
MIT License
315 stars 47 forks source link

Requesting client.channels.list with for_username #158

Closed dj2ball closed 10 months ago

dj2ball commented 1 year ago

I am struggling to use the for_username argument to request a client channel list. Example code below:


from pyyoutube import Client import json

Youtube Data API V3

API_KEY = "XXX"

client = Client(api_key = API_KEY)

response = client.channels.list(channel_id="UCMo28ATCDU0Kn9dpilAF79Q", return_json=True)

response = client.channels.list(for_username="@TheOverlap", return_json=True)

print(json.dumps(response))

RESPONSE: {"kind": "youtube#channelListResponse", "etag": "RuuXzTIr0OoDqI4S0RU6n4FqKEM", "pageInfo": {"totalResults": 0, "resultsPerPage": 5}}

MerleLiuKun commented 1 year ago

The for_username is not for the new username for the channel. And This username is in the old youtube version and for a youtube user,

You can get more information at doc

fireattack commented 1 year ago

I assume there is no API for the "new" username yet?

MerleLiuKun commented 1 year ago

As of now, tthe field custom_url (at the channel snippet part) will return this new username data, but there is no place to use this username to fetch other data.

MerleLiuKun commented 10 months ago

169