Skip to content

plugins.pluto: new plugin for https://pluto.tv/ #3363

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
merged 2 commits into from
Nov 27, 2020

Conversation

back-to
Copy link
Collaborator

@back-to back-to commented Nov 25, 2020

https://pluto.tv/live-tv/

  • Livestreams will break during commercials without the self.session.set_option('ffmpeg-fout', 'mpegts') option enabled.
  • VODs might work without it, but I did not test it.

closes #854
closes #2747
closes #3156

Co-authored-by: calculon-jr 54852718+calculon-jr@users.noreply.github.com

https://pluto.tv/live-tv/

- Livestreams will break during commercials,
  without the `self.session.set_option('ffmpeg-fout', 'mpegts')` option enabled.
- VODs might work without it, but I did not test it.

closes streamlink#854
closes streamlink#2747
closes streamlink#3156

Co-authored-by: calculon-jr <54852718+calculon-jr@users.noreply.github.com>
Copy link
Member

@bastimeyer bastimeyer left a comment

Choose a reason for hiding this comment

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

Just some minor code suggestions. Tested all three URL types and they seem to work well.

return self.title

def _schema_media(self, slug):
return validate.Schema(validate.all(
Copy link
Member

Choose a reason for hiding this comment

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

validate.Schema is already a wrapper for validate.all.

Comment on lines 35 to 36
'name': validate.text,
'slug': validate.text,
Copy link
Member

Choose a reason for hiding this comment

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

Just use str instead of validate.text



class Pluto(Plugin):
_re_url = re.compile(r'''(?x)^https?://(?:www\.)?pluto\.tv/(?:
Copy link
Member

Choose a reason for hiding this comment

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

For readability reasons, it's better to set the re.VERBOSE option in the re.compile call itself instead of the regex string.

return

self.title = data.get('name')
stream_link_no_sid = data['stitched']['urls'][0]['url']
Copy link
Member

Choose a reason for hiding this comment

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

The stitched attribute gets validated as optional in the schema above. If it's missing in the response, this statement will raise a KeyError.

@back-to back-to added the PR: squash commits Commits need to be squashed as a single commit - eg. multiple commits for a single component label Nov 25, 2020
@back-to back-to merged commit 2f79f7d into streamlink:master Nov 27, 2020
@back-to back-to deleted the Pluto branch November 27, 2020 16:09
@gmccauley92
Copy link

When trying to run streamlink with a live-tv link, regardless of the channel (slug_live) given it defaults to newsy (this incidentally has no stitched and fails, but regardless the main issue is it seems the given slug is not being processed properly somewhere).

streamlink https://pluto.tv/live-tv/pluto-tv-007
[cli][info] Found matching plugin pluto for URL https://pluto.tv/live-tv/pluto-tv-007
error: Unable to validate JSON: Key 'stitched' not found in {'_id': '5459795fc9f133a519bc0bef', 'slug': 'newsy', 'name': 'Top Stories by Newsy', 'hash': '#Newsy', 'number': 232, 'summary': 'Be informed — not influenced — with Newsy’s opinion-free approach to news. For people who aren’t satisfied with only the loudest part of the story, Newsy 
Top Stories delivers honest, in-depth context on stories that matter.', 'visibility': 'everyone', 'onDemandDescription': '', 'category': 'News + Opinion', 'plutoOfficeOnly': False, 'directOnly': True, 'chatRoomId': -1, 'onDemand': False, 'cohortMask': 1023, 'featuredImage': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/featuredImage.jpg?w=1600&h=900&fm=jpg&q=75&fit=fill&fill=blur'}, 'thumbnail': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/thumbnail.jpg?w=660&h=660&fm=jpg&q=75&fit=fill&fill=blur'}, 'tile': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/tile.jpg'}, 'logo': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/logo.png?w=280&h=80&fm=png&fit=fill'}, 'colorLogoSVG': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/colorLogoSVG.svg'}, 'colorLogoPNG': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/colorLogoPNG.png'}, 'solidLogoSVG': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/solidLogoSVG.svg'}, 'solidLogoPNG': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/solidLogoPNG.png'}, 'featured': False, 'featuredOrder': 
-1, 'favorite': False, 'isStitched': False, 'tmsid': '115371'}

@gravyboat
Copy link
Member

@WayoshiM run with -l debug so we can see some debug output. Did you update the plugin manually from the master branch or use the nightly build version of Streamlink?

@gmccauley92
Copy link

gmccauley92 commented Dec 1, 2020

@gravyboat I installed with pip with the latest .git version.

streamlink https://pluto.tv/live-tv/pluto-tv-007 -l debug
[cli][debug] OS:         Windows 10
[cli][debug] Python:     3.8.0
[cli][debug] Streamlink: 1.7.0+92.gfd1affa
[cli][debug] Requests(2.25.0), Socks(1.7.1), Websocket(0.57.0)
[cli][info] Found matching plugin pluto for URL https://pluto.tv/live-tv/pluto-tv-007
error: Unable to validate JSON: Key 'stitched' not found in {'_id': '5459795fc9f133a519bc0bef', 'slug': 'newsy', 'name': 'Top Stories by Newsy', 'hash': '#Newsy', 'number': 232, 'summary': 'Be informed — not influenced — with Newsy’s opinion-free approach to news. For people who aren’t satisfied with only the loudest part of the story, Newsy Top Stories delivers honest, in-depth context on stories that matter.', 'visibility': 'everyone', 'onDemandDescription': '', 'category': 'News + Opinion', 'plutoOfficeOnly': False, 'directOnly': True, 'chatRoomId': -1, 'onDemand': False, 'cohortMask': 1023, 'featuredImage': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/featuredImage.jpg?w=1600&h=900&fm=jpg&q=75&fit=fill&fill=blur'}, 'thumbnail': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/thumbnail.jpg?w=660&h=660&fm=jpg&q=75&fit=fill&fill=blur'}, 'tile': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/tile.jpg'}, 'logo': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/logo.png?w=280&h=80&fm=png&fit=fill'}, 'colorLogoSVG': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/colorLogoSVG.svg'}, 'colorLogoPNG': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/colorLogoPNG.png'}, 'solidLogoSVG': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/solidLogoSVG.svg'}, 'solidLogoPNG': {'path': 'https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/solidLogoPNG.png'}, 'featured': False, 'featuredOrder': -1, 'favorite': False, 'isStitched': False, 'tmsid': '115371'}

I think the issue might be that stitched is in fact an optional part of this JSON. Maybe use k['isStitched'] in the filter

@emveepee
Copy link

emveepee commented Dec 1, 2020

Correct newsy doesn't have stitched. so isStitched is false

    {
        "_id": "5459795fc9f133a519bc0bef",
        "slug": "newsy",
        "name": "Top Stories by Newsy",
        "hash": "#Newsy",
        "number": 232,
        "summary": "Be informed � not influenced � with Newsy�s opinion-free approach to news. For people who aren�t satisfied with only the loudest part of the story, Newsy Top Stories delivers honest, in-depth context on stories that matter.",
        "visibility": "everyone",
        "onDemandDescription": "",
        "category": "News + Opinion",
        "plutoOfficeOnly": false,
        "directOnly": true,
        "chatRoomId": -1,
        "onDemand": false,
        "cohortMask": 1023,
        "featuredImage": {
            "path": "https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/featuredImage.jpg?w=1600\u0026h=900\u0026fm=jpg\u0026q=75\u0026fit=fill\u0026fill=blur"
        },
        "thumbnail": {
            "path": "https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/thumbnail.jpg?w=660\u0026h=660\u0026fm=jpg\u0026q=75\u0026fit=fill\u0026fill=blur"
        },
        "tile": {
            "path": "https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/tile.jpg"
        },
        "logo": {
            "path": "https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/logo.png?w=280\u0026h=80\u0026fm=png\u0026fit=fill"
        },
        "colorLogoSVG": {
            "path": "https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/colorLogoSVG.svg"
        },
        "colorLogoPNG": {
            "path": "https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/colorLogoPNG.png"
        },
        "solidLogoSVG": {
            "path": "https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/solidLogoSVG.svg"
        },
        "solidLogoPNG": {
            "path": "https://images.pluto.tv/channels/5459795fc9f133a519bc0bef/solidLogoPNG.png"
        },
        "featured": false,
        "featuredOrder": -1,
        "favorite": false,
        "isStitched": false,
        "tmsid": "115371"
    },

Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Dec 15, 2020
https://pluto.tv/live-tv/

- Livestreams will break during commercials,
  without the `self.session.set_option('ffmpeg-fout', 'mpegts')` option enabled.
- VODs might work without it, but I did not test it.

closes streamlink#854
closes streamlink#2747
closes streamlink#3156

Co-authored-by: calculon-jr <54852718+calculon-jr@users.noreply.github.com>

streamlink#3363

added to plugin matrix

added test
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Dec 15, 2020
https://pluto.tv/live-tv/

- Livestreams will break during commercials,
  without the `self.session.set_option('ffmpeg-fout', 'mpegts')` option enabled.
- VODs might work without it, but I did not test it.

closes streamlink#854
closes streamlink#2747
closes streamlink#3156

Co-authored-by: calculon-jr <54852718+calculon-jr@users.noreply.github.com>

streamlink#3363

added to plugin matrix

added test
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Dec 17, 2020
https://pluto.tv/live-tv/

- Livestreams will break during commercials,
  without the `self.session.set_option('ffmpeg-fout', 'mpegts')` option enabled.
- VODs might work without it, but I did not test it.

closes streamlink#854
closes streamlink#2747
closes streamlink#3156

Co-authored-by: calculon-jr <54852718+calculon-jr@users.noreply.github.com>

streamlink#3363

added to plugin matrix

added test
@Leatherface75
Copy link

Would be nice with support for closed captions/subtitles in this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new plugin PR: squash commits Commits need to be squashed as a single commit - eg. multiple commits for a single component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pluto.TV Live Plugin Request: Pluto.tv
6 participants