File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,10 @@ def _find_video_id(self, url):
255
255
log .debug ("Video ID from currentVideoEndpoint" )
256
256
return video_id
257
257
for x in search_dict (data , 'videoRenderer' ):
258
+ if x .get ("viewCountText" , {}).get ("runs" ):
259
+ if x .get ("videoId" ):
260
+ log .debug ("Video ID from videoRenderer (live)" )
261
+ return x ["videoId" ]
258
262
for bstyle in search_dict (x .get ("badges" , {}), "style" ):
259
263
if bstyle == "BADGE_STYLE_TYPE_LIVE_NOW" :
260
264
if x .get ("videoId" ):
@@ -266,8 +270,12 @@ def _find_video_id(self, url):
266
270
if link .attributes .get ("rel" ) == "canonical" :
267
271
canon_link = link .attributes .get ("href" )
268
272
if canon_link != url :
269
- log .debug ("Re-directing to canonical URL: {0}" .format (canon_link ))
270
- return self ._find_video_id (canon_link )
273
+ if canon_link .endswith ("v=live_stream" ):
274
+ log .debug ("The video is not available" )
275
+ break
276
+ else :
277
+ log .debug ("Re-directing to canonical URL: {0}" .format (canon_link ))
278
+ return self ._find_video_id (canon_link )
271
279
272
280
raise PluginError ("Could not find a video on this page" )
273
281
You can’t perform that action at this time.
0 commit comments