1 from __future__ import unicode_literals
5 from .common import InfoExtractor
11 class CrooksAndLiarsIE(InfoExtractor):
12 _VALID_URL = r'(?:https?:)?//embed.crooksandliars.com/embed/(?P<id>[A-Za-z0-9]+)(?:$|[?#])'
15 'url': 'https://embed.crooksandliars.com/embed/8RUoRhRi',
17 'id': 'https://embed.crooksandliars.com/embed/8RUoRhRi',
18 'title': "Fox & Friends Says Protecting Atheists From Discrimination Is Anti-Christian!",
19 'description': "Fox News, Fox & Friends Weekend, April 4, 2015. Read more... http://crooksandliars.com/2015/04/fox-friends-says-protecting-atheists",
20 'timestamp': 1428207000,
21 'thumbnail': 'https://crooksandliars.com/files/mediaposters/2015/04/31235.jpg?ts=1428207050',
22 'uploader': "Heather",
26 def _real_extract(self, url):
27 video_id = self._match_id(url)
28 webpage = self._download_webpage(url, video_id)
30 manifest = json.loads(self._html_search_regex(r'var manifest = ({.*?})\n', webpage, 'manifest JSON'))
33 for item in manifest['flavors']:
34 if not item['mime'].startswith('video/'): # XXX: or item['exclude']?
37 'format_id': item['type'],
38 'ext': mimetype2ext(item['mime']),
42 # XXX: manifest['url']?
46 'uploader': manifest['author'],
47 'title': manifest['title'],
48 'description': manifest['description'],
49 'thumbnail': self._proto_relative_url(manifest['poster']),
50 'duration': manifest['duration'],
51 'timestamp': int(manifest['created']),
55 class CrooksAndLiarsArticleIE(InfoExtractor):
56 _VALID_URL = r'(?:https?:)?//crooksandliars.com/\d+/\d+/(?P<id>[a-z\-]+)(?:/|$)'
59 'url': 'http://crooksandliars.com/2015/04/fox-friends-says-protecting-atheists',
60 'only_matching': True,
63 def _real_extract(self, url):
64 video_id = self._match_id(url)
65 webpage = self._download_webpage(url, video_id)
66 player_url = self._proto_relative_url(self._html_search_regex(r'<iframe src="(//embed.crooksandliars.com/.*)"', webpage, 'embedded player'))