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

[narando] add new extractor #18268

Closed
wants to merge 14 commits into from
Closed

[narando] add new extractor #18268

wants to merge 14 commits into from

Conversation

ealgase
Copy link
Contributor

@ealgase ealgase commented Nov 21, 2018

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

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.

youtube_dl/extractor/narando.py Outdated Show resolved Hide resolved
youtube_dl/extractor/narando.py Outdated Show resolved Hide resolved
youtube_dl/extractor/narando.py Outdated Show resolved Hide resolved
youtube_dl/extractor/narando.py Outdated Show resolved Hide resolved
youtube_dl/extractor/narando.py Outdated Show resolved Hide resolved
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')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same.

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')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Capture between tags.

youtube_dl/extractor/narando.py Outdated Show resolved Hide resolved
youtube_dl/extractor/narando.py Show resolved Hide resolved
@ealgase
Copy link
Contributor Author

ealgase commented Dec 1, 2018

Thanks for reviewing the code and suggesting improvements, I've implemented them.

@ealgase
Copy link
Contributor Author

ealgase commented Jan 20, 2019

@dstftw are there any more things I need to fix or can this be merged?

Copy link
Collaborator

@dstftw dstftw left a 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.



class NarandoPlayerIE(InfoExtractor):
IE_NAME = "narando:player"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Single quotes.

from .common import InfoExtractor


class NarandoPlayerIE(InfoExtractor):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rename to NarandoIE.


class NarandoPlayerIE(InfoExtractor):
IE_NAME = "narando:player"
_VALID_URL = r'https://narando\.com/widget\?r=(?P<id>\w+)'
Copy link
Collaborator

Choose a reason for hiding this comment

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

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')
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's . for?

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')
Copy link
Collaborator

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.

}


class NarandoIE(InfoExtractor):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rename.


class NarandoPlayerIE(InfoExtractor):
IE_NAME = "narando:player"
_VALID_URL = r'https://narando\.com/widget\?r=(?P<id>\w+)'
Copy link
Collaborator

Choose a reason for hiding this comment

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

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')
Copy link
Collaborator

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 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

url_result.

@ealgase
Copy link
Contributor Author

ealgase commented Jan 21, 2019

Thanks for reviewing again. I've made the requested changes.

@ealgase
Copy link
Contributor Author

ealgase commented May 16, 2019

@dstftw Can you please take a look at this again? I've also added thumbnail extraction.

@dirkf dirkf added defunct PR source branch is not accessible and removed account-needed labels Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defunct PR source branch is not accessible pending-fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants