YouTube dependency fix youtube_dl==2020.12.2 (#6612)

Per https://github.com/ultralytics/yolov5/issues/5860#issuecomment-1035320018 by @hdnh2006
This commit is contained in:
Glenn Jocher 2022-02-11 13:46:20 +01:00 committed by GitHub
parent cb2ad9f685
commit b40bdd6b2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -301,7 +301,7 @@ class LoadStreams:
# Start thread to read frames from video stream
st = f'{i + 1}/{n}: {s}... '
if 'youtube.com/' in s or 'youtu.be/' in s: # if source is YouTube video
check_requirements(('git+https://github.com/Cupcakus/pafy', 'youtube_dl'))
check_requirements(('pafy', 'youtube_dl==2020.12.2'))
import pafy
s = pafy.new(s).getbest(preftype="mp4").url # YouTube URL
s = eval(s) if s.isnumeric() else s # i.e. s = '0' local webcam