Athlon1600 / youtube-downloader

:tv: PHP based alternative to youtube-dl and yt-dlp. Active and frequently updated! :star:
https://unblockvideos.com/
MIT License
813 stars 317 forks source link

video show “The following content is not available on this app. Watch this content on the latest version of YouTube” #189

Open LaJun opened 7 months ago

LaJun commented 7 months ago

the link video shows that “The following content is not available on this app. Watch this content on the latest version of YouTube” image

how to fixed it。thanks

kclauhk commented 7 months ago

update client params to "CgIIAQ==" can solve this

https://github.com/kclauhk/youtube-downloader/blob/41eaed479142d163a9ad9142b24269a7e396a82e/src/YouTubeDownloader.php#L91

yt-dlp/yt-dlp#e7b17fc

LaJun commented 7 months ago

update client params to "CgIIAQ==" can solve this

https://github.com/kclauhk/youtube-downloader/blob/41eaed479142d163a9ad9142b24269a7e396a82e/src/YouTubeDownloader.php#L91

yt-dlp/yt-dlp#e7b17fc

it works, thanks for your help

LaJun commented 6 months ago

update client params to "CgIIAQ==" can solve this

https://github.com/kclauhk/youtube-downloader/blob/41eaed479142d163a9ad9142b24269a7e396a82e/src/YouTubeDownloader.php#L91

yt-dlp/yt-dlp#e7b17fc

it doesn't work again like this

liaolingfen4 commented 6 months ago

same issue i meet, how to solve it,who can help me?

liaolingfen4 commented 6 months ago

update client params to "CgIIAQ==" can solve this

https://github.com/kclauhk/youtube-downloader/blob/41eaed479142d163a9ad9142b24269a7e396a82e/src/YouTubeDownloader.php#L91

yt-dlp/yt-dlp#e7b17fc

hi, friend, do you have any idea?

kclauhk commented 6 months ago

remove this params: https://github.com/kclauhk/youtube-downloader/blob/b67ee3cabf90689a469645ae670e13f614f34d74/src/YouTubeDownloader.php#L91

and changing this user-agent https://github.com/Athlon1600/php-curl-client/blob/eff146de74ee3a4a9a7de1511e300b65b5c8efd2/src/BrowserClient.php#L12 to 'User-Agent' => 'com.google.android.youtube/19.09.37 (Linux; U; Android 11) gzip'

seems to help

Edit: the url will expire in short period of time, not working

LaJun commented 6 months ago

remove this params: https://github.com/kclauhk/youtube-downloader/blob/b67ee3cabf90689a469645ae670e13f614f34d74/src/YouTubeDownloader.php#L91

and changing this user-agent https://github.com/Athlon1600/php-curl-client/blob/eff146de74ee3a4a9a7de1511e300b65b5c8efd2/src/BrowserClient.php#L12 to 'User-Agent' => 'com.google.android.youtube/19.09.37 (Linux; U; Android 11) gzip'

seems to help

Edit: the url will expire in short period of time, not working

yeah, it seems not good, have others idea ?

liaolingfen4 commented 6 months ago

aha, change it and test ,still failed, anyone who has idea..thank you so much

kclauhk commented 6 months ago

The following should work but it will not provide format 22.

change https://github.com/Athlon1600/youtube-downloader/blob/215b2b74f5eea5a1e8c1b9ada28c72ca35e5ab4f/src/YouTubeDownloader.php#L81-L92 to

                "client" => [
                    "androidSdkVersion" => 30,
                    "clientName" => "WEB",
                    "clientVersion" => "2.20240425.01.00",
                    "hl" => "en",
                    "timeZone" => "UTC",
                    "userAgent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
                    "utcOffsetMinutes" => 0
                ]
            ],
            "videoId" => $video_id,

and changing this user-agent https://github.com/Athlon1600/php-curl-client/blob/eff146de74ee3a4a9a7de1511e300b65b5c8efd2/src/BrowserClient.php#L12 to Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

liaolingfen4 commented 6 months ago

The following should work but it will not provide format 22.以下内容应该有效,但不会提供格式 22。

change 改变

https://github.com/Athlon1600/youtube-downloader/blob/215b2b74f5eea5a1e8c1b9ada28c72ca35e5ab4f/src/YouTubeDownloader.php#L81-L92

to 自

            "client" => [
                "androidSdkVersion" => 30,
                "clientName" => "WEB",
                "clientVersion" => "2.20240425.01.00",
                "hl" => "en",
                "timeZone" => "UTC",
                "userAgent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
                "utcOffsetMinutes" => 0
            ]
        ],
        "videoId" => $video_id,

and changing this user-agent https://github.com/Athlon1600/php-curl-client/blob/eff146de74ee3a4a9a7de1511e300b65b5c8efd2/src/BrowserClient.php#L12并更改此用户代理 https://github.com/Athlon1600/php-curl-client/blob/eff146de74ee3a4a9a7de1511e300b65b5c8efd2/src/BrowserClient.php#L12 to 自 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36Mozilla/5.0 (Windows NT 10.0;Win64的;x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

OK, let me try it

liaolingfen4 commented 6 months ago

log.json i got the json(you can download it) , but can't get the real video play url, how to parse . for example : "s=M%3DM%3DwZ5YAUvlwE-ATCQAl83jUp%3DuK0wPvtUyPgmFjrwaACBDQICknvAs34WBTQSNGVVCEGUNyqwTALxWD5RU30dPE51w1JgIQRwsSdAfJQQ&sp=sig&url=https://rr3---sn-f5uxxo23-pnce.googlevideo.com/videoplayback%3Fexpire%3D1714153257%26ei%3DyZIrZomOFeCw1d8P7Ly5mAg%26ip%3D103.172.26.58%26id%3Do-AL9BxYPuSpqqSk8ZZUQFrOD1SVK9q7InTaIRu5qLEwnQ%26itag%3D18%26source%3Dyoutube%26requiressl%3Dyes%26xpc%3DEgVo2aDSNQ%253D%253D%26mh%3DLp%26mm%3D31%252C29%26mn%3Dsn-f5uxxo23-pnce%252Csn-hgn7ynek%26ms%3Dau%252Crdu%26mv%3Dm%26mvi%3D3%26pl%3D24%26gcr%3Dpk%26initcwndbps%3D268750%26bui%3DAWRWj2TrpGiH0J5dZjLGqu1kH956m1mpT-jylZK2CG0nuImiPA4sYcHsk6-FxMPDr4T4H8nXpx00EUHQ%26spc%3DUWF9f6-A8Vz5wyczg5bzldxygBB722VDXVuQBdT59AjwAnQndcIWunUlFYaZ%26vprv%3D1%26svpuc%3D1%26mime%3Dvideo%252Fmp4%26ns%3DUp5c5akpTPmpNR7Kkb8-pr4Q%26rqh%3D1%26gir%3Dyes%26clen%3D11637024%26ratebypass%3Dyes%26dur%3D218.314%26lmt%3D1713913144365740%26mt%3D1714130946%26fvip%3D4%26c%3DWEB%26sefc%3D1%26txp%3D4538434%26n%3DvEpD0159Ienyz18%26sparams%3Dexpire%252Cei%252Cip%252Cid%252Citag%252Csource%252Crequiressl%252Cxpc%252Cgcr%252Cbui%252Cspc%252Cvprv%252Csvpuc%252Cmime%252Cns%252Crqh%252Cgir%252Cclen%252Cratebypass%252Cdur%252Clmt%26lsparams%3Dmh%252Cmm%252Cmn%252Cms%252Cmv%252Cmvi%252Cpl%252Cinitcwndbps%26lsig%3DAHWaYeowRQIhAO41G0rCdi533Uo1tFl8Ha9pY7YT3P9be38MRLW3G7l2AiARny8ud4TeJTj4c_gGcBcmhu8Wnr-ldavfKof8y0FYJA%253D%253D" @kclauhk

liaolingfen4 commented 6 months ago

any update?

nick-mad commented 5 months ago

I replaced this to

$response = $this->client->post("https://www.youtube.com/youtubei/v1/player?key=" . $configData->getApiKey(), json_encode([
            'context' => [
                "client" => [
                    "clientName" => "TVHTML5_SIMPLY_EMBEDDED_PLAYER",
                    "clientVersion" => "2.0",
                    "hl" => "en",
                    'clientScreen' => 'EMBED',
                ],
                'thirdParty' => ['embedUrl' => 'https://google.com'],
            ],
            "videoId" => $video_id,
            "playbackContext" => [
                "contentPlaybackContext" => [
                    "html5Preference" => "HTML5_PREF_WANTS"
                ]
            ],
            "racyCheckOk" => true,
            "contentCheckOk" => true,
        ], JSON_THROW_ON_ERROR), [
            'Content-Type' => 'application/json',
            'X-YouTube-Client-Name' => '85',
            'X-YouTube-Client-Version' => '2.0',
            'Origin' => 'https://www.youtube.com'
        ]);
    and it worked
liaolingfen4 commented 5 months ago

I replaced this to

$response = $this->client->post("https://www.youtube.com/youtubei/v1/player?key=" . $configData->getApiKey(), json_encode([
            'context' => [
                "client" => [
                    "clientName" => "TVHTML5_SIMPLY_EMBEDDED_PLAYER",
                    "clientVersion" => "2.0",
                    "hl" => "en",
                    'clientScreen' => 'EMBED',
                ],
                'thirdParty' => ['embedUrl' => 'https://google.com'],
            ],
            "videoId" => $video_id,
            "playbackContext" => [
                "contentPlaybackContext" => [
                    "html5Preference" => "HTML5_PREF_WANTS"
                ]
            ],
            "racyCheckOk" => true,
            "contentCheckOk" => true,
        ], JSON_THROW_ON_ERROR), [
            'Content-Type' => 'application/json',
            'X-YouTube-Client-Name' => '85',
            'X-YouTube-Client-Version' => '2.0',
            'Origin' => 'https://www.youtube.com'
        ]);
    and it worked

the playing url this way get don't need js decrypt?

nick-mad commented 5 months ago

the playing url this way get don't need js decrypt?

just copy url and it playing in browser

rustynail1984 commented 5 months ago

instead Client ANDROID you can use

"clientName": "ANDROID_TESTSUITE", "clientVersion": "1.9"

dont need decrypt