Last active
March 15, 2024 03:32
-
-
Save mattwright324/cbff19bf4e5edbe25abe797bdc9de1bc to your computer and use it in GitHub Desktop.
yt-channel-resolver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.youtube.com/@90sFilmyGaane | |
https://www.youtube.com/@AASTIKSpiritualSecrets | |
https://www.youtube.com/@acousticsound | |
https://www.youtube.com/@acousticsound5879 | |
https://www.youtube.com/@actiondhamaka | |
https://www.youtube.com/@ActionHeroes | |
https://www.youtube.com/@ActionHits | |
https://www.youtube.com/@adityamovies | |
https://www.youtube.com/@AdkGujaratiProduction | |
https://www.youtube.com/@AkkNedlyamenya | |
https://www.youtube.com/@AlbSoundProduction | |
https://www.youtube.com/@ambeycassettes | |
https://www.youtube.com/@andpictureschannel | |
https://www.youtube.com/@andtvchannel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, json | |
def resolveId(channelUrl): | |
data_json = { | |
"context": { | |
"client": { | |
"clientName": "ANDROID", | |
"clientVersion": "19.09.37", | |
"hl": "en" | |
} | |
}, | |
"url": channelUrl | |
} | |
url = 'https://youtubei.googleapis.com/youtubei/v1/navigation/resolve_url?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' | |
data = json.dumps(data_json) | |
res = requests.post(url, data=data, headers={"Content-Type": "application/json"}) | |
return json.loads(res.text)["endpoint"]["browseEndpoint"]["browseId"] | |
file = open('channels.txt', 'r') | |
lines = file.readlines() | |
for line in lines: | |
url = line.strip() | |
try: | |
id = resolveId(url) | |
print(f'{url} --> {id}') | |
except: | |
print(f'{url} --x error resolving, 404?') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment