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

[premier.one] Add new extractor #28029

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

sergsu
Copy link

@sergsu sergsu commented Jan 31, 2021

Please follow the guide below

  • You will be asked some questions, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your pull request (like that [x])
  • Use Preview tab to see how your pull request will actually look like

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:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

Premier.one is a streaming service mainly focused on Russian audience and publishing content mostly affiliated with one of TV channels - TNT. While there's free content, majority of titles are available only via subscription. Using cookies.txt works like a charm in those cases. I coded support for entire show/title download and partial by season or video id.

One may notice that for every request there are a couple of headers added, at least Accept is necessary as their Django API is smart enough to implement content matching. Referer is is done for sake of reproducing original request building, but isn't entirely necessary.



class PremierOneIE(InfoExtractor):
_VALID_URL = r'https?://premier\.one/show/(?P<show_id>[0-9]+)(/season/(?P<season_number>\d+))?(/video/(?P<id>[0-9a-f]+))?'
Copy link
Collaborator

Choose a reason for hiding this comment

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

There should be two different extractors: one for video, one for playlist.


class PremierOneIE(InfoExtractor):
_VALID_URL = r'https?://premier\.one/show/(?P<show_id>[0-9]+)(/season/(?P<season_number>\d+))?(/video/(?P<id>[0-9a-f]+))?'
_TEST = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a playlist test.

Comment on lines +45 to +46
'id': video_id,
'title': item.get('title'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Id and title are mandatory for video. Read coding conventions.

Comment on lines +51 to +53
'comment_count': item.get('comments_count'),
'season_number': item.get('season'),
'episode_number': item.get('episode'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

int_or_none

'comment_count': item.get('comments_count'),
'season_number': item.get('season'),
'episode_number': item.get('episode'),
'url': item.get('video_url'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Mandatory.

'Accept': 'application/json',
'Referer': 'https://premier.one/play/embed/' + video_id + '?controlledFullscreen=true'
})
if video.get('video_balancer') and video.get('video_balancer').get('default'):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Breaks.

})
if video.get('video_balancer') and video.get('video_balancer').get('default'):
formats = []
m3u8_url = video.get('video_balancer').get('default')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Breaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants