2015-04-06 07:54:19 +00:00
|
|
|
from .common import InfoExtractor
|
|
|
|
from ..utils import (
|
2015-04-11 14:03:12 +00:00
|
|
|
int_or_none,
|
|
|
|
qualities,
|
2015-04-06 07:54:19 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class CrooksAndLiarsIE(InfoExtractor):
|
2015-04-11 14:03:12 +00:00
|
|
|
_VALID_URL = r'https?://embed\.crooksandliars\.com/(?:embed|v)/(?P<id>[A-Za-z0-9]+)'
|
2022-08-01 01:23:25 +00:00
|
|
|
_EMBED_REGEX = [r'<(?:iframe[^>]+src|param[^>]+value)=(["\'])(?P<url>(?:https?:)?//embed\.crooksandliars\.com/(?:embed|v)/.+?)\1']
|
|
|
|
|
2015-04-06 07:54:19 +00:00
|
|
|
_TESTS = [{
|
|
|
|
'url': 'https://embed.crooksandliars.com/embed/8RUoRhRi',
|
|
|
|
'info_dict': {
|
2015-04-11 14:03:12 +00:00
|
|
|
'id': '8RUoRhRi',
|
|
|
|
'ext': 'mp4',
|
2015-04-11 14:27:39 +00:00
|
|
|
'title': 'Fox & Friends Says Protecting Atheists From Discrimination Is Anti-Christian!',
|
2015-04-11 14:03:12 +00:00
|
|
|
'description': 'md5:e1a46ad1650e3a5ec7196d432799127f',
|
2017-01-02 12:08:07 +00:00
|
|
|
'thumbnail': r're:^https?://.*\.jpg',
|
2015-04-06 07:54:19 +00:00
|
|
|
'timestamp': 1428207000,
|
2015-04-11 14:03:12 +00:00
|
|
|
'upload_date': '20150405',
|
|
|
|
'uploader': 'Heather',
|
|
|
|
'duration': 236,
|
2015-04-06 07:54:19 +00:00
|
|
|
}
|
2015-04-11 14:03:12 +00:00
|
|
|
}, {
|
|
|
|
'url': 'http://embed.crooksandliars.com/v/MTE3MjUtMzQ2MzA',
|
|
|
|
'only_matching': True,
|
2015-04-06 07:54:19 +00:00
|
|
|
}]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
|
2015-04-11 14:03:12 +00:00
|
|
|
webpage = self._download_webpage(
|
|
|
|
'http://embed.crooksandliars.com/embed/%s' % video_id, video_id)
|
|
|
|
|
2024-02-13 03:11:40 +00:00
|
|
|
manifest = self._search_json(r'var\s+manifest\s*=', webpage, 'manifest JSON', video_id)
|
2015-04-06 07:54:19 +00:00
|
|
|
|
2015-04-11 14:03:12 +00:00
|
|
|
quality = qualities(('webm_low', 'mp4_low', 'webm_high', 'mp4_high'))
|
|
|
|
|
|
|
|
formats = [{
|
|
|
|
'url': item['url'],
|
|
|
|
'format_id': item['type'],
|
|
|
|
'quality': quality(item['type']),
|
|
|
|
} for item in manifest['flavors'] if item['mime'].startswith('video/')]
|
2015-04-06 07:54:19 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
'url': url,
|
|
|
|
'id': video_id,
|
|
|
|
'title': manifest['title'],
|
2015-04-11 14:03:12 +00:00
|
|
|
'description': manifest.get('description'),
|
|
|
|
'thumbnail': self._proto_relative_url(manifest.get('poster')),
|
|
|
|
'timestamp': int_or_none(manifest.get('created')),
|
|
|
|
'uploader': manifest.get('author'),
|
|
|
|
'duration': int_or_none(manifest.get('duration')),
|
2015-04-06 07:54:19 +00:00
|
|
|
'formats': formats,
|
|
|
|
}
|