|
|
@@ -15,6 +15,7 @@ from itertools import repeat |
|
|
|
from multiprocessing.pool import Pool, ThreadPool |
|
|
|
from pathlib import Path |
|
|
|
from threading import Thread |
|
|
|
from urllib.parse import urlparse |
|
|
|
from zipfile import ZipFile |
|
|
|
|
|
|
|
import cv2 |
|
|
@@ -301,7 +302,7 @@ class LoadStreams: |
|
|
|
for i, s in enumerate(sources): # index, source |
|
|
|
# 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 |
|
|
|
if urlparse(s).hostname in ('youtube.com', 'youtu.be'): # if source is YouTube video |
|
|
|
check_requirements(('pafy', 'youtube_dl==2020.12.2')) |
|
|
|
import pafy |
|
|
|
s = pafy.new(s).getbest(preftype="mp4").url # YouTube URL |