Benjamin-Loison / YouTube-operational-API

YouTube operational API works when YouTube Data API v3 fails.
397 stars 50 forks source link

`music` `part` returns `available: false` for every video #296

Closed Eradeon closed 3 months ago

Eradeon commented 3 months ago

Today I have noticed that https://yt.lemnoslife.com/videos?part=music&id=VIDEO_ID returns false for availability on YouTube Music for every video ID, even when that video is available on YouTube Music. Seems to be reproducible with any video ID from YouTube Music.

Benjamin-Loison commented 3 months ago

It seems instance related, the official instance is having this issue but not my own, see blob/d61488fbe0becf6d2a6ebc97761e5b87a8facd3f/README.md#install-your-own-instance-of-the-api. I am investigating the issue going on with the official instance.

VIDEO_IDS=('UPrkC1LdlLY' 'a9cyG_yfh1k')
YOUTUBE_OPERATIONAL_API_INSTANCE_URL='http://localhost/YouTube-operational-API'
for videoId in "${VIDEO_IDS[@]}"
do
    echo $videoId
    curl -s "$YOUTUBE_OPERATIONAL_API_INSTANCE_URL/videos?part=music&id=$videoId" | jq '.items[0].music.available' -
done
UPrkC1LdlLY
false
a9cyG_yfh1k
true
VIDEO_IDS=('UPrkC1LdlLY' 'a9cyG_yfh1k')
YOUTUBE_OPERATIONAL_API_INSTANCE_URL='https://yt.lemnoslife.com'
for videoId in "${VIDEO_IDS[@]}"
do
    echo $videoId
    curl -s "$YOUTUBE_OPERATIONAL_API_INSTANCE_URL/videos?part=music&id=$videoId" | jq '.items[0].music.available' -
done
UPrkC1LdlLY
false
a9cyG_yfh1k
false
Benjamin-Loison commented 3 months ago

Well I updated the official instance and rebooted and it seems to have solved the issue, let me know if it continues happening.

Details: ```bash sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && rustup update ``` ``` Hit:1 https://download.docker.com/linux/ubuntu jammy InRelease Hit:2 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy InRelease Get:3 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates InRelease [128 kB] Get:4 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [129 kB] Hit:5 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-backports InRelease Hit:6 https://ppa.launchpadcontent.net/ondrej/apache2/ubuntu jammy InRelease Hit:7 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease Get:8 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 Packages [1688 kB] Get:9 https://esm.ubuntu.com/apps/ubuntu jammy-apps-security InRelease [7553 B] Get:10 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 Packages [1058 kB] Get:11 https://esm.ubuntu.com/apps/ubuntu jammy-apps-updates InRelease [7456 B] Get:12 https://esm.ubuntu.com/infra/ubuntu jammy-infra-security InRelease [7450 B] Get:13 https://esm.ubuntu.com/infra/ubuntu jammy-infra-updates InRelease [7449 B] Fetched 3033 kB in 2s (1795 kB/s) Reading package lists... Done Building dependency tree... Done Reading state information... Done 15 packages can be upgraded. Run 'apt list --upgradable' to see them. Reading package lists... Done Building dependency tree... Done Reading state information... Done Calculating upgrade... Done The following NEW packages will be installed: linux-headers-6.5.0-1027-oracle linux-image-6.5.0-1027-oracle linux-modules-6.5.0-1027-oracle linux-oracle-6.5-headers-6.5.0-1027 The following packages have been kept back: apport python3-apport python3-problem-report The following packages will be upgraded: libapache2-mod-php8.0 linux-headers-oracle linux-image-oracle linux-libc-dev linux-oracle php8.0 php8.0-cli php8.0-common php8.0-mbstring php8.0-mysql php8.0-opcache php8.0-readline 12 upgraded, 4 newly installed, 0 to remove and 3 not upgraded. 1 standard LTS security update Need to get 60.3 MB/61.6 MB of archives. After this operation, 240 MB of additional disk space will be used. Get:1 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 linux-oracle-6.5-headers-6.5.0-1027 all 6.5.0-1027.27~22.04.1 [13.3 MB] Get:2 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main arm64 php8.0-readline arm64 1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1 [12.7 kB] Get:3 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main arm64 php8.0-opcache arm64 1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1 [222 kB] Get:4 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main arm64 php8.0-mysql arm64 1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1 [133 kB] Get:5 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main arm64 php8.0-mbstring arm64 1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1 [475 kB] Get:6 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main arm64 libapache2-mod-php8.0 arm64 1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1 [1511 kB] Get:7 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main arm64 php8.0-cli arm64 1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1 [1582 kB] Get:8 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main arm64 php8.0-common arm64 1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1 [707 kB] Get:9 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main arm64 php8.0 all 1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1 [37.2 kB] Get:10 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 linux-headers-6.5.0-1027-oracle arm64 6.5.0-1027.27~22.04.1 [2940 kB] Get:11 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 linux-modules-6.5.0-1027-oracle arm64 6.5.0-1027.27~22.04.1 [22.3 MB] Get:12 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 linux-image-6.5.0-1027-oracle arm64 6.5.0-1027.27~22.04.1 [17.0 MB] Get:13 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 linux-oracle arm64 6.5.0.1027.27~22.04.1 [1714 B] Get:14 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 linux-image-oracle arm64 6.5.0.1027.27~22.04.1 [2464 B] Get:15 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 linux-headers-oracle arm64 6.5.0.1027.27~22.04.1 [2394 B] Fetched 60.3 MB in 3s (20.6 MB/s) debconf: delaying package configuration, since apt-utils is not installed (Reading database ... 255991 files and directories currently installed.) Preparing to unpack .../00-php8.0-readline_1%3a8.0.30-8+ubuntu22.04.1+deb.sury.org+1_arm64.deb ... Unpacking php8.0-readline (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) over (1:8.0.30-7+ubuntu22.04.1+deb.sury.org+1) ... Preparing to unpack .../01-php8.0-opcache_1%3a8.0.30-8+ubuntu22.04.1+deb.sury.org+1_arm64.deb ... Unpacking php8.0-opcache (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) over (1:8.0.30-7+ubuntu22.04.1+deb.sury.org+1) ... Preparing to unpack .../02-php8.0-mysql_1%3a8.0.30-8+ubuntu22.04.1+deb.sury.org+1_arm64.deb ... Unpacking php8.0-mysql (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) over (1:8.0.30-7+ubuntu22.04.1+deb.sury.org+1) ... Preparing to unpack .../03-php8.0-mbstring_1%3a8.0.30-8+ubuntu22.04.1+deb.sury.org+1_arm64.deb ... Unpacking php8.0-mbstring (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) over (1:8.0.30-7+ubuntu22.04.1+deb.sury.org+1) ... Preparing to unpack .../04-libapache2-mod-php8.0_1%3a8.0.30-8+ubuntu22.04.1+deb.sury.org+1_arm64.deb ... Unpacking libapache2-mod-php8.0 (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) over (1:8.0.30-7+ubuntu22.04.1+deb.sury.org+1) ... Preparing to unpack .../05-php8.0-cli_1%3a8.0.30-8+ubuntu22.04.1+deb.sury.org+1_arm64.deb ... Unpacking php8.0-cli (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) over (1:8.0.30-7+ubuntu22.04.1+deb.sury.org+1) ... Preparing to unpack .../06-php8.0-common_1%3a8.0.30-8+ubuntu22.04.1+deb.sury.org+1_arm64.deb ... Unpacking php8.0-common (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) over (1:8.0.30-7+ubuntu22.04.1+deb.sury.org+1) ... Selecting previously unselected package linux-oracle-6.5-headers-6.5.0-1027. Preparing to unpack .../07-linux-oracle-6.5-headers-6.5.0-1027_6.5.0-1027.27~22.04.1_all.deb ... Unpacking linux-oracle-6.5-headers-6.5.0-1027 (6.5.0-1027.27~22.04.1) ... Selecting previously unselected package linux-headers-6.5.0-1027-oracle. Preparing to unpack .../08-linux-headers-6.5.0-1027-oracle_6.5.0-1027.27~22.04.1_arm64.deb ... Unpacking linux-headers-6.5.0-1027-oracle (6.5.0-1027.27~22.04.1) ... Selecting previously unselected package linux-modules-6.5.0-1027-oracle. Preparing to unpack .../09-linux-modules-6.5.0-1027-oracle_6.5.0-1027.27~22.04.1_arm64.deb ... Unpacking linux-modules-6.5.0-1027-oracle (6.5.0-1027.27~22.04.1) ... Selecting previously unselected package linux-image-6.5.0-1027-oracle. Preparing to unpack .../10-linux-image-6.5.0-1027-oracle_6.5.0-1027.27~22.04.1_arm64.deb ... Unpacking linux-image-6.5.0-1027-oracle (6.5.0-1027.27~22.04.1) ... Preparing to unpack .../11-linux-oracle_6.5.0.1027.27~22.04.1_arm64.deb ... Unpacking linux-oracle (6.5.0.1027.27~22.04.1) over (6.5.0.1026.26~22.04.1) ... Preparing to unpack .../12-linux-image-oracle_6.5.0.1027.27~22.04.1_arm64.deb ... Unpacking linux-image-oracle (6.5.0.1027.27~22.04.1) over (6.5.0.1026.26~22.04.1) ... Preparing to unpack .../13-linux-headers-oracle_6.5.0.1027.27~22.04.1_arm64.deb ... Unpacking linux-headers-oracle (6.5.0.1027.27~22.04.1) over (6.5.0.1026.26~22.04.1) ... Preparing to unpack .../14-linux-libc-dev_5.15.0-118.128_arm64.deb ... Unpacking linux-libc-dev:arm64 (5.15.0-118.128) over (5.15.0-117.127) ... Preparing to unpack .../15-php8.0_1%3a8.0.30-8+ubuntu22.04.1+deb.sury.org+1_all.deb ... Unpacking php8.0 (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) over (1:8.0.30-7+ubuntu22.04.1+deb.sury.org+1) ... Setting up linux-oracle-6.5-headers-6.5.0-1027 (6.5.0-1027.27~22.04.1) ... Setting up linux-libc-dev:arm64 (5.15.0-118.128) ... Setting up linux-headers-6.5.0-1027-oracle (6.5.0-1027.27~22.04.1) ... Setting up linux-modules-6.5.0-1027-oracle (6.5.0-1027.27~22.04.1) ... Setting up php8.0-common (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) ... Setting up linux-image-6.5.0-1027-oracle (6.5.0-1027.27~22.04.1) ... I: /boot/vmlinuz.old is now a symlink to vmlinuz-6.5.0-1026-oracle I: /boot/initrd.img.old is now a symlink to initrd.img-6.5.0-1026-oracle I: /boot/vmlinuz is now a symlink to vmlinuz-6.5.0-1027-oracle I: /boot/initrd.img is now a symlink to initrd.img-6.5.0-1027-oracle Setting up php8.0-mysql (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) ... Setting up php8.0-mbstring (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) ... Setting up linux-image-oracle (6.5.0.1027.27~22.04.1) ... Setting up linux-headers-oracle (6.5.0.1027.27~22.04.1) ... Setting up linux-oracle (6.5.0.1027.27~22.04.1) ... Setting up php8.0-readline (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) ... Setting up php8.0-opcache (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) ... Setting up php8.0-cli (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) ... Setting up libapache2-mod-php8.0 (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) ... libapache2-mod-php8.0: not switching MPM - already enabled Setting up php8.0 (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) ... Processing triggers for man-db (2.10.2-1) ... Processing triggers for linux-image-6.5.0-1027-oracle (6.5.0-1027.27~22.04.1) ... /etc/kernel/postinst.d/initramfs-tools: update-initramfs: Generating /boot/initrd.img-6.5.0-1027-oracle /etc/kernel/postinst.d/zz-update-grub: Sourcing file `/etc/default/grub' Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg' Sourcing file `/etc/default/grub.d/init-select.cfg' Generating grub configuration file ... Found linux image: /boot/vmlinuz-6.5.0-1027-oracle Found initrd image: /boot/initrd.img-6.5.0-1027-oracle Found linux image: /boot/vmlinuz-6.5.0-1026-oracle Found initrd image: /boot/initrd.img-6.5.0-1026-oracle Found linux image: /boot/vmlinuz-6.5.0-1025-oracle Found initrd image: /boot/initrd.img-6.5.0-1025-oracle Found linux image: /boot/vmlinuz-5.15.0-1038-oracle Found initrd image: /boot/initrd.img-5.15.0-1038-oracle Warning: os-prober will not be executed to detect other bootable partitions. Systems on them will not be added to the GRUB boot configuration. Check GRUB_DISABLE_OS_PROBER documentation entry. Adding boot menu entry for UEFI Firmware Settings ... done Processing triggers for php8.0-cli (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) ... Processing triggers for libapache2-mod-php8.0 (1:8.0.30-8+ubuntu22.04.1+deb.sury.org+1) ... Scanning processes... Scanning candidates... Scanning linux images... Restarting services... /etc/needrestart/restart.d/systemd-manager systemctl restart apache2.service boinc-client.service cups-browsed.service cups.service iscsid.service packagekit.service postfix@-.service rpcbind.service ssh.service systemd-journald.service systemd-networkd.service systemd-resolved.service systemd-timesyncd.service systemd-udevd.service tor@default.service udisks2.service upower.service xrdp.service xrdp-sesman.service Service restarts being deferred: systemctl restart NetworkManager.service systemctl restart gdm.service systemctl restart networkd-dispatcher.service systemctl restart systemd-logind.service systemctl restart unattended-upgrades.service systemctl restart user@1001.service systemctl restart user@120.service No containers need to be restarted. No user sessions are running outdated binaries. No VM guests are running outdated hypervisor (qemu) binaries on this host. Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages will be REMOVED: linux-headers-6.5.0-1025-oracle linux-image-6.5.0-1025-oracle linux-modules-6.5.0-1025-oracle linux-oracle-6.5-headers-6.5.0-1025 0 upgraded, 0 newly installed, 4 to remove and 3 not upgraded. After this operation, 240 MB disk space will be freed. (Reading database ... 289100 files and directories currently installed.) Removing linux-headers-6.5.0-1025-oracle (6.5.0-1025.25~22.04.1) ... Removing linux-image-6.5.0-1025-oracle (6.5.0-1025.25~22.04.1) ... /etc/kernel/postrm.d/initramfs-tools: update-initramfs: Deleting /boot/initrd.img-6.5.0-1025-oracle /etc/kernel/postrm.d/zz-update-grub: Sourcing file `/etc/default/grub' Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg' Sourcing file `/etc/default/grub.d/init-select.cfg' Generating grub configuration file ... Found linux image: /boot/vmlinuz-6.5.0-1027-oracle Found initrd image: /boot/initrd.img-6.5.0-1027-oracle Found linux image: /boot/vmlinuz-6.5.0-1026-oracle Found initrd image: /boot/initrd.img-6.5.0-1026-oracle Found linux image: /boot/vmlinuz-5.15.0-1038-oracle Found initrd image: /boot/initrd.img-5.15.0-1038-oracle Warning: os-prober will not be executed to detect other bootable partitions. Systems on them will not be added to the GRUB boot configuration. Check GRUB_DISABLE_OS_PROBER documentation entry. Adding boot menu entry for UEFI Firmware Settings ... done Removing linux-modules-6.5.0-1025-oracle (6.5.0-1025.25~22.04.1) ... Removing linux-oracle-6.5-headers-6.5.0-1025 (6.5.0-1025.25~22.04.1) ... info: syncing channel updates for 'stable-aarch64-unknown-linux-gnu' info: latest update on 2024-08-08, rust version 1.80.1 (3f5fd8dd4 2024-08-06) info: downloading component 'cargo' info: downloading component 'clippy' info: downloading component 'rust-docs' info: downloading component 'rust-std' info: downloading component 'rustc' info: downloading component 'rustfmt' info: removing previous version of component 'cargo' info: removing previous version of component 'clippy' info: removing previous version of component 'rust-docs' info: removing previous version of component 'rust-std' info: removing previous version of component 'rustc' info: removing previous version of component 'rustfmt' info: installing component 'cargo' info: installing component 'clippy' info: installing component 'rust-docs' 15.8 MiB / 15.8 MiB (100 %) 8.3 MiB/s in 1s ETA: 0s info: installing component 'rust-std' 30.0 MiB / 30.0 MiB (100 %) 14.6 MiB/s in 2s ETA: 0s info: installing component 'rustc' 77.5 MiB / 77.5 MiB (100 %) 15.0 MiB/s in 5s ETA: 0s info: installing component 'rustfmt' info: checking for self-update stable-aarch64-unknown-linux-gnu updated - rustc 1.80.1 (3f5fd8dd4 2024-08-06) (from rustc 1.79.0 (129f3b996 2024-06-10)) info: cleaning up downloads & tmp directories ``` ```bash cat /var/run/reboot-required ``` ``` *** System restart required *** ``` ```bash sudo reboot ```
Benjamin-Loison commented 3 months ago

My bad I checked on the wrong instance.

Benjamin-Loison commented 3 months ago

No line seems written to /var/log/apache2/error.log when this issue happens.

Locally:

curl -s https://music.youtube.com/youtubei/v1/player -H 'Content-Type: application/json' --data-raw '{"videoId": "UPrkC1LdlLY", "context": {"client": {"clientName": "WEB_REMIX", "clientVersion": "1.20240805.00.00"}}}' | grep 'This video is not available'
    "reason": "This video is not available",
              "text": "This video is not available"

On the official instance:

curl -s https://music.youtube.com/youtubei/v1/player -H 'Content-Type: application/json' --data-raw '{"videoId": "UPrkC1LdlLY", "context": {"client": {"clientName": "WEB_REMIX", "clientVersion": "1.20240805.00.00"}}}'
Output: ```json { "responseContext": { "visitorData": "CENSORED", "serviceTrackingParams": [ { "service": "GFEEDBACK", "params": [ { "key": "is_alc_surface", "value": "false" }, { "key": "is_viewed_live", "value": "False" }, { "key": "ipcc", "value": "0" }, { "key": "logged_in", "value": "0" }, { "key": "e", "value": "CENSORED" } ] }, { "service": "CSI", "params": [ { "key": "c", "value": "WEB_REMIX" }, { "key": "cver", "value": "1.20240805.00.00" }, { "key": "yt_li", "value": "0" }, { "key": "GetPlayer_rid", "value": "0xCENSORED" } ] }, { "service": "ECATCHER", "params": [ { "key": "client.version", "value": "1.20000101" }, { "key": "client.name", "value": "WEB_REMIX" } ] } ], "maxAgeSeconds": 0 }, "playabilityStatus": { "status": "LOGIN_REQUIRED", "reason": "Sign in to confirm you’re not a bot", "errorScreen": { "playerErrorMessageRenderer": { "subreason": { "runs": [ { "text": "This helps protect our community. " }, { "text": "Learn more", "navigationEndpoint": { "clickTrackingParams": "CENSORED", "urlEndpoint": { "url": "https://support.google.com/youtube/answer/3037019#zippy=%2Ccheck-that-youre-signed-into-youtube" } } } ] }, "reason": { "runs": [ { "text": "Sign in to confirm you’re not a bot" } ] }, "proceedButton": { "buttonRenderer": { "style": "STYLE_PRIMARY", "isDisabled": false, "text": { "simpleText": "Sign in" }, "navigationEndpoint": { "clickTrackingParams": "CENSORED", "signInEndpoint": { "nextEndpoint": { "clickTrackingParams": "CENSORED", "urlEndpoint": { "url": "" } } } }, "trackingParams": "CENSORED" } }, "thumbnail": { "thumbnails": [ { "url": "//s.ytimg.com/yts/img/meh7-vflGevej7.png", "width": 140, "height": 100 } ] }, "icon": { "iconType": "ERROR_OUTLINE" } } }, "contextParams": "CENSORED" }, "trackingParams": "CENSORED", "adBreakHeartbeatParams": "CENSORED" } ```

So it seems clear that on your own instance you will not have this issue.

Benjamin-Loison commented 3 months ago

Personal notes:

When being connected:

Content not available. Playing something else.

When not being connected:

This video is not available

minimizeCURL curl.sh 'Content not available. Playing something else.'
curl https://music.youtube.com/watch -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0' -H 'Cookie: __Secure-3PSID=CENSORED; PREF=repeat=NONE&autoplay=true&hl=en'

On the official instance:

curl https://music.youtube.com/youtubei/v1/player -H 'Content-Type: application/json' --data-raw '{"context": {"client": {"clientName": "WEB_REMIX", "clientVersion": "1.20240805.00.00"}}}'
Output: ```json { "responseContext": { "visitorData": "CENSORED", "serviceTrackingParams": [ { "service": "GFEEDBACK", "params": [ { "key": "is_viewed_live", "value": "False" }, { "key": "logged_in", "value": "0" }, { "key": "e", "value": "CENSORED" } ] }, { "service": "CSI", "params": [ { "key": "c", "value": "WEB_REMIX" }, { "key": "cver", "value": "1.20240805.00.00" }, { "key": "yt_li", "value": "0" }, { "key": "GetPlayer_rid", "value": "0xCENSORED" } ] }, { "service": "ECATCHER", "params": [ { "key": "client.version", "value": "1.20000101" }, { "key": "client.name", "value": "WEB_REMIX" } ] } ], "maxAgeSeconds": 0 }, "playabilityStatus": { "status": "ERROR", "reason": "This video is unavailable", "errorScreen": { "playerErrorMessageRenderer": { "reason": { "runs": [ { "text": "This video is unavailable" } ] }, "thumbnail": { "thumbnails": [ { "url": "//s.ytimg.com/yts/img/meh7-vflGevej7.png", "width": 140, "height": 100 } ] }, "icon": { "iconType": "ERROR_OUTLINE" } } }, "contextParams": "CENSORED" }, "trackingParams": "CENSORED" } ```

So removing "videoId": "UPrkC1LdlLY", in --data-raw solves the issue... Lol but then YouTube does not know the video so definitely need to authenticate.

curl https://music.youtube.com/youtubei/v1/player -H 'Content-Type: application/json' -H 'Authorization: SAPISIDHASH CENSORED' -H 'Origin: https://music.youtube.com' -H 'Cookie: __Secure-3PSID=CENSORED; __Secure-3PAPISID=CENSORED' --data-raw '{"videoId": "1AiZ3n6HKEI", "context": {"client": {"clientName": "WEB_REMIX", "clientVersion": "1.20240805.00.00"}}}'

https://music.youtube.com/watch?v=UPrkC1LdlLY

https://music.youtube.com/watch?v=1AiZ3n6HKEI

Benjamin-Loison commented 3 months ago

For debugging:

if ($_SERVER['REMOTE_ADDR'] == 'XXX.XXX.XXX.XXX') {
    die('hey');
    //die(json_encode($headers));
}

Solve the issue on the official instance:

git diff videos.php
diff --git a/videos.php b/videos.php
index 7047138..e4d88e1 100644
--- a/videos.php
+++ b/videos.php
@@ -83,7 +83,19 @@
             'Accept-Language: en'
         ];
         if ($music) {
-            array_push($headers, 'Referer: https://music.youtube.com');
+            $currentTime = time();
+            $SAPISID = 'CENSORED';
+            $__Secure_3PSID = 'CENSORED';
+            $ORIGIN = 'https://music.youtube.com';
+            $SAPISIDHASH = "${currentTime}_" . sha1("$currentTime $SAPISID $ORIGIN");
+
+            array_push($headers,
+                //'Referer: https://music.youtube.com',
+                "Origin: $ORIGIN",
+                "Authorization: SAPISIDHASH $SAPISIDHASH",
+                "Cookie: __Secure-3PSID=$__Secure_3PSID; __Secure-3PAPISID=$SAPISID",
+            );
         }
         $opts = [
             'http' => [

Let me know if it stops working at some point.