Skip to content
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

plugins.euronews: rewrite and fix using XPath #3976

Merged
merged 1 commit into from Sep 1, 2021

Conversation

bastimeyer
Copy link
Member

Live (main - youtube)

$ streamlink -l debug 'https://euronews.com/live'
[cli][debug] OS:         Linux-5.13.12-1-git-x86_64-with-glibc2.33
[cli][debug] Python:     3.9.6
[cli][debug] Streamlink: 2.3.0+37.g1d121ba
[cli][debug] Requests(2.26.0), Socks(1.7.1), Websocket(1.1.0)
[cli][debug] Arguments:
[cli][debug]  url=https://euronews.com/live
[cli][debug]  --loglevel=debug
[cli][debug]  --player=mpv
[cli][info] Found matching plugin euronews for URL https://euronews.com/live
[plugins.youtube][debug] Using video ID: sPgqEHsONK8
[plugins.youtube][debug] This video is live.
[utils.l10n][debug] Language code: en_US
Available streams: 144p (worst), 240p, 360p, 480p, 720p (best)

Live (de - youtube)

$ streamlink -l debug 'https://de.euronews.com/live'
[cli][debug] OS:         Linux-5.13.12-1-git-x86_64-with-glibc2.33
[cli][debug] Python:     3.9.6
[cli][debug] Streamlink: 2.3.0+37.g1d121ba
[cli][debug] Requests(2.26.0), Socks(1.7.1), Websocket(1.1.0)
[cli][debug] Arguments:
[cli][debug]  url=https://de.euronews.com/live
[cli][debug]  --loglevel=debug
[cli][debug]  --player=mpv
[cli][info] Found matching plugin euronews for URL https://de.euronews.com/live
[plugins.youtube][debug] Using video ID: T9wF9QYVIXM
[plugins.youtube][debug] This video is live.
[utils.l10n][debug] Language code: en_US
Available streams: 144p (worst), 240p, 360p, 480p, 720p (best)

Live (ru - self hosted)

$ streamlink -l debug 'https://ru.euronews.com/live'
[cli][debug] OS:         Linux-5.13.12-1-git-x86_64-with-glibc2.33
[cli][debug] Python:     3.9.6
[cli][debug] Streamlink: 2.3.0+37.g1d121ba
[cli][debug] Requests(2.26.0), Socks(1.7.1), Websocket(1.1.0)
[cli][debug] Arguments:
[cli][debug]  url=https://ru.euronews.com/live
[cli][debug]  --loglevel=debug
[cli][debug]  --player=mpv
[cli][info] Found matching plugin euronews for URL https://ru.euronews.com/live
[utils.l10n][debug] Language code: en_US
Available streams: 240p (worst), 360p, 480p, 576p, 720p_alt, 720p (best)

VODs (self hosted)

$ streamlink -l debug 'https://www.euronews.com/video/2021/09/01/sri-lanka-reports-rare-birth-of-elephant-twins'
[cli][debug] OS:         Linux-5.13.12-1-git-x86_64-with-glibc2.33
[cli][debug] Python:     3.9.6
[cli][debug] Streamlink: 2.3.0+37.g1d121ba
[cli][debug] Requests(2.26.0), Socks(1.7.1), Websocket(1.1.0)
[cli][debug] Arguments:
[cli][debug]  url=https://www.euronews.com/video/2021/09/01/sri-lanka-reports-rare-birth-of-elephant-twins
[cli][debug]  --loglevel=debug
[cli][debug]  --player=mpv
[cli][info] Found matching plugin euronews for URL https://www.euronews.com/video/2021/09/01/sri-lanka-reports-rare-birth-of-elephant-twins
Available streams: vod (worst, best)

VODs (youtube)
Can't find a VOD right now with an embedded YT video

@bastimeyer bastimeyer added the plugin enhancement A new feature for a working Plugin label Sep 1, 2021
for elem in itertags(content, "div"):
if elem.attributes.get("id") == "pfpPlayer" and elem.attributes.get("data-google-src") is not None:
return elem.attributes.get("data-video-id")
video_url = root.xpath("string(.//iframe[@id='pfpPlayer'][starts-with(@src,'https://www.youtube.com/')][1]/@src)")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VODs (youtube)
Can't find a VOD right now with an embedded YT video

it has meta og:video
but the youtube player is not an iframe

https://www.euronews.com/travel/2021/08/25/meet-the-woman-whose-lockdown-campervan-project-changed-her-life

<div id="pfpPlayer"
    class="u-height-full u-position-absolute u-width-full">
    <div class="js-player-pfp"
        style="width: 100%; height: 100%;" data-player="pfp"
        data-id="euronews-youtube-pfp"
        data-google-src="https://apis.google.com/js/api.js?onload=googleApiClientReady"
        data-video-id="lbUnUJsTZCE" data-video-autoplay=""
        data-video-isembed="" data-sitename="euronews"
        data-color="#003865" data-related="[]" data-hasAds="1"
        data-src="/build/b5366582c03145c79ccf-youtube-pfp.js">
        <div class="js-playtrigger c-playtrigger "><button
                class="js-playtrigger__button c-playtrigger__button"
                aria-label="Play the video"></button></div>
    </div>
</div>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are definitely two different implementations on their site. One with a div and data-google-src/data-video-id attributes, and one with a simple iframe.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@back-to back-to merged commit d518a81 into streamlink:master Sep 1, 2021
@bastimeyer bastimeyer deleted the plugins/euronews/xpath branch September 1, 2021 15:46
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin enhancement A new feature for a working Plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants