mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 16:53:56 +03:00
[youtube] fix dash-mpd for live streams (no yt:contentLength field)
This commit is contained in:
parent
e65c2d23a0
commit
03266c030a
@ -258,11 +258,17 @@ class YouTube(VideoExtractor):
|
|||||||
burls = rep.getElementsByTagName('BaseURL')
|
burls = rep.getElementsByTagName('BaseURL')
|
||||||
dash_mp4_a_url = burls[0].firstChild.nodeValue
|
dash_mp4_a_url = burls[0].firstChild.nodeValue
|
||||||
dash_mp4_a_size = burls[0].getAttribute('yt:contentLength')
|
dash_mp4_a_size = burls[0].getAttribute('yt:contentLength')
|
||||||
|
if not dash_mp4_a_size:
|
||||||
|
try: dash_mp4_a_size = url_size(dash_mp4_a_url)
|
||||||
|
except: continue
|
||||||
elif mimeType == 'audio/webm':
|
elif mimeType == 'audio/webm':
|
||||||
rep = aset.getElementsByTagName('Representation')[-1]
|
rep = aset.getElementsByTagName('Representation')[-1]
|
||||||
burls = rep.getElementsByTagName('BaseURL')
|
burls = rep.getElementsByTagName('BaseURL')
|
||||||
dash_webm_a_url = burls[0].firstChild.nodeValue
|
dash_webm_a_url = burls[0].firstChild.nodeValue
|
||||||
dash_webm_a_size = burls[0].getAttribute('yt:contentLength')
|
dash_webm_a_size = burls[0].getAttribute('yt:contentLength')
|
||||||
|
if not dash_webm_a_size:
|
||||||
|
try: dash_webm_a_size = url_size(dash_webm_a_url)
|
||||||
|
except: continue
|
||||||
elif mimeType == 'video/mp4':
|
elif mimeType == 'video/mp4':
|
||||||
for rep in aset.getElementsByTagName('Representation'):
|
for rep in aset.getElementsByTagName('Representation'):
|
||||||
w = int(rep.getAttribute('width'))
|
w = int(rep.getAttribute('width'))
|
||||||
@ -271,6 +277,9 @@ class YouTube(VideoExtractor):
|
|||||||
burls = rep.getElementsByTagName('BaseURL')
|
burls = rep.getElementsByTagName('BaseURL')
|
||||||
dash_url = burls[0].firstChild.nodeValue
|
dash_url = burls[0].firstChild.nodeValue
|
||||||
dash_size = burls[0].getAttribute('yt:contentLength')
|
dash_size = burls[0].getAttribute('yt:contentLength')
|
||||||
|
if not dash_size:
|
||||||
|
try: dash_size = url_size(dash_url)
|
||||||
|
except: continue
|
||||||
self.dash_streams[itag] = {
|
self.dash_streams[itag] = {
|
||||||
'quality': '%sx%s' % (w, h),
|
'quality': '%sx%s' % (w, h),
|
||||||
'itag': itag,
|
'itag': itag,
|
||||||
@ -288,6 +297,9 @@ class YouTube(VideoExtractor):
|
|||||||
burls = rep.getElementsByTagName('BaseURL')
|
burls = rep.getElementsByTagName('BaseURL')
|
||||||
dash_url = burls[0].firstChild.nodeValue
|
dash_url = burls[0].firstChild.nodeValue
|
||||||
dash_size = burls[0].getAttribute('yt:contentLength')
|
dash_size = burls[0].getAttribute('yt:contentLength')
|
||||||
|
if not dash_size:
|
||||||
|
try: dash_size = url_size(dash_url)
|
||||||
|
except: continue
|
||||||
self.dash_streams[itag] = {
|
self.dash_streams[itag] = {
|
||||||
'quality': '%sx%s' % (w, h),
|
'quality': '%sx%s' % (w, h),
|
||||||
'itag': itag,
|
'itag': itag,
|
||||||
|
Loading…
Reference in New Issue
Block a user