Skip to content

plugins.dogan: find direct HLS URL #5299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

bastimeyer
Copy link
Member

Fixes #5297

The HLS stream URL is read from the data-url attribute of the DOM node with the data-live=true attribute, so an API query is not needed in this case.

Plugin now finds the correct stream URL on kanald. Other sites are not affected by this change.

$ echo -e 'from tests.plugins.test_dogan import TestPluginCanHandleUrlDogan as A\n[print(s) for s in A.should_match]' | python | xargs -n1 -P1 streamlink
[cli][info] Found matching plugin dogan for URL https://www.cnnturk.com/canli-yayin
Available streams: 410k (worst), 570k, 850k, 1100k, 1400k (best)
[cli][info] Found matching plugin dogan for URL https://www.cnnturk.com/action/embedvideo/5fa56d065cf3b018a8dd0bbc
Available streams: 300k (worst), 750k, 1000k, 1200k, 1800k, 2800k (best)
[cli][info] Found matching plugin dogan for URL https://www.cnnturk.com/tv-cnn-turk/belgeseller/bir-zamanlar/bir-zamanlar-90lar-belgeseli
Available streams: 300k (worst), 750k, 1000k, 1200k, 1800k, 2800k (best)
[cli][info] Found matching plugin dogan for URL https://www.cnnturk.com/video/turkiye/polis-otomobiliyle-tur-atan-sahisla-ilgili-islem-baslatildi-video
Available streams: 300k (worst), 750k, 1000k, 1200k, 1800k, 2800k (best)
[cli][info] Found matching plugin dogan for URL https://www.dreamturk.com.tr/canli-yayin-izle
Available streams: 330k (worst), 490k, 780k, 1000k, 1600k (best)
[cli][info] Found matching plugin dogan for URL https://www.dreamturk.com.tr/dream-turk-ozel/radyo-d/ilyas-yalcintas-radyo-dnin-konugu-oldu
Available streams: 300k (worst), 750k, 1000k, 1200k, 1800k, 2800k (best)
[cli][info] Found matching plugin dogan for URL https://www.dreamturk.com.tr/programlar/dream-10
Available streams: 750k (worst), 1200k, 1800k, 2800k (best)
[cli][info] Found matching plugin dogan for URL https://www.dreamtv.com.tr/dream-ozel/konserler/acik-sahne-dream-ozel
Available streams: 300k (worst), 750k, 1000k, 1200k, 1800k, 2800k (best)
[cli][info] Found matching plugin dogan for URL https://www.teve2.com.tr/canli-yayin
Available streams: 330k (worst), 490k, 780k, 1000k, 1300k (best)
[cli][info] Found matching plugin dogan for URL https://www.teve2.com.tr/diziler/guncel/oyle-bir-gecer-zaman-ki/bolumler/oyle-bir-gecer-zaman-ki-1-bolum
Available streams: 350k (worst), 750k, 1000k, 1200k, 1800k, 2800k (best)
[cli][info] Found matching plugin dogan for URL https://www.teve2.com.tr/embed/55f6d5b8402011f264ec7f64
Available streams: 750k (worst), 1200k, 1800k, 2800k (best)
[cli][info] Found matching plugin dogan for URL https://www.teve2.com.tr/filmler/guncel/yasamak-guzel-sey
Available streams: 750k (worst), 1200k, 1800k, 2800k (best)
[cli][info] Found matching plugin dogan for URL https://www.teve2.com.tr/programlar/guncel/kelime-oyunu/bolumler/kelime-oyunu-800-bolum-19-12-2020
Available streams: 750k (worst), 1200k, 1800k, 2800k (best)
[cli][info] Found matching plugin dogan for URL https://www.kanald.com.tr/canli-yayin
Available streams: 360p (worst), 480p, 720p, 1080p (best)
[cli][info] Found matching plugin dogan for URL https://www.kanald.com.tr/embed/5fda41a8ebc8302048167df6
Available streams: 750k (worst), 1200k, 1800k, 2800k (best)
[cli][info] Found matching plugin dogan for URL https://www.kanald.com.tr/sadakatsiz/fragmanlar/sadakatsiz-10-bolum-fragmani
Available streams: 750k (worst), 1200k, 1800k, 2800k (best)

@bastimeyer bastimeyer added the plugin issue A Plugin does not work correctly label Apr 18, 2023
@bastimeyer
Copy link
Member Author

@stulluk please check. Install from the branch of this PR or side-load the plugin changes

https://streamlink.github.io/install.html#pypi-package-and-source-code
https://streamlink.github.io/cli/plugin-sideloading.html

@stulluk
Copy link

stulluk commented Apr 19, 2023

@bastimeyer thank you very much. I confirm that it now can display LIVE on KanalD. However, due to my lack of knowledge, I can't find why it can't play the URL via MPV or VLC by using "--stream-url". See below:

