I was wondering if it was possible to gain your other channel-IDs, this code under is only getting one channelID (the one channel i clicked on during the authorization).
def gaining_channelID(youtube):
channels_list_response = youtube.channels().list(
part="id",
mine=True
).execute()
channelid= ""
for list in channels_list_response["items"]:
channelid= list["id"]
print(channelid)
return channelid
And can i upload videos to your other channels? Or do i HAVE to go through the the authorization again and choose a different channel i want to upload to?
right now it seems like that's the only way
ive been watching this and it said so, but was wondering if it had changed (since that was 2 years ago the question was asked)
YouTube API v3 get all channels associated with a logged in user
When you authenticate to the YouTube API you pick a channel. In my case I have 6 channels I think. If I authenticate to the first channel I will only have access to the first channels data.
Yes you need to authenticate for each of the channels. The access you get will be channel specific.
Related
I am working on a project that scrapes multiple YouTube channels display name, creation date, subscriber count, and view count. I need help creating this project because I can't seem to find anything about it. I have a YouTube API Key and I just can't seem to find anything about this.
It's a little hard to work with the sample code that the YouTube api shows. Use the curl section. Then send a request to the link that shows and use the information. for example send http request to this:
https://www.googleapis.com/youtube/v3/channels?part=statistics&id=[Channel ID]&key=[Your API]
and this address give you JSON file and you can get what you want!.
for example you can see subscribe count from channel list section in youtube api document. like this image.
you can find other things with this way!. good luck :)
also you can use this.
i'm making sample for you.
def subscribeCount(channel_id):
API = f"https://youtube.googleapis.com/youtube/v3/channels?part=statistics&id={channel_id}&key=[Enter Your Api Key]"
json_data = requests.get(API).json()
subscribeCount = json_data['items'][0]['statistics']['subscriberCount']
return subscribeCount
this sample need channel id(Like all other sections xD). and api key you Which you got from the google developer console.It then shows you the number of subscriptions to a channel. The rest of the sections work the same way.
Read the following article for more information.
How to Use the Python Requests Module With REST APIs
Is it possible to download images from a private telegram channel without admin rights using Python?
Basically what I want is the script to wait till a picture is sent in the private channel and if one got sent, I want it download the picture with the filename increasing(img1, img2...). Problem is I dont have admin rights in this channel and no Bot.
Sure. If you have access to this channel, you can use the "telethon" library to implement this function.
https://docs.telethon.dev/en/stable/
The first thing you have to do is get a channel
input_entity = await UserMethods.get_input_entity(client, peer="https://t.me/example")
entity = await client.get_entity(input_entity)
and then:
client.download_profile_photo(entity, file=photo_path)
I'm using google api client to call YouTube Data and YouTube Analytics APIs and get video stats. I'm authenticated as the owner of the channel I am querying.
I am interested in only getting the public videos uploaded in the channel. I first query the YouTube Data API to get the list of videos in the uploads playlist and once I have the list of video ids I call the youtube Analytics API for each video and get the stats I need.
The problem I'm having is that when I list all videos in the uploads playlist I get hundreds of thousands (!!!) of unlisted videos, which I don't need.
I cannot afford to download the entire list and then check status to keep only the public videos as the number is too big and I am reaching my daily quota. It would also be a very inefficient way to do it.
is there a way to list only videos with status public for a specific playlist?
This is the current method I use:
data = service.playlistItems().list(
part="snippet,status",
playlistId=playlistID,
maxResults="50",
).execute()
I couldn't find any in the youtube API documentation on how to achieve this.
Have you tried to use PlaylistItems endpoint by not being authenticated, but, instead, using only your API key parameter?
I'm assuming here -- though cannot check it myself -- that when not authenticated, the endpoint response will contain only videos that are public.
As per the doc, there are two ways an user can access any given API endpoint: using an API key or, otherwise, by way of an OAuth token.
Any user may request from Google developer's console an API key that he will pass to his endpoint of interest as the key parameter. In case of using the Python API Client Library, your code will have to be similar to this:
from googleapiclient.discovery import build
service = build(serviceName = 'youtube', version = 'v3', developerKey = DEVELOPER_KEY)
where DEVELOPER_KEY is the API key string obtained from Google. Please note that such an API key is an user's private information.
That's it: instead of OAuth, use an API key.
This doc text delineates clearly the API's concepts of authentication and authorization.
Basically, I was assuming that when using an API key instead of being authenticated via OAuth -- that is when build receives the parameter developerKey instead of credentials -- then the endpoint's response will include only public videos, even in the case when the respective API key (passed on as parameter developerKey) originates from your initial authentication account.
I'm trying to use the Vimeo API with Python, but I'm stuck trying to find video's using keywords.
What I have is this, after successfully registering with Vimeo:
import vimeo
client = vimeo.VimeoClient(
token='my_token',
key='my_key',
secret='my_secret_key'
)
about_me = client.get('/me',params={'fields':'uri,name'})
json.loads(about_me.text)
these return my user credentials. Now I want to use a similar approach to get videos using Query keywords, like on their page. But I cannot get it to work.
So, I want to have a JSON returned with movies based on keywords (like 'interstellar trailer' and not the URI or id of Vimeo).
But for some reason, I can't get the query keyword to work, and from the linked page above, I cannot figure it out how to implement it in my code.
27-02-19: UPDATE: I figured it out, and will update my solution here, soon.
The /me endpoint only returns the user object for the authenticated user.
To get and search for videos, use the /me/videos or /videos endpoint (depending on if you are searching for videos on your own account, or searching for videos from other users public on Vimeo).
I'm trying to store media_group_id value in a database for later reference to the photos.
But I'm unable to send it as a MediaGroup using
using types.send_media_group method.
What's the mechanism of sending a media group of photos? I tried:
file=types.InputMediaPhoto('12338991854684052')
bot.send_media_group(message.from_user.id,[file,])
P.S: I'm using pyTelegramBotAPI library
Well, Because mediaGroupId is not equaled to mediaPhotoVideos.
You would like to record down multi messages with photos from the same media group ID and resend it with sendMediaGroup.
Just a note. You need to restrict photos from 2 to 9 for each message.