File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -812,6 +812,11 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
812
812
},
813
813
'skip' : 'This video does not exist.' ,
814
814
},
815
+ {
816
+ # Video with incomplete 'yt:stretch=16:'
817
+ 'url' : 'https://www.youtube.com/watch?v=FRhJzUSJbGI' ,
818
+ 'only_matching' : True ,
819
+ },
815
820
{
816
821
# Video licensed under Creative Commons
817
822
'url' : 'https://www.youtube.com/watch?v=M4gD1WSo5mA' ,
@@ -1717,13 +1722,16 @@ def feed_entry(name):
1717
1722
for m in re .finditer (self ._meta_regex ('og:video:tag' ), webpage )]
1718
1723
for keyword in keywords :
1719
1724
if keyword .startswith ('yt:stretch=' ):
1720
- w , h = keyword .split ('=' )[1 ].split (':' )
1721
- w , h = int (w ), int (h )
1722
- if w > 0 and h > 0 :
1723
- ratio = w / h
1724
- for f in formats :
1725
- if f .get ('vcodec' ) != 'none' :
1726
- f ['stretched_ratio' ] = ratio
1725
+ mobj = re .search (r'(\d+)\s*:\s*(\d+)' , keyword )
1726
+ if mobj :
1727
+ # NB: float is intentional for forcing float division
1728
+ w , h = (float (v ) for v in mobj .groups ())
1729
+ if w > 0 and h > 0 :
1730
+ ratio = w / h
1731
+ for f in formats :
1732
+ if f .get ('vcodec' ) != 'none' :
1733
+ f ['stretched_ratio' ] = ratio
1734
+ break
1727
1735
1728
1736
thumbnails = []
1729
1737
for container in (video_details , microformat ):
You can’t perform that action at this time.
0 commit comments