sparanoid/live-dl

func_check_state() METADATA_CURL parsing failed

jim60105 opened this issue ยท 3 comments

Hello, I want to report the error, this program has not worked since yesterday. Either the channel url or the video url will not work.

This is the log that appears when the live broadcast starts.
2020-12-12 02 05 27

I'm almost sure that the regex replacement here failed. It may be that Youtube changed the page.
I cut a simple script to verify this.

I am not familiar with regex and bash, I found the problem but not able to fix it.
Hope you can handle it, thank you.

pjw91 commented

This bug stems from:

live-dl/live-dl

Line 430 in ea1cfd7

METADATA_CURL_RAW=`echo "$_body" | grep '"ytInitialPlayerResponse"'`

becoming an empty string (maybe due to changes in youtube).

Changing that line to

METADATA_CURL_RAW=`echo "$_body" | grep -o 'var ytInitialPlayerResponse = .*'`

passes the "testcases" listed in the README.md, except the 4th test (playlist).

However, this change make the jq on

live-dl/live-dl

Line 439 in ea1cfd7

METADATA_CURL=`echo "$METADATA_CURL_RAW" | perl -pe 's/^.*?({".*}).*/\1/g' | jq -r .`
raises "parse error: Invalid numeric literal at line 1, column 247".

Thus, this change is merely a temporarily workaround.

fix for METADATA_CURL:
METADATA_CURL=`echo "$METADATA_CURL_RAW" | perl -pe 's/^.*?(\{".*});var meta.*$/\1/g' | jq -r .`

fix for METADATA_CURL:
METADATA_CURL=`echo "$METADATA_CURL_RAW" | perl -pe 's/^.*?(\{".*});var meta.*$/\1/g' | jq -r .`

This is not working on video.

Sorry, it was my mistake. After I put the two fixes together, it worked.
Thanks for your reply.