-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
base: master
Are you sure you want to change the base?
Conversation
|
||
|
||
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]+))?' |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a playlist test.
'id': video_id, | ||
'title': item.get('title'), |
There was a problem hiding this comment.
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_count': item.get('comments_count'), | ||
'season_number': item.get('season'), | ||
'episode_number': item.get('episode'), |
There was a problem hiding this comment.
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'), |
There was a problem hiding this comment.
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'): |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaks.
Please follow the guide below
x
into all the boxes [ ] relevant to your pull request (like that [x])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
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.