YunoHost-Apps / peertube_ynh

Federated (ActivityPub) video streaming platform using P2P for YunoHost
https://joinpeertube.org/fr/
GNU Affero General Public License v3.0
87 stars 27 forks source link

"Cannot fetch remote information of this URL" because yt-dlp depends on a newer version of Python #295

Closed tio-trom closed 2 years ago

tio-trom commented 2 years ago

The latest Peertube 4.0 depends on Python versions 3.6 and above. But since I would not want to mess with the other yunohost applications I have installed on the same server and manually upgrade to a newer Python version, what can be done?

So basically I cannot import any videos via the url.

h3ndrik commented 2 years ago

I'm affected, too.

I believe i found the error in the following line: https://github.com/Chocobozzz/PeerTube/blob/37a5d6318b8ce9a3784234751a74b7f15095d5c6/server/helpers/youtube-dl/youtube-dl-cli.ts#L156

We should invoke python3 here. But is this debian-specific? And do we need to fix that upstream, or write a patch file?

yalh76 commented 2 years ago

I'm affected, too.

I believe i found the error in the following line: https://github.com/Chocobozzz/PeerTube/blob/37a5d6318b8ce9a3784234751a74b7f15095d5c6/server/helpers/youtube-dl/youtube-dl-cli.ts#L156

We should invoke python3 here. But is this debian-specific? And do we need to fix that upstream, or write a patch file?

Or we patch the peertube sources or we wait to Bullseye Yunohost 11 being released

fflorent commented 2 years ago

I have proposed a PR to PeerTube.

https://github.com/Chocobozzz/PeerTube/pull/4706

tio-trom commented 2 years ago

I upgraded my peertube to the one with the fix. Same exact issue I see.

AkselRocks commented 2 years ago

Same here: Upgraded ynh_peertube, but issue is not solved.

fflorent commented 2 years ago

Thanks for your feedback.

@yalh76 Well, I didn't do well my job. The problem here is that people who already migrated to 4.0.0 don't benefit from the patch.

That's because I put the instruction to load the patch in this condition: https://github.com/YunoHost-Apps/peertube_ynh/blob/master/scripts/upgrade#L154

Maybe something like would do the job:

should_patch=$([ -d "../sources/patches-$(ynh_app_upstream_version)" ] && echo "yes" || echo "no")
if [ "$upgrade_type" == "UPGRADE_APP" || "$should_patch" == "yes"]
then
....
   [ "$should_patch" == "yes" ] && cp -a "../sources/patches-$(ynh_app_upstream_version)" "../sources/patches"
....
fi

What do you think?

I'll try to find some time to test that (properly) and propose a PR.

Edit: this way has the drawback of reinstalling (ynh_setup_source) PeerTube while upgrading to any version 4.0.0~ynh*, can it be an issue?

yalh76 commented 2 years ago

Or users can force upgrade from the command line: yunohost app upgrade peertube -u https://github.com/YunoHost-Apps/peertube_ynh --force

AkselRocks commented 2 years ago

with update from command line (like above) it works for some yt links, but for some it does not. for testing: not working with: https://www.youtube.com/watch?v=D9Ihs241zeg

tio-trom commented 2 years ago

Seems to kinda work now after I forced the upgrade...

AkselRocks commented 2 years ago

@tio-trom Did you try "my" yt link above? For me it still does not work.

fflorent commented 2 years ago

@AkselRocks Have you attempted the trick from @yalh76?

https://github.com/YunoHost-Apps/peertube_ynh/issues/295#issuecomment-1016777851

tio-trom commented 2 years ago

@tio-trom Did you try "my" yt link above?

Yah doesn't work with that video. I wonder why.

fflorent commented 2 years ago

@tio-trom Did you try "my" yt link above?

Yah doesn't work with that video. I wonder why.

Have you taken a look at the peertube logs (journalctl -u peertube)?

I get a MaxBufferError when I attempt to fetch this video from PeerTube, do you have the same output?

Feb 17 21:57:02 zeteo peertube[9136]: "err": { Feb 17 21:57:02 zeteo peertube[9136]: "stack": "MaxBufferError: Command failed: /usr/bin/python3 /home/yunohost.app/peertube/storage/bin/yt-dlp --dump-json -f bestvideo[vcodec^=avc1][height=720]+bestaudio[ext=m4a]/bestvideo[vcodec!=av01][vcodec!=vp9.2][height=720]+bestaudio/bestvideo[vcodec^=avc1][height<=720]+bestaudio[ext=m4a]/bestvideo[vcodec!=av01][vcodec!=vp9.2]+bestaudio/best[vcodec!=av01][vcodec!=vp9.2]/best https://www.youtube.com/watch?v=D9Ihs241zeg\nmaxBuffer exceeded\n{\"id\": \"D9Ihs241zeg\", \"title\": \"Chimamanda Ngozi Adichie: The danger of a single story | TED\", \"formats\": [{\"format_id\": \"sb2\", \"format_note\": \"storyboard\", \"ext\": \"mhtml\", \"protocol\": \"mhtml\", \"acodec\": \"none\", \"vcodec\": \"none\", \"url\": \"https://i.ytimg.com/sb/D9Ihs241zeg/storyboard3_L0/default.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgjD4rPVBQ==&sigh=rs$AOn4CLCwtpDUuiO51mzo-dbMRXh4DmTiQg\", \"width\": 48, \"height\": 27, \"fragments\": [{\"path\": \"https://i.ytimg.com/sb/D9Ihs241zeg/storyboard3_L0/default.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgjD4rPVBQ==&sigh=rs$AOn4CLCwtpDUuiO51mzo-dbMRXh4DmTiQg\", \"duration\": 1156.0}], \"audio_ext\": \"none\", \"video_ext\": \"none\", \"format\": \"sb2 - 48x27 (storyboard)\", \"resolution\": \"48x27\", \"http_headers\": {\"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36\", \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\", \"Accept-Encoding\": \"gzip, deflate\", \"Accept-Language\": \"en-us,en;q=0.5\", \"...

and this can be explained by the very long JSON extracted by the command run:

/usr/bin/python3 /home/yunohost.app/peertube/storage/bin/yt-dlp --dump-json -f 'bestvideo[vcodec^=avc1][height=720]+bestaudio[ext=m4a]/bestvideo[vcodec!*=av01][vcodec!*=vp9.2][height=720]+bestaudio/bestvideo[vcodec^=avc1][height<=720]+bestaudio[ext=m4a]/bestvideo[vcodec!*=av01][vcodec!*=vp9.2]+bestaudio/best[vcodec!*=av01][vcodec!*=vp9.2]/best' 'https://www.youtube.com/watch?v=D9Ihs241zeg'

That may be an issue to PeerTube here… Though I don't know whether this can be fixed =/.

tio-trom commented 2 years ago

Yes I get the same MaxBufferError.

fflorent commented 2 years ago

Yes I get the same MaxBufferError.

Alright! I guess this is not the same issue as the original one (which stated that the import failed due to the wrong python version being used for yt-dlp to be executed).

May we let you search and maybe fill an issue to the PeerTube project? https://github.com/Chocobozzz/PeerTube/issues

Chocobozzz commented 2 years ago

Hi,

I increased buffer size in https://github.com/Chocobozzz/PeerTube/commit/8296984de4b085231fb1a96c8456a2d79a8ded0c Available in 4.1 (stable release planned for this week)

fflorent commented 2 years ago

Hi,

I increased buffer size in Chocobozzz/PeerTube@8296984 Available in 4.1 (stable release planned for this week)

Hi @Chocobozzz. Thanks a lot for your answer and your work!

fflorent commented 2 years ago

Should be fixed by now, I guess we can close the issue? Do you agree @yalh76 @tio-trom

AkselRocks commented 2 years ago

works for me (and "my" yt link above). :+1: