-
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
[narando] add new extractor #18268
[narando] add new extractor #18268
Conversation
…display_id attribute
youtube_dl/extractor/narando.py
Outdated
video_id = self._match_id(url) | ||
webpage = self._download_webpage('https://narando.com/widget?r=' + video_id, video_id) | ||
title = self._html_search_regex(r'<title>narando \| (.+?)</title>', webpage, 'title') | ||
download_url = self._html_search_regex(r'.<div class="stream_url hide">\s*([^?]*)', webpage, 'download_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.
Same.
youtube_dl/extractor/narando.py
Outdated
video_id = self._match_id(url) | ||
webpage = self._download_webpage('https://narando.com/widget?r=' + video_id, video_id) | ||
title = self._html_search_regex(r'<title>narando \| (.+?)</title>', webpage, 'title') | ||
download_url = self._html_search_regex(r'.<div class="stream_url hide">\s*([^?]*)', webpage, 'download_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.
Capture between tags.
Thanks for reviewing the code and suggesting improvements, I've implemented them. |
@dstftw are there any more things I need to fix or can this be merged? |
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.
Bother to read coding conventions.
youtube_dl/extractor/narando.py
Outdated
|
||
|
||
class NarandoPlayerIE(InfoExtractor): | ||
IE_NAME = "narando:player" |
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.
Single quotes.
youtube_dl/extractor/narando.py
Outdated
from .common import InfoExtractor | ||
|
||
|
||
class NarandoPlayerIE(InfoExtractor): |
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.
Rename to NarandoIE
.
youtube_dl/extractor/narando.py
Outdated
|
||
class NarandoPlayerIE(InfoExtractor): | ||
IE_NAME = "narando:player" | ||
_VALID_URL = r'https://narando\.com/widget\?r=(?P<id>\w+)' |
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.
Does not match https://narando.com/widget?foo=bar&r=b2t4t789kxgy9g7ms4rwjvvw.
youtube_dl/extractor/narando.py
Outdated
video_id = self._match_id(url) | ||
webpage = self._download_webpage(url, video_id) | ||
title = self._html_search_regex(r'<span class="clip-title">(.+?)</span>', webpage, 'title') | ||
download_url = self._html_search_regex(r'.<div class="stream_url hide">\s*([^?]*)', webpage, 'download_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.
What's .
for?
youtube_dl/extractor/narando.py
Outdated
video_id = self._match_id(url) | ||
webpage = self._download_webpage(url, video_id) | ||
title = self._html_search_regex(r'<span class="clip-title">(.+?)</span>', webpage, 'title') | ||
download_url = self._html_search_regex(r'.<div class="stream_url hide">\s*([^?]*)', webpage, 'download_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.
Do not capture empty strings.
youtube_dl/extractor/narando.py
Outdated
} | ||
|
||
|
||
class NarandoIE(InfoExtractor): |
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.
Rename.
youtube_dl/extractor/narando.py
Outdated
|
||
class NarandoPlayerIE(InfoExtractor): | ||
IE_NAME = "narando:player" | ||
_VALID_URL = r'https://narando\.com/widget\?r=(?P<id>\w+)' |
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.
Does not match https://narando.com/r/b2t4t789kxgy9g7ms4rwjvvw.
youtube_dl/extractor/narando.py
Outdated
video_id = self._match_id(url) | ||
webpage = self._download_webpage(url, video_id) | ||
title = self._html_search_regex(r'<h1 class="visible-xs h3">(.+?)</h1>', webpage, 'title') | ||
player_id = self._html_search_regex(r'\s*https://narando.com/r/([^"]*)', webpage, 'player_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.
\s*
is useless here. Again do not capture empty strings.
player_id = self._html_search_regex(r'\s*https://narando.com/r/([^"]*)', webpage, 'player_id') | ||
player_url = 'https://narando.com/widget?r=' + player_id | ||
|
||
return { |
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.
url_result
.
Thanks for reviewing again. I've made the requested changes. |
@dstftw Can you please take a look at this again? I've also added thumbnail extraction. |
5e26784
to
da2069f
Compare
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
This implements an extractor for narando as specified in #18252 . This also adds an extractor for [narando:player], which can be used in the future for sites which embed the narando player.