[picarto] Fix broken extractor

This commit is contained in:
LiquidFay 2018-11-11 03:31:42 -05:00
parent 83852e57bf
commit cc1e9cccef

View File

@ -33,18 +33,14 @@ class PicartoIE(InfoExtractor):
return False if PicartoVodIE.suitable(url) else super(PicartoIE, cls).suitable(url) return False if PicartoVodIE.suitable(url) else super(PicartoIE, cls).suitable(url)
def _real_extract(self, url): def _real_extract(self, url):
channel_id = self._match_id(url) fetch_id = self._match_id(url)
stream_page = self._download_webpage(url, channel_id) try:
player = self._download_json("https://api.picarto.tv/v1/channel/name/%s"
if '>This channel does not exist' in stream_page: % fetch_id,fetch_id)
except:
raise ExtractorError( raise ExtractorError(
'Channel %s does not exist' % channel_id, expected=True) 'Channel %s does not exist' % fetch_id, expected=True)
channel_id = player.get('name')
player = self._parse_json(
self._search_regex(
r'(?s)playerSettings\[\d+\]\s*=\s*(\{.+?\}\s*\n)', stream_page,
'player settings'),
channel_id, transform_source=js_to_json)
if player.get('online') is False: if player.get('online') is False:
raise ExtractorError('Stream is offline', expected=True) raise ExtractorError('Stream is offline', expected=True)