[picarto] Use API to extract info
This is just more reliable than trying to extract it from the page itself.
This commit is contained in:
parent
b89ac53455
commit
9d36db1fd5
@ -35,6 +35,9 @@ class PicartoIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
channel_id = self._match_id(url)
|
channel_id = self._match_id(url)
|
||||||
stream_page = self._download_webpage(url, channel_id)
|
stream_page = self._download_webpage(url, channel_id)
|
||||||
|
metadata = self._download_json(
|
||||||
|
'https://api.picarto.tv/v1/channel/name/' + channel_id,
|
||||||
|
channel_id)
|
||||||
|
|
||||||
if '>This channel does not exist' in stream_page:
|
if '>This channel does not exist' in stream_page:
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
@ -46,7 +49,7 @@ class PicartoIE(InfoExtractor):
|
|||||||
'player settings'),
|
'player settings'),
|
||||||
channel_id, transform_source=js_to_json)
|
channel_id, transform_source=js_to_json)
|
||||||
|
|
||||||
if player.get('online') is False:
|
if metadata.get('online') is False:
|
||||||
raise ExtractorError('Stream is offline', expected=True)
|
raise ExtractorError('Stream is offline', expected=True)
|
||||||
|
|
||||||
cdn_data = self._download_json(
|
cdn_data = self._download_json(
|
||||||
@ -109,7 +112,7 @@ class PicartoIE(InfoExtractor):
|
|||||||
continue
|
continue
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
mature = player.get('mature')
|
mature = metadata.get('adult')
|
||||||
if mature is None:
|
if mature is None:
|
||||||
age_limit = None
|
age_limit = None
|
||||||
else:
|
else:
|
||||||
@ -119,7 +122,7 @@ class PicartoIE(InfoExtractor):
|
|||||||
'id': channel_id,
|
'id': channel_id,
|
||||||
'title': self._live_title(channel_id),
|
'title': self._live_title(channel_id),
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
'thumbnail': player.get('vodThumb'),
|
'thumbnail': metadata.get('thumbnails', {}).get('web'),
|
||||||
'age_limit': age_limit,
|
'age_limit': age_limit,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user