From 28c875d3ce4db09ed2dc76c4c35ff0ef887c8f1a Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 1 Apr 2022 21:35:02 +0200 Subject: [PATCH 1/2] Fix `www.youtube.com` hostname --- utils/datasets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/datasets.py b/utils/datasets.py index 7e8b423c3174..8700f37ff763 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -316,7 +316,7 @@ def __init__(self, sources='streams.txt', img_size=640, stride=32, auto=True): for i, s in enumerate(sources): # index, source # Start thread to read frames from video stream 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', '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 From bfe9007b2cd4c08d44ff6640c3ad73ee4a5fbf07 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 1 Apr 2022 21:37:40 +0200 Subject: [PATCH 2/2] Update datasets.py --- utils/datasets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/datasets.py b/utils/datasets.py index 8700f37ff763..b2d4fa54ae0d 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -316,7 +316,7 @@ def __init__(self, sources='streams.txt', img_size=640, stride=32, auto=True): for i, s in enumerate(sources): # index, source # Start thread to read frames from video stream st = f'{i + 1}/{n}: {s}... ' - if urlparse(s).hostname in ('www.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')) import pafy s = pafy.new(s).getbest(preftype="mp4").url # YouTube URL