]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/fox.py
add support for Adobe Pass auth in tbs,tnt and trutv extractors(fixes #10642)(closes...
[yt-dlp.git] / youtube_dl / extractor / fox.py
CommitLineData
9787c5f4 1# coding: utf-8
2from __future__ import unicode_literals
3
4from .common import InfoExtractor
e37b54b1
RA
5from ..utils import (
6 smuggle_url,
7 update_url_query,
8)
9787c5f4 9
10
11class FOXIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www\.)?fox\.com/watch/(?P<id>[0-9]+)'
13 _TEST = {
14 'url': 'http://www.fox.com/watch/255180355939/7684182528',
5e3a6fec 15 'md5': 'ebd296fcc41dd4b19f8115d8461a3165',
9787c5f4 16 'info_dict': {
17 'id': '255180355939',
18 'ext': 'mp4',
19 'title': 'Official Trailer: Gotham',
20 'description': 'Tracing the rise of the great DC Comics Super-Villains and vigilantes, Gotham reveals an entirely new chapter that has never been told.',
21 'duration': 129,
79ba9140 22 'timestamp': 1400020798,
23 'upload_date': '20140513',
24 'uploader': 'NEWA-FNG-FOXCOM',
9787c5f4 25 },
26 'add_ie': ['ThePlatform'],
9787c5f4 27 }
28
29 def _real_extract(self, url):
30 video_id = self._match_id(url)
31 webpage = self._download_webpage(url, video_id)
32
33 release_url = self._parse_json(self._search_regex(
34 r'"fox_pdk_player"\s*:\s*({[^}]+?})', webpage, 'fox_pdk_player'),
e37b54b1 35 video_id)['release_url']
9787c5f4 36
37 return {
38 '_type': 'url_transparent',
39 'ie_key': 'ThePlatform',
e37b54b1
RA
40 'url': smuggle_url(update_url_query(
41 release_url, {'switch': 'http'}), {'force_smil_url': True}),
9787c5f4 42 'id': video_id,
43 }