Insert URLs provided by YouTubeDL #2

Closed
opened 2021-03-15 07:18:22 +00:00 by achill · 2 comments
achill commented 2021-03-15 07:18:22 +00:00 (Migrated from codeberg.org)

Currenty Playlist2Podcasts downloads all media files, but maybe is the list very LOONG and uses much resources.

My idea is to use the media url (given by YouTubeDL) and insert it in the feeds without downloading every file.

I don't know how to implement it using the Youtube-dl Python api, but it offers youtube-dl --json that gives the media urls.

Currenty Playlist2Podcasts downloads all media files, but maybe is the list very LOONG and uses much resources. My idea is to use the media url (given by YouTubeDL) and insert it in the feeds without downloading every file. I don't know how to implement it using the Youtube-dl Python api, but it offers `youtube-dl --json` that gives the media urls.
marvin8 commented 2021-03-15 07:47:52 +00:00 (Migrated from codeberg.org)

There will be options in the future to control how many videos should be downloaded and converted to audio only.

Somthing like the n most recent, or only the first (or last) n videos in a playlist.

Anyway, I've literally only just started working on this and all I have is a proof of concept that works to a degree... :)

Using media urls provided by youtube-dl is trivial. But the main point for my own use is that I don't want the video part but only the audio part. My latest work in progress version is using the opus audio codec that allegedly sounds the best while (in my experience) is still smaller than the audio provided by Youtube.

Anyway... Interesting thought of trying to use a direct youtube link... I'll have a look if that's feasable and may provided an option in the future if I feel it makes sense.

There will be options in the future to control how many videos should be downloaded and converted to audio only. Somthing like the n most recent, or only the first (or last) n videos in a playlist. Anyway, I've literally only just started working on this and all I have is a proof of concept that works to a degree... :) Using media urls provided by youtube-dl is trivial. But the main point for my own use is that I don't want the video part but only the audio part. My latest work in progress version is using the opus audio codec that allegedly sounds the best while (in my experience) is still smaller than the audio provided by Youtube. Anyway... Interesting thought of trying to use a direct youtube link... I'll have a look if that's feasable and may provided an option in the future if I feel it makes sense.
marvin8 commented 2021-03-16 03:30:41 +00:00 (Migrated from codeberg.org)

Had good look at the media url provided and I don't think using the media url given by Youtube will work well. Youtube seems to be creating temporary URLs with expiry times that will not work about 6 hours after they've been generated by Youtube.

Below is a sample URL I got from Youtube that initially worked OK but now, a few hours later will no longer work.

https://r3---sn-ntqe6n76.googlevideo.com/videoplayback?expire=1615863740&ei=XMtPYKfDM4SGjuMPxduz2A4&ip=172.105.162.36&id=o-AD9i3wme47GnYI5-6Z5R0r-BKh4RhupZct3sg0y6bAgY&itag=251&source=youtube&requiressl=yes&mh=Kn&mm=31%2C29&mn=sn-ntqe6n76%2Csn-ntq7yner&ms=au%2Crdu&mv=u&mvi=3&pl=27&vprv=1&mime=audio%2Fwebm&ns=YxCOtOECGx1nQNhg3Bp_a9MF&gir=yes&clen=3642364&dur=224.821&lmt=1574990710882532&mt=1615841163&fvip=3&keepalive=yes&fexp=24001374%2C24007246&c=WEB&txp=5531432&n=HrNXIt_hA_1g3z&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIfZp7qwRfsalxl13zb_1_jRu-oJEwkAgwk1URREsT0WwIhANjpDmF5RpFQGvwLjw8mRMnckFoX8b4MW9VzxKS-PhLh&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl&lsig=AG3C_xAwRgIhAOWa8rKM1caBH7k94dGZlRl7wj67oBPBLIUJotDddwE4AiEAtwX-GdpYGN2xbxCsD4XhXGe5U88RlFr9-N5g0N_ccNw%3D

If you have a look you can see that the URL contains an expire parameter with the number being some kind of time (I think seconds since 1-1-1970; see Epoch Converter for an explanation.

I'll close this issue / idea now.

However feel free to re-open / comment some more if you have anything to add.

Had good look at the media url provided and I don't think using the media url given by Youtube will work well. Youtube seems to be creating temporary URLs with expiry times that will not work about 6 hours after they've been generated by Youtube. Below is a sample URL I got from Youtube that initially worked OK but now, a few hours later will no longer work. ``` https://r3---sn-ntqe6n76.googlevideo.com/videoplayback?expire=1615863740&ei=XMtPYKfDM4SGjuMPxduz2A4&ip=172.105.162.36&id=o-AD9i3wme47GnYI5-6Z5R0r-BKh4RhupZct3sg0y6bAgY&itag=251&source=youtube&requiressl=yes&mh=Kn&mm=31%2C29&mn=sn-ntqe6n76%2Csn-ntq7yner&ms=au%2Crdu&mv=u&mvi=3&pl=27&vprv=1&mime=audio%2Fwebm&ns=YxCOtOECGx1nQNhg3Bp_a9MF&gir=yes&clen=3642364&dur=224.821&lmt=1574990710882532&mt=1615841163&fvip=3&keepalive=yes&fexp=24001374%2C24007246&c=WEB&txp=5531432&n=HrNXIt_hA_1g3z&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIfZp7qwRfsalxl13zb_1_jRu-oJEwkAgwk1URREsT0WwIhANjpDmF5RpFQGvwLjw8mRMnckFoX8b4MW9VzxKS-PhLh&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl&lsig=AG3C_xAwRgIhAOWa8rKM1caBH7k94dGZlRl7wj67oBPBLIUJotDddwE4AiEAtwX-GdpYGN2xbxCsD4XhXGe5U88RlFr9-N5g0N_ccNw%3D ``` If you have a look you can see that the URL contains an `expire` parameter with the number being some kind of time (I think seconds since 1-1-1970; see [Epoch Converter](https://www.epochconvert.com/) for an explanation. I'll close this issue / idea now. However feel free to re-open / comment some more if you have anything to add.
Commenting is not possible because the repository is archived.
No labels
Ideas
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marvin8/playlist2podcasts#2
No description provided.