stulluk ~/streamlink $  git clone https://github.com/bastimeyer/streamlink/
Cloning into 'streamlink'...
remote: Enumerating objects: 32604, done.
remote: Counting objects: 100% (375/375), done.
remote: Compressing objects: 100% (222/222), done.
remote: Total 32604 (delta 188), reused 312 (delta 153), pack-reused 32229
Receiving objects: 100% (32604/32604), 37.58 MiB | 7.09 MiB/s, done.
Resolving deltas: 100% (21594/21594), done.
stulluk ~/streamlink $  
stulluk ~/streamlink $  cd streamlink/
stulluk ~/streamlink/streamlink (master) $  
stulluk ~/streamlink/streamlink (master) $  git checkout plugins/dogan/find-direct-hls-url 
Branch 'plugins/dogan/find-direct-hls-url' set up to track remote branch 'plugins/dogan/find-direct-hls-url' from 'origin'.
Switched to a new branch 'plugins/dogan/find-direct-hls-url'
stulluk ~/streamlink/streamlink (plugins/dogan/find-direct-hls-url) $ 
stulluk ~/streamlink/streamlink (plugins/dogan/find-direct-hls-url) $  mkdir -p  ~/.local/share/streamlink/plugins
stulluk ~/streamlink/streamlink (plugins/dogan/find-direct-hls-url) $  cp src/streamlink/plugins/dogan.py ~/.local/share/streamlink/plugins/
stulluk ~/streamlink/streamlink (plugins/dogan/find-direct-hls-url) $  streamlink https://www.kanald.com.tr/canli-yayin
[cli][info] Found matching plugin dogan for URL https://www.kanald.com.tr/canli-yayin
Available streams: 360p (worst), 480p, 720p, 1080p (best)
stulluk ~/streamlink/streamlink (plugins/dogan/find-direct-hls-url) $  streamlink https://www.kanald.com.tr/canli-yayin 720p
[cli][info] Found matching plugin dogan for URL https://www.kanald.com.tr/canli-yayin
[cli][info] Available streams: 360p (worst), 480p, 720p, 1080p (best)
[cli][info] Opening stream: 720p (hls)
[cli][info] Starting player: /usr/bin/vlc
[cli][info] Player closed
[cli][info] Stream ended
[cli][info] Closing currently open stream...
stulluk ~/streamlink/streamlink (plugins/dogan/find-direct-hls-url) $  streamlink https://www.kanald.com.tr/canli-yayin 720p --stream-url
https://demiroren.daioncdn.net/kanald/kanald_720p.m3u8?&sid=5bqmdtbknpjj&app=da2109ea-5dfe-4107-89ab-23593336ed61&ce=3
stulluk ~/streamlink/streamlink (plugins/dogan/find-direct-hls-url) $  mpv https://demiroren.daioncdn.net/kanald/kanald_720p.m3u8?&sid=5bqmdtbknpjj&app=da2109ea-5dfe-4107-89ab-23593336ed61&ce=3
[1] 39332
[2] 39333
[3] 39334
[2]-  Done                    sid=5bqmdtbknpjj
[3]+  Done                    app=da2109ea-5dfe-4107-89ab-23593336ed61
stulluk ~/streamlink/streamlink (plugins/dogan/find-direct-hls-url) $  [ffmpeg] https: HTTP error 404 Not Found
Failed to open https://demiroren.daioncdn.net/kanald/kanald_720p.m3u8?.
[ytdl_hook] ERROR: [generic] None: Unable to download webpage: HTTP Error 404: Not Found (caused by <HTTPError 404: 'Not Found'>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U 
[ytdl_hook] youtube-dl failed: unexpected error occurred 

Exiting... (Errors when loading file)

[1]+  Exit 2                  mpv https://demiroren.daioncdn.net/kanald/kanald_720p.m3u8?
stulluk ~/streamlink/streamlink (plugins/dogan/find-direct-hls-url) $  
stulluk ~/streamlink/streamlink (plugins/dogan/find-direct-hls-url) $  vlc https://demiroren.daioncdn.net/kanald/kanald_720p.m3u8?&sid=5bqmdtbknpjj&app=da2109ea-5dfe-4107-89ab-23593336ed61&ce=3
[1] 39358
[2] 39359
[3] 39360
VLC media player 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2)
[2]-  Done                    sid=5bqmdtbknpjj
[3]+  Done                    app=da2109ea-5dfe-4107-89ab-23593336ed61
stulluk ~/streamlink/streamlink (plugins/dogan/find-direct-hls-url) $  [0000564b00fc8640] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[00007fde74001680] access stream error: HTTP 404 error
[00007fde74001680] http stream error: local stream 1 error: Cancellation (0x8)
QObject::~QObject: Timers cannot be stopped from another thread

[1]+  Done                    vlc https://demiroren.daioncdn.net/kanald/kanald_720p.m3u8?
stulluk ~/streamlink/streamlink (plugins/dogan/find-direct-hls-url) $  

Could you please guide me, how can I play direct URL via MPV or VLC ?

@mkbloke
Copy link
Member

mkbloke commented Apr 19, 2023

You need to put the streaming URL in single quotes to escape the shell special characters. E.g.:

mpv 'https://demiroren.daioncdn.net/kanald/kanald_720p.m3u8?&sid=5bqmdtbknpjj&app=da2109ea-5dfe-4107-89ab-23593336ed61&ce=3'

However, this is often not a good idea because parameters within the URL could change over time and cookies and/or HTTP headers that may be required are not set. These are all things that are taken care of when streaming via the plugin and then piping the video into the player.

@bastimeyer
Copy link
Member Author

@bastimeyer bastimeyer merged commit 38d4ba0 into streamlink:master Apr 19, 2023
@bastimeyer bastimeyer deleted the plugins/dogan/find-direct-hls-url branch April 19, 2023 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin issue A Plugin does not work correctly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plugins.dogan: CnnTurk and KanalD doesn't show live TV
3 participants