From 17e88a3f02a699b2d44f019019c97e52c5016cd2 Mon Sep 17 00:00:00 2001 From: nobody Date: Wed, 9 Oct 2019 10:34:11 -0500 Subject: [PATCH 1/5] [veoh] Extend _VALID_URL to accept '/videos/' --- youtube_dl/extractor/veoh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/veoh.py b/youtube_dl/extractor/veoh.py index 1c44c145c..0e3c6eb9d 100644 --- a/youtube_dl/extractor/veoh.py +++ b/youtube_dl/extractor/veoh.py @@ -9,7 +9,7 @@ from ..utils import ( class VeohIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?veoh\.com/(?:watch|embed|iphone/#_Watch)/(?P(?:v|e|yapi-)[\da-zA-Z]+)' + _VALID_URL = r'https?://(?:www\.)?veoh\.com/(?:watch|videos|embed|iphone/#_Watch)/(?P(?:v|e|yapi-)[\da-zA-Z]+)' _TESTS = [{ 'url': 'http://www.veoh.com/watch/v56314296nk7Zdmz3', From 35c8462479f0b97992658f9e5818e177ca996486 Mon Sep 17 00:00:00 2001 From: nobody Date: Wed, 9 Oct 2019 11:05:47 -0500 Subject: [PATCH 2/5] [veoh] Prefer high quality --- youtube_dl/extractor/veoh.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/veoh.py b/youtube_dl/extractor/veoh.py index 0e3c6eb9d..f88db1de7 100644 --- a/youtube_dl/extractor/veoh.py +++ b/youtube_dl/extractor/veoh.py @@ -13,7 +13,7 @@ class VeohIE(InfoExtractor): _TESTS = [{ 'url': 'http://www.veoh.com/watch/v56314296nk7Zdmz3', - 'md5': '9e7ecc0fd8bbee7a69fe38953aeebd30', + 'md5': '620e68e6a3cff80086df3348426c9ca3', 'info_dict': { 'id': 'v56314296nk7Zdmz3', 'ext': 'mp4', @@ -74,7 +74,7 @@ class VeohIE(InfoExtractor): title = video['title'] thumbnail_url = None - q = qualities(['HQ', 'Regular']) + q = qualities(['Regular', 'HQ']) formats = [] for f_id, f_url in video.get('src', {}).items(): if not f_url: From 2e2104553b0e877330bc454ee0927184356365c4 Mon Sep 17 00:00:00 2001 From: nobody Date: Wed, 9 Oct 2019 10:35:55 -0500 Subject: [PATCH 3/5] [veoh] Extract more metadata --- youtube_dl/extractor/veoh.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/veoh.py b/youtube_dl/extractor/veoh.py index f88db1de7..bd05119ad 100644 --- a/youtube_dl/extractor/veoh.py +++ b/youtube_dl/extractor/veoh.py @@ -68,9 +68,10 @@ class VeohIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - video = self._download_json( + json = self._download_json( 'https://www.veoh.com/watch/getVideo/' + video_id, - video_id)['video'] + video_id) + video = json['video'] title = video['title'] thumbnail_url = None @@ -89,6 +90,8 @@ class VeohIE(InfoExtractor): }) self._sort_formats(formats) + tags = video.get('tags') + return { 'id': video_id, 'title': title, @@ -100,4 +103,7 @@ class VeohIE(InfoExtractor): 'formats': formats, 'average_rating': int_or_none(video.get('rating')), 'comment_count': int_or_none(video.get('numOfComments')), + 'age_limit': 18 if video.get('contentRatingId') == 2 else 0, + 'categories': json.get('categoryPath'), + 'tags': tags.split(', ') if tags else None, } From 1f8b64edc44c3dd4afd8217dbcad0214bcdbec05 Mon Sep 17 00:00:00 2001 From: nobody Date: Wed, 9 Oct 2019 11:06:15 -0500 Subject: [PATCH 4/5] [veoh] Add test --- youtube_dl/extractor/veoh.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/youtube_dl/extractor/veoh.py b/youtube_dl/extractor/veoh.py index bd05119ad..9897cfb6f 100644 --- a/youtube_dl/extractor/veoh.py +++ b/youtube_dl/extractor/veoh.py @@ -51,6 +51,21 @@ class VeohIE(InfoExtractor): }, { 'url': 'http://www.veoh.com/watch/e152215AJxZktGS', 'only_matching': True, + }, { + 'url': 'https://www.veoh.com/videos/v16374379WA437rMH', + 'md5': 'cceb73f3909063d64f4b93d4defca1b3', + 'info_dict': { + 'id': 'v16374379WA437rMH', + 'ext': 'mp4', + 'title': 'Phantasmagoria 2, pt. 1-3', + 'description': 'Phantasmagoria: a Puzzle of Flesh', + 'thumbnail': 'https://fcache.veoh.com/file/f/th16374379.jpg?h=b87b6851eaa47c9421c95ee8d9ffa7ff', + 'uploader': 'davidspackage', + 'duration': 968, + 'age_limit': 18, + 'categories': ['technology_and_gaming', 'gaming'], + 'tags': ['puzzle', 'of', 'flesh'], + }, }] def _extract_video(self, source): From 294caf43d6d33a19fc5cb4fd79ec767bc9429fc4 Mon Sep 17 00:00:00 2001 From: nobody Date: Wed, 9 Oct 2019 10:37:05 -0500 Subject: [PATCH 5/5] [veoh] Remove old _extract_video --- youtube_dl/extractor/veoh.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/youtube_dl/extractor/veoh.py b/youtube_dl/extractor/veoh.py index 9897cfb6f..e8c859601 100644 --- a/youtube_dl/extractor/veoh.py +++ b/youtube_dl/extractor/veoh.py @@ -68,19 +68,6 @@ class VeohIE(InfoExtractor): }, }] - def _extract_video(self, source): - return { - 'id': source.get('videoId'), - 'title': source.get('title'), - 'description': source.get('description'), - 'thumbnail': source.get('highResImage') or source.get('medResImage'), - 'uploader': source.get('username'), - 'duration': int_or_none(source.get('length')), - 'view_count': int_or_none(source.get('views')), - 'age_limit': 18 if source.get('isMature') == 'true' or source.get('isSexy') == 'true' else 0, - 'formats': self._extract_formats(source), - } - def _real_extract(self, url): video_id = self._match_id(url) json = self._download_json(