|
|
|
|
|
|
|
|
for i, s in enumerate(sources): # index, source |
|
|
for i, s in enumerate(sources): # index, source |
|
|
# Start thread to read frames from video stream |
|
|
# Start thread to read frames from video stream |
|
|
st = f'{i + 1}/{n}: {s}... ' |
|
|
st = f'{i + 1}/{n}: {s}... ' |
|
|
if urlparse(s).hostname in ('youtube.com', 'youtu.be'): # if source is YouTube video |
|
|
|
|
|
|
|
|
if urlparse(s).hostname in ('www.youtube.com', 'youtube.com', 'youtu.be'): # if source is YouTube video |
|
|
check_requirements(('pafy', 'youtube_dl==2020.12.2')) |
|
|
check_requirements(('pafy', 'youtube_dl==2020.12.2')) |
|
|
import pafy |
|
|
import pafy |
|
|
s = pafy.new(s).getbest(preftype="mp4").url # YouTube URL |
|
|
s = pafy.new(s).getbest(preftype="mp4").url # YouTube URL |