-
Notifications
You must be signed in to change notification settings - Fork 10k
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
[puhutv] Add new extractor #16269
[puhutv] Add new extractor #16269
Conversation
youtube_dl/extractor/puhutv.py
Outdated
|
||
return { | ||
'id': id, | ||
'slug_id': video_id, |
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.
No such meta field.
youtube_dl/extractor/puhutv.py
Outdated
'description': info.get('title').get('description'), | ||
'uploader': info.get('title').get('producer').get('name'), | ||
'view_count': info.get('content').get('watch_count'), | ||
'follower_count': info.get('title').get('follower_count'), |
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.
No such meta field.
youtube_dl/extractor/puhutv.py
Outdated
'follower_count': info.get('title').get('follower_count'), | ||
'thumbnail': 'https://%s' % info.get('content').get('images').get('wide').get('main'), | ||
'thumbnails': thumbnails, | ||
'loop_thumbnails': info.get('content').get('loop_thumbnails'), |
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.
No such meta field.
youtube_dl/extractor/puhutv.py
Outdated
'uploader': info.get('title').get('producer').get('name'), | ||
'view_count': info.get('content').get('watch_count'), | ||
'follower_count': info.get('title').get('follower_count'), | ||
'thumbnail': 'https://%s' % info.get('content').get('images').get('wide').get('main'), |
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.
Read coding conventions on optional metadata and fix code appropriately.
I have finished all commits, Could you review again? @dstftw |
Optional meta fields - nothing changed. |
@dstftw Could you review again? If there is any problem, could you leave feedback |
youtube_dl/extractor/puhutv.py
Outdated
|
||
display_id = compat_str(info['id']) | ||
title = info['title']['name'] | ||
if(info.get('display_name') and title is not None): |
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.
Outer parenthesis are superfluous. title
can't be None
at this point.
youtube_dl/extractor/puhutv.py
Outdated
if(info.get('display_name') and title is not None): | ||
title += ' ' + info.get('display_name') | ||
|
||
description = info.get('title', {}).get('description') or info.get('description') |
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.
try_get
.
youtube_dl/extractor/puhutv.py
Outdated
title += ' ' + info.get('display_name') | ||
|
||
description = info.get('title', {}).get('description') or info.get('description') | ||
timestamp = parse_iso8601(info.get('created_at')) |
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.
unified_timestamp
.
youtube_dl/extractor/puhutv.py
Outdated
description = info.get('title', {}).get('description') or info.get('description') | ||
timestamp = parse_iso8601(info.get('created_at')) | ||
upload_date = unified_strdate(info.get('created_at')) | ||
uploader = info.get('title', {}).get('producer', {}).get('name') |
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.
try_get
. Same for all other places.
youtube_dl/extractor/puhutv.py
Outdated
uploader_id = str_or_none(info.get('title', {}).get('producer', {}).get('id')) | ||
view_count = int_or_none(info.get('content', {}).get('watch_count')) | ||
duration = float_or_none(info.get('content', {}).get('duration_in_ms'), scale=1000) | ||
thumbnail = urljoin('https://', info.get('content', {}).get('images', {}).get('wide', {}).get('main')) |
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.
First parameter to urljoin
is URL.
youtube_dl/extractor/puhutv.py
Outdated
'https://puhutv.com/api/assets/%s/videos' % display_id, | ||
video_id, 'Downloading video JSON', fatal=False) | ||
if not req_formats: | ||
self.raise_geo_restricted() |
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.
It does not necessarily mean that.
youtube_dl/extractor/puhutv.py
Outdated
pagenum = 1 | ||
has_more = True | ||
while has_more is True: | ||
query = { |
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.
Inline to actual call place.
youtube_dl/extractor/puhutv.py
Outdated
continue | ||
subtitles[self._SUBTITLE_LANGS.get(lang, lang)] = [{ | ||
'url': sub_url, | ||
'ext': determine_ext(sub_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.
No need for ext
.
I fixed it as you requested. Would you like to have a look? @dstftw @remitamine @rg3 |
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
New extractor added due to issue#16010