main
David 2022-03-31 02:14:56 +02:00
parent 2e4595e561
commit 226708d9c5
7 changed files with 18 additions and 18 deletions

2
.gitignore vendored
View File

@ -129,4 +129,4 @@ dmypy.json
.pyre/ .pyre/
.old/* .old/*
results/* responses/*

View File

@ -1,7 +1,4 @@
from email import charset import os
import mimetypes
from os import listdir
from urllib import response
import json import json
markdown = "" markdown = ""
@ -10,7 +7,10 @@ markdown += "|-------------|----------------|-----------------|----------|\n"
txt_output = "" txt_output = ""
files = listdir('results') if not os.path.exists('results'):
os.makedirs('results')
files = os.listdir('responses')
client_ids = [] client_ids = []
@ -26,7 +26,7 @@ for client_id in client_ids:
client_files.sort(reverse=True) # highest version first client_files.sort(reverse=True) # highest version first
for client_file in client_files: for client_file in client_files:
response_data_raw = open('results/' + client_file, 'r', encoding='utf-8').read() response_data_raw = open('responses/' + client_file, 'r', encoding='utf-8').read()
response_data = json.loads(response_data_raw) response_data = json.loads(response_data_raw)
client_name = None client_name = None
@ -73,10 +73,10 @@ for client_id in client_ids:
break break
f = open("working_clients.md", "w") f = open("results/working_clients.md", "w")
f.write(markdown) f.write(markdown)
f.close() f.close()
f = open("working_clients.txt", "w") f = open("results/working_clients.txt", "w")
f.write(txt_output) f.write(txt_output)
f.close() f.close()

View File

@ -1,8 +1,8 @@
import requests import requests
import os import os
client_versions = open("client_versions.txt", "r").readlines() client_versions = open("payloads/client_versions.txt", "r").readlines()
data_template = open("post_data.txt", "r").read() data_template = open("payloads/post_data.txt", "r").read()
headers = { headers = {
"Origin": "https://www.youtube.com", "Origin": "https://www.youtube.com",
@ -11,11 +11,11 @@ headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.52" "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.52"
} }
if not os.path.exists('results'): if not os.path.exists('responses'):
os.makedirs('resuls') os.makedirs('responses')
for client_name_id in range(0, 100): for client_name_id in range(1, 100):
for client_version in client_versions: for client_version in client_versions:
client_version = client_version.replace("\n", "").replace("\r", "") client_version = client_version.replace("\n", "").replace("\r", "")
if client_version == "": if client_version == "":
@ -23,17 +23,17 @@ for client_name_id in range(0, 100):
try_id = str(client_name_id) + "_" + client_version try_id = str(client_name_id) + "_" + client_version
print(try_id) print("Try ClientId: " + str(client_name_id) + " ClientVersion: " + str(client_version))
data = data_template.replace('%clientName%', str(client_name_id)).replace('%clientVersion%', client_version) data = data_template.replace('%clientName%', str(client_name_id)).replace('%clientVersion%', client_version)
try: try:
response = requests.post("https://www.youtube.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", data=data, headers=headers, timeout=5) response = requests.post("https://www.youtube.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", data=data, headers=headers, timeout=5)
print(response.status_code) print("Response Code: " + str(response.status_code))
if response.status_code == 200: if response.status_code == 200:
out = open("results/" + try_id + ".json", "w+", encoding="utf-8") out = open("responses/" + try_id + ".json", "w", encoding="utf-8")
out.write(response.text) out.write(response.text)
out.close() out.close()
except Exception as ex: except Exception as ex:

View File

@ -25,7 +25,7 @@
"consistencyTokenJars": [] "consistencyTokenJars": []
} }
}, },
"videoId": "d-u_7WV1Yl8", "videoId": "xcJtL7QggTI",
"playbackContext": { "playbackContext": {
"contentPlaybackContext": { "contentPlaybackContext": {
"currentUrl": "/watch?v=7t0SqerlBA0", "currentUrl": "/watch?v=7t0SqerlBA0",