ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.89k stars 10k forks source link

Update kommunetv.py #32931

Open hmlb-no opened 3 weeks ago

hmlb-no commented 3 weeks ago

Look at https://www.aventia.no/kommunetv/vare-kunder/

They are also in Sweeden.

Here is a problem tho.

https://stavanger.kommunetv.no/live/841

https://stavanger.kommunetv.no/archive/841

what if there is a live and a archive at the same time? how dose that work?

Please follow the guide below


Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

What is the purpose of your pull request?


Description of your pull request and other information

Explanation of your pull request in arbitrary form goes here. Please make sure the description explains the purpose and effect of your pull request and is worded well enough to be understood. Provide as much context and examples as possible.

dirkf commented 2 weeks ago

Here is a problem tho.

https://stavanger.kommunetv.no/live/841

https://stavanger.kommunetv.no/archive/841

what if there is a live and a archive at the same time? how dose that work?

If those are not the same thing (eg .../live/nnnn while live and .../archive/nnnn afterwards), the id could contain the last two elements of the path instead of the just the last element. Or some id that is unique across both path types may be hidden in the page, in which case that should be used.

hmlb-no commented 1 week ago

Here is a problem tho. https://stavanger.kommunetv.no/live/841 https://stavanger.kommunetv.no/archive/841 what if there is a live and a archive at the same time? how dose that work?

If those are not the same thing (eg .../live/nnnn while live and .../archive/nnnn afterwards), the id could contain the last two elements of the path instead of the just the last element. Or some id that is unique across both path types may be hidden in the page, in which case that should be used.

Yes they are different content. The central difference is that the 'live' ID is for ween they are live and then after they are live the get converted into a archive but with a different ID. But ween a there exist a archive and ween they are livestraming tehy are not downloading the live but instead youtube-dl downloads the archive woon.

For instance https://stavanger.kommunetv.no/live/841 gets converted into a new ID and that is https://stavanger.kommunetv.no/archive/1142

dirkf commented 1 week ago

live/841 corresponds to streamType=2&id=841 in the API; archive/1142 corresponds to streamType=1&id=1142 in the API.

Maybe the id format should be 2_841, 1_1142?

If the live id gives 404 (no longer live), the page tries https://stavanger.kommunetv.no/api/search/live/{live_id}/related which, if it succeeds, gives the archive id at [data][0]['id'].