Open Aspie96 opened 3 years ago
I shall mention it does try to download the video (which I was confused by, but it's my fault) using the generic extractor, which does not work.
I'll post the verbose log: https://pastebin.com/hu5DLSVd
you can use the the video download helper addon to download the video which works.
Just briefly checked lbry.tv and it seems very easy to do. Found the api that fetches the needed data within 1-2 minutes. There are two ways how to obtain the video. Could implement one as a fallback.
Will demonstrate it here (also to write it down for me or anyone else to implement)
Take this as an example https://lbry.tv/@cryptorekt:b/20200222_221757:f
Where the id of the video would be 20200222_221757
The video (returned by player) is located here https://cdn.lbryplayer.xyz/api/v3/streams/free/20200222_221757/f898e93918e68951dcaa1fdbe73e6502641e6bdd/b95f25
BASE_API = https://cdn.lbryplayer.xyz/api/v3/streams/free/
After base api the video id will be appended.
Then the claim id f898e93918e68951dcaa1fdbe73e6502641e6bdd
and last the hash or sd_hash (dunno if there is hd_hash as well). The hash can actually be shortened to 6 figures or the whole can be used
sd_hash = b95f25c25033dd5bebca0cd83777ee005981acbbd080fa38ae457bc08b0c8813ba1df0470aca8cb62d3b253f5fff02eb
hash = 9348ad62e433554db295b20f0fe7e3726f20504212b4f1fba6facd97c7e499db6850b44d6879d7174f503d70b729bd69
Those informations can be retrieved here
curl 'https://api.lbry.tv/api/v1/proxy?m=resolve' \
-H 'authority: api.lbry.tv' \
-H 'pragma: no-cache' \
-H 'cache-control: no-cache' \
-H 'sec-ch-ua: "Chromium";v="86", "\"Not\\A;Brand";v="99", "Google Chrome";v="86"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36' \
-H 'content-type: application/json-rpc' \
-H 'accept: */*' \
-H 'origin: https://lbry.tv' \
-H 'sec-fetch-site: same-site' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-dest: empty' \
-H 'referer: https://lbry.tv/' \
-H 'accept-language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7' \
--data-binary '{"jsonrpc":"2.0","method":"resolve","params":{"urls":["lbry://@cryptorekt#b/20200222_221757#f"],"include_purchase_receipt":true,"include_is_my_output":true},"id":0}' \
--compressed
Where id can be any number (it's most likely used to track a user)
The interesting part in the json is here
result►lbry://@cryptorekt#b/20200222_221757#f►value►source►hash
(too lazy to replace ►)
The most simple way is to use this (how the player is pulling the link)
curl 'https://api.lbry.tv/api/v1/proxy?m=get' \
-H 'authority: api.lbry.tv' \
-H 'pragma: no-cache' \
-H 'cache-control: no-cache' \
-H 'sec-ch-ua: "Chromium";v="86", "\"Not\\A;Brand";v="99", "Google Chrome";v="86"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36' \
-H 'content-type: application/json-rpc' \
-H 'accept: */*' \
-H 'origin: https://lbry.tv' \
-H 'sec-fetch-site: same-site' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-dest: empty' \
-H 'referer: https://lbry.tv/' \
-H 'accept-language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7' \
--data-binary '{"jsonrpc":"2.0","method":"get","params":{"uri":"lbry://@cryptorekt#b/20200222_221757#f","save_file":false},"id":0}' \
--compressed
Checklist
Example URLs
Description
LBRY is a free protocol to share files. LBRY.tv and odysee.com are frontends to LBRY and they mostly work as video platforms.