Fix PIL Image exif_size() function (#4355)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
c940d29d4f
commit
834f94f899
6 changed files with 55 additions and 23 deletions
|
|
@ -405,14 +405,14 @@ def get_best_youtube_url(url, use_pafy=True):
|
|||
if use_pafy:
|
||||
check_requirements(('pafy', 'youtube_dl==2020.12.2'))
|
||||
import pafy # noqa
|
||||
return pafy.new(url).getbest(preftype='mp4').url
|
||||
return pafy.new(url).getbestvideo(preftype='mp4').url
|
||||
else:
|
||||
check_requirements('yt-dlp')
|
||||
import yt_dlp
|
||||
with yt_dlp.YoutubeDL({'quiet': True}) as ydl:
|
||||
info_dict = ydl.extract_info(url, download=False) # extract info
|
||||
for f in info_dict.get('formats', None):
|
||||
if f['vcodec'] != 'none' and f['acodec'] == 'none' and f['ext'] == 'mp4':
|
||||
if f['vcodec'] != 'none' and f['acodec'] == 'none' and f['ext'] == 'mp4' and f.get('width') > 1280:
|
||||
return f.get('url', None)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue