0

I was wondering how you can obtain your own channel ID using youtube API, or printing a list of the specific channelIDs from your user, since you can have multiple channels on your own user.(im using client_secrets)

i've been watchin alot of the documentation for youtube, but aint finding anything relevant for just this.(maybe im wrong, hehe)

i was watching this: How to retrieve a channel id from a channel name or url

and that was for a search for every channel, but it should be an easier solution just for your own user.(tell me if im wrong)

and is the right path to go?:

channels_list = youtube.channels().list(
    part="id",
    mine=True
  ).execute()
channelID = channel_list["items"]["id"]

im going to use the channelId to upload a specific video to the channel. I hope someone can help!

Jonas
  • 121,568
  • 97
  • 310
  • 388
Lisa
  • 45
  • 5
  • You should share your python code. Otherwise your question will be off-topic. Because you asked opinions of others. – limonik Sep 28 '16 at 09:26

1 Answers1

1

Judging from the docs, I'd say you're on the right track.

channels_list = youtube.channels().list(mine=True)

Should return a list of your owned channels, if you're sending an authenticated request.

You can then simply access the list directly by calling

channels_list['items']

Note that the ChannelItem is a dict within a list, so you'll have to access the channel item's index, and then the key

channels_list['items'][0]['items']['id'] 

If you'd like to get your channel ids in a single step, this might be what you're looking for:

chan_ids = [chan['items']['id'] for chan in youtube.channels().list(mine=True)['items']]

This section here might be of help to you, as well.

deepbrook
  • 2,523
  • 4
  • 28
  • 49
  • All this said, I don't have keys to do authenticated requests, but alas, I hope this was helpful anyway. – deepbrook Sep 28 '16 at 09:49