2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..compat import compat_urllib_request
8 from ..utils import ExtractorError
11 class VoiceRepublicIE(InfoExtractor):
12 _VALID_URL = r'https?://voicerepublic\.com/talks/(?P<id>[0-9a-z-]+)'
14 'url': 'https://voicerepublic.com/talks/watching-the-watchers-building-a-sousveillance-state',
15 'md5': '0554a24d1657915aa8e8f84e15dc9353',
19 'title': 'Watching the Watchers: Building a Sousveillance State',
20 'thumbnail': 'https://voicerepublic.com/system/flyer/2296.png',
21 'description': 'md5:715ba964958afa2398df615809cfecb1',
25 def _real_extract(self, url):
26 display_id = self._match_id(url)
27 req = compat_urllib_request.Request(url)
28 # Older versions of Firefox get redirected to an "upgrade browser" page
29 req.add_header('User-Agent', 'youtube-dl')
30 webpage = self._download_webpage(req, display_id)
31 thumbnail = self._og_search_thumbnail(webpage)
32 video_id = self._search_regex(r'/(\d+)\.png', thumbnail, 'id')
34 if '<a>Queued for processing, please stand by...</a>' in webpage:
35 raise ExtractorError('Audio is still queued for processing')
37 ext_matches = re.finditer(r'data-\w+=\'/vrmedia/\d+-clean\.(\w+)\'', webpage)
38 exts = [match.group(1) for match in ext_matches]
41 'url': 'https://voicerepublic.com/vrmedia/{}-clean.{}'.format(video_id, ext),
46 self._sort_formats(formats)
50 'title': self._og_search_title(webpage),
52 'url': self._og_search_url(webpage),
53 'thumbnail': thumbnail,
54 'description': self._og_search_description(webpage),