Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links only work for 20 seconds #7

Open
AlexTeplov45 opened this issue May 30, 2023 · 1 comment
Open

Links only work for 20 seconds #7

AlexTeplov45 opened this issue May 30, 2023 · 1 comment

Comments

@AlexTeplov45
Copy link

AlexTeplov45 commented May 30, 2023

Please tell me what am I doing wrong? My links only work for 20 seconds, and they should work for 6 hours. Or shouldn't they?
Here is my script PHP

$ytid = 'XqgYj8atJqo';
$data = '{"contentCheckOk": true,"context": {"client": {"androidSdkVersion": 31,"clientName": "ANDROID","clientVersion": "17.36.4", "gl": "EN","hl": "en","osName": "Android","osVersion": "12", "platform": "MOBILE"}, "user": {"lockedSafetyMode": false },},"racyCheckOk": true,"videoId": "'.$ytid.'"}';
$heder = array('Host: www.youtube.com','Content-Type: application/json','User-Agent: com.google.android.youtube/17.36.4 (Linux; U; Android 12; GB) gzip','Origin: https://www.youtube.com','Referer: https://www.youtube.com/','Accept-Language: en-EN,en;q=0.8,en-US;q=0.5,en;q=0.3','X-Youtube-Client-Name: 3');
$ch = curl_init('https://www.youtube.com/youtubei/v1/player?key=AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w');
curl_setopt($ch, CURLOPT_HTTPHEADER, $heder);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, false);
$json = json_decode(curl_exec($ch), true);
curl_close($ch);
echo '<pre>'.print_r($json, true).'</pre>';
@TopGamerPro16
Copy link

Don't really have any useful insight, but yeah... YouTube does that. even from latest versions (2.20230607 on WEB), it only lasts for a good 5 seconds If not less.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants