mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-13 18:57:22 +08:00
Be able to download videos directly from a Livesteam JSON feed.
Example URL: http://new.livestream.com/api/accounts/1504418/events/3705884/feed.json?&id=74703579&newer=-1&type=video
This commit is contained in:
parent
7be5a62ed7
commit
40e6e478b8
@ -134,9 +134,18 @@ class LivestreamIE(InfoExtractor):
|
||||
api_url, video_id, 'Downloading video info'))
|
||||
return self._extract_video_info(info)
|
||||
|
||||
config_json = self._search_regex(
|
||||
r'window.config = ({.*?});', webpage, 'window config')
|
||||
info = json.loads(config_json)['event']
|
||||
# Is this JSON?
|
||||
if webpage[0] == "{":
|
||||
info = json.loads(webpage)
|
||||
# We cannot tell this information from a JSON feed.
|
||||
info['id'] = 'unknown'
|
||||
info['full_name'] = 'unknown'
|
||||
# Change the JSON structure to match the window.config structure.
|
||||
info['feed'] = info
|
||||
else:
|
||||
config_json = self._search_regex(
|
||||
r'window.config = ({.*?});', webpage, 'window config')
|
||||
info = json.loads(config_json)['event']
|
||||
|
||||
def is_relevant(vdata, vid):
|
||||
result = vdata['type'] == 'video'
|
||||
@ -236,7 +245,7 @@ class LivestreamOriginalIE(InfoExtractor):
|
||||
class LivestreamShortenerIE(InfoExtractor):
|
||||
IE_NAME = 'livestream:shortener'
|
||||
IE_DESC = False # Do not list
|
||||
_VALID_URL = r'https?://livestre\.am/(?P<id>.+)'
|
||||
_VALID_URL = r'https?://(new\.)?livestre\.am/(?P<id>.+)'
|
||||
|
||||
def _real_extract(self, url):
|
||||
mobj = re.match(self._VALID_URL, url)
|
||||
|
Loading…
x
Reference in New Issue
Block a user