mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-15 12:53:18 +00:00
[nfl] Add support for URLs without id (Closes #6907)
This commit is contained in:
parent
5b4c54631a
commit
4423eba49b
|
@ -60,7 +60,7 @@ class NFLIE(InfoExtractor):
|
||||||
)
|
)
|
||||||
)/
|
)/
|
||||||
(?:.+?/)*
|
(?:.+?/)*
|
||||||
(?P<id>(?:[a-z0-9]{16}|\w{8}\-(?:\w{4}\-){3}\w{12}))
|
(?P<id>[^/#?&]+)
|
||||||
'''
|
'''
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.nfl.com/videos/nfl-game-highlights/0ap3000000398478/Week-3-Redskins-vs-Eagles-highlights',
|
'url': 'http://www.nfl.com/videos/nfl-game-highlights/0ap3000000398478/Week-3-Redskins-vs-Eagles-highlights',
|
||||||
|
@ -96,6 +96,17 @@ class NFLIE(InfoExtractor):
|
||||||
'timestamp': 1422850320,
|
'timestamp': 1422850320,
|
||||||
'upload_date': '20150202',
|
'upload_date': '20150202',
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'http://www.patriots.com/video/2015/09/18/10-days-gillette',
|
||||||
|
'md5': '4c319e2f625ffd0b481b4382c6fc124c',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'n-238346',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': '10 Days at Gillette',
|
||||||
|
'description': 'md5:8cd9cd48fac16de596eadc0b24add951',
|
||||||
|
'timestamp': 1442618809,
|
||||||
|
'upload_date': '20150918',
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://www.nfl.com/videos/nfl-network-top-ten/09000d5d810a6bd4/Top-10-Gutsiest-Performances-Jack-Youngblood',
|
'url': 'http://www.nfl.com/videos/nfl-network-top-ten/09000d5d810a6bd4/Top-10-Gutsiest-Performances-Jack-Youngblood',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
@ -135,13 +146,14 @@ def _real_extract(self, url):
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
config_url = NFLIE.prepend_host(host, self._search_regex(
|
config_url = NFLIE.prepend_host(host, self._search_regex(
|
||||||
r'(?:config|configURL)\s*:\s*"([^"]+)"', webpage, 'config URL',
|
r'(?:(?:config|configURL)\s*:\s*|<nflcs:avplayer[^>]+data-config\s*=\s*)(["\'])(?P<config>.+?)\1',
|
||||||
default='static/content/static/config/video/config.json'))
|
webpage, 'config URL', default='static/content/static/config/video/config.json',
|
||||||
|
group='config'))
|
||||||
# For articles, the id in the url is not the video id
|
# For articles, the id in the url is not the video id
|
||||||
video_id = self._search_regex(
|
video_id = self._search_regex(
|
||||||
r'contentId\s*:\s*"([^"]+)"', webpage, 'video id', default=video_id)
|
r'(?:<nflcs:avplayer[^>]+data-contentId\s*=\s*|contentId\s*:\s*)(["\'])(?P<id>.+?)\1',
|
||||||
config = self._download_json(config_url, video_id,
|
webpage, 'video id', default=video_id, group='id')
|
||||||
note='Downloading player config')
|
config = self._download_json(config_url, video_id, 'Downloading player config')
|
||||||
url_template = NFLIE.prepend_host(
|
url_template = NFLIE.prepend_host(
|
||||||
host, '{contentURLTemplate:}'.format(**config))
|
host, '{contentURLTemplate:}'.format(**config))
|
||||||
video_data = self._download_json(
|
video_data = self._download_json(
|
||||||
|
|
Loading…
Reference in a new issue