Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Is there any way to get channel videos by channel id? #56

Closed
Wiper-R opened this issue Mar 11, 2021 · 10 comments · Fixed by #87
Closed

Is there any way to get channel videos by channel id? #56

Wiper-R opened this issue Mar 11, 2021 · 10 comments · Fixed by #87
Assignees
Labels
enhancement New feature or request

Comments

@Wiper-R
Copy link

Wiper-R commented Mar 11, 2021

No description provided.

@alexmercerind alexmercerind added the enhancement New feature or request label Mar 11, 2021
@alexmercerind
Copy link
Owner

Hi there @Wiper-R !

Presently there is not.

@Wiper-R
Copy link
Author

Wiper-R commented Mar 11, 2021

Thanks!

@ghost
Copy link

ghost commented Mar 26, 2021

Yes there is.
https://www.youtube.com/feeds/videos.xml?channel_id={ID}

for example: https://www.youtube.com/feeds/videos.xml?channel_id=UCoRR6OLuIZ2-5VxtnQIaN2w returns NFrealmusic videos in XML format, you can parse them

@alexmercerind
Copy link
Owner

alexmercerind commented Mar 26, 2021

@grubeli, I'm aware about it (even in JSON not just XML), but main problem I'm having is time. I have other projects which have more importance right now.

Thanks for letting us aware though.

@alexmercerind
Copy link
Owner

I'll see what I can do soon. I'll add a new Channel class like Video & Playlist.

@ghost
Copy link

ghost commented Mar 26, 2021

I mean outside of this project, if @Wiper-R is working on some project, they can use direct way for now

@ghost
Copy link

ghost commented Mar 26, 2021

Is there a way to get JSON directly instead of XML?

@alexmercerind alexmercerind self-assigned this Jun 6, 2021
@kaisuto
Copy link

kaisuto commented Jun 18, 2021

Hi
It can search the videos in channel with API
/youtubei/v1/browse?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8
with browseID as channelID and query as keyword
Set params as EgZzZWFyY2g%3D
Just like this
image

Also get the videos in channel by set params as EgZ2aWRlb3M%3D, like this
image

The response will be a big json which contains videos information.

@mytja
Copy link
Collaborator

mytja commented Jun 19, 2021

@kaisuto
Thank you so much for your time.
I can confirm it working using this sample:

import requests
import json

requestPayload = {
    "context": {
        "client": {
            "clientName": "WEB",
            "clientVersion": "2.20210224.06.00",
            "newVisitorCookie": True,
        },
        "user": {
            "lockedSafetyMode": False,
        }
    },
    "query": "top 10",
    "params": "EgZzZWFyY2g%3D",
    "browseId": "UC0raGe2owvmadTf85xL_ytw"
}
userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'

data = json.dumps(requestPayload).encode("utf_8")

headers = {
    "User-Agent": userAgent
}

r = requests.post(
    "https://www.youtube.com/youtubei/v1/browse?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",
    headers=headers,
    data=data
)
#print(r)
#print(r.text)
print(r.json())

You can make a PR if you want, else I will take care for it.
Again thanks for your time and for your solution

@kaisuto
Copy link

kaisuto commented Jun 19, 2021

Hi @mytja ,
I want to do this for a while, but I'm busy at work.
If you can take care for it, that will be great!!
Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants