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

[Esquire] Add new extractor #12978

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

[Esquire] Add new extractor #12978

wants to merge 1 commit into from

Conversation

robcortez
Copy link

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

Adding support for tv.esquire.com with a new extractor.



class EsquireIE(AdobePassIE):
_VALID_URL = r'https?://tv\.esquire\.com/now/(?:[^/]+)/?(?:full-episode)?/(?P<title>[^/?#]+)/(?P<id>[^/?#]+)'
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 catch groups that you're not using.
something like:

_VALID_URL = r'https?://tv\.esquire\.com/now/(?:[^/]+/)?full-episode/[^/]+/(?P<id>\d+)'

'uploader': 'NBCU-MPAT',
}
}, {
'url': 'http://tv.esquire.com/now/full-episode/ninja-warrior-402/759415363504',
Copy link
Collaborator

Choose a reason for hiding this comment

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

for test case related only to changes in _VALID_URL, just use only_matching.

'uploader': 'NBCU-MPAT',
}
}, {
'url': 'http://tv.esquire.com/now/friday-night-tykes/full-episode/if-you-wanna-show…/903098435679',
Copy link
Collaborator

Choose a reason for hiding this comment

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

if the test case has the same flow as the previous one then there is no need for another test.

info.update({
'_type': 'url_transparent',
'url': smuggle_url(update_url_query(
'http://link.theplatform.com/s/%s/%s' % (account_pid, path),
Copy link
Collaborator

Choose a reason for hiding this comment

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

can be extracted directly from data-release-url in the webpage.

class EsquireIE(AdobePassIE):
_VALID_URL = r'https?://tv\.esquire\.com/now/(?:[^/]+)/?(?:full-episode)?/(?P<title>[^/?#]+)/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'http://tv.esquire.com/now/team-ninja-warrior/full-episode/finals-week-1/631550531649',
Copy link
Collaborator

Choose a reason for hiding this comment

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

as the test require authentication to pass, it should be skipped(otherwise it will fail in Travis CI).

query['auth'] = self._extract_mvpd_auth(
url, video_id, adobe_pass.get('adobePassRequestorId', 'esquire'), resource)

info = self._search_json_ld(webpage, video_id, default={})
Copy link
Collaborator

Choose a reason for hiding this comment

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

if the site does not offer JSON-LD data then there is no need to extract them.

adobe_pass.get('adobePassResourceId', 'esquire'),
title, video_id, player_params.get('data-episode-rating', 'TV-14'))
query['auth'] = self._extract_mvpd_auth(
url, video_id, adobe_pass.get('adobePassRequestorId', 'esquire'), resource)
Copy link
Collaborator

Choose a reason for hiding this comment

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

esquire is not a valid adobe pass requestor id, the fallback value should be style(the value that is actually used now), the same apply to adobe pass resource id.

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.

3 participants