2 from __future__ import unicode_literals
6 from .common import InfoExtractor
9 class GamersydeIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?gamersyde\.com/hqstream_'
11 'url': 'http://www.gamersyde.com/hqstream_bloodborne_birth_of_a_hero-34371_en.html',
12 'md5': 'f38d400d32f19724570040d5ce3a505f',
16 'title': 'Bloodborne - Birth of a hero',
17 'thumbnail': 're:^https?://.*\.jpg$',
21 'url': 'http://www.gamersyde.com/hqstream_dark_souls_ii_scholar_of_the_first_sin_gameplay_part_1-34417_en.html',
26 def _calculateDuration(self, durationString):
27 duration = time.strptime(durationString, "%M minutes %S seconds")
28 return duration.tm_min * 60 + duration.tm_sec
30 def _fixJsonSyntax(self, json):
32 json = re.sub(r"{\s*(\w)", r'{"\1', json)
33 json = re.sub(r",\s*(\w)", r',"\1', json)
34 json = re.sub(r",\s*}", "}", json, flags=re.DOTALL)
35 json = re.sub(r",\s*]", "]", json, flags=re.DOTALL)
39 def _real_extract(self, url):
41 video_id = self._search_regex(r'-(.*?)_[a-z]{2}.html$', url, 'video_id')
42 webpage = self._download_webpage(url, video_id)
44 filesJson = self._search_regex(r'playlist: (.*?)\}\);', webpage, 'files', flags=re.DOTALL)
45 filesJson = self._fixJsonSyntax(filesJson)
46 data = json.loads(filesJson)
51 title = re.sub(r"[0-9]+ - ", "", playlist['title'])
53 for playlistEntry in playlist['sources']:
55 'url': playlistEntry['file'],
56 'format_id': playlistEntry['label']
59 formats.append(format)
65 'thumbnail': playlist['image']