From 12814567cab2ac0b60b980d6f49c53ef2187c390 Mon Sep 17 00:00:00 2001 From: Joshua Lochner Date: Fri, 13 Dec 2019 01:09:36 +0200 Subject: [PATCH 1/7] Regex added --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/gamerdvr.py | 38 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 youtube_dl/extractor/gamerdvr.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index fd93730fa..2cd944498 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -396,6 +396,7 @@ from .fusion import FusionIE from .fxnetworks import FXNetworksIE from .gaia import GaiaIE from .gameinformer import GameInformerIE +from .gamerdvr import GamerDVRIE from .gamespot import GameSpotIE from .gamestar import GameStarIE from .gaskrank import GaskrankIE diff --git a/youtube_dl/extractor/gamerdvr.py b/youtube_dl/extractor/gamerdvr.py new file mode 100644 index 000000000..e893e9c8a --- /dev/null +++ b/youtube_dl/extractor/gamerdvr.py @@ -0,0 +1,38 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class GamerDVRIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?gamerdvr\.com/gamer/\S+/video/(?P\d+)' + _TEST = { + 'url': 'https://gamerdvr.com/gamer/videogamer3/video/82254474', + 'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)', + 'info_dict': { + 'id': '42', + 'ext': 'mp4', + 'title': 'Video title goes here', + 'thumbnail': r're:^https?://.*\.jpg$', + # TODO more properties, either as: + # * A value + # * MD5 checksum; start the string with md5: + # * A regular expression; start the string with re: + # * Any Python type (for example int or float) + } + } + + def _real_extract(self, url): + # video_id = self._match_id(url) + # webpage = self._download_webpage(url, video_id) + + # # TODO more code goes here, for example ... + # title = self._html_search_regex(r'

(.+?)

', webpage, 'title') + + return { + 'id': 'id goes here', + 'title': 'title goes here', + 'description': 'desc goes here', + 'uploader': 'uploader goes here', + # TODO more properties (see youtube_dl/extractor/common.py) + } \ No newline at end of file From ec80366ebc9e092a42a7bb29e00cd67c14db7fb2 Mon Sep 17 00:00:00 2001 From: Joshua Lochner Date: Fri, 13 Dec 2019 03:30:03 +0200 Subject: [PATCH 2/7] Added URL --- youtube_dl/extractor/gamerdvr.py | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/youtube_dl/extractor/gamerdvr.py b/youtube_dl/extractor/gamerdvr.py index e893e9c8a..d9fd7e885 100644 --- a/youtube_dl/extractor/gamerdvr.py +++ b/youtube_dl/extractor/gamerdvr.py @@ -7,13 +7,14 @@ from .common import InfoExtractor class GamerDVRIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?gamerdvr\.com/gamer/\S+/video/(?P\d+)' _TEST = { - 'url': 'https://gamerdvr.com/gamer/videogamer3/video/82254474', - 'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)', + 'url': 'https://gamerdvr.com/gamer/videogamer3/video/83193307', + 'md5': 'f747c74fbc7617a70d8c071927623cde', #a716d4561cf5a2ac373a5deda4d89a47 'info_dict': { - 'id': '42', + 'id': '83193307', 'ext': 'mp4', - 'title': 'Video title goes here', - 'thumbnail': r're:^https?://.*\.jpg$', + 'title': "videogamer3's Xbox Call of Duty®: Modern Warfare® clip 83193307. Find your Xbox clips on GamerDVR.com", + 'description': "videogamer3's Xbox Call of Duty®: Modern Warfare® clips and gameplay playing Call of Duty®: Modern Warfare®. All your Xbox clips and screenshots on GamerDVR.com. View, manage, and share easily!", + 'uploader': 'videogamer3', # TODO more properties, either as: # * A value # * MD5 checksum; start the string with md5: @@ -23,16 +24,21 @@ class GamerDVRIE(InfoExtractor): } def _real_extract(self, url): - # video_id = self._match_id(url) - # webpage = self._download_webpage(url, video_id) + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + video_url = self._html_search_regex(r"(.+?)', webpage, 'title') - + title = self._html_search_regex(r'(.+?)', webpage, 'title') + + + description = self._html_search_regex(r" Date: Fri, 13 Dec 2019 03:45:41 +0200 Subject: [PATCH 3/7] Cleaning --- youtube_dl/extractor/gamerdvr.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/youtube_dl/extractor/gamerdvr.py b/youtube_dl/extractor/gamerdvr.py index d9fd7e885..b8529a2c7 100644 --- a/youtube_dl/extractor/gamerdvr.py +++ b/youtube_dl/extractor/gamerdvr.py @@ -8,30 +8,21 @@ class GamerDVRIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?gamerdvr\.com/gamer/\S+/video/(?P\d+)' _TEST = { 'url': 'https://gamerdvr.com/gamer/videogamer3/video/83193307', - 'md5': 'f747c74fbc7617a70d8c071927623cde', #a716d4561cf5a2ac373a5deda4d89a47 + 'md5': 'f747c74fbc7617a70d8c071927623cde', 'info_dict': { 'id': '83193307', 'ext': 'mp4', 'title': "videogamer3's Xbox Call of Duty®: Modern Warfare® clip 83193307. Find your Xbox clips on GamerDVR.com", 'description': "videogamer3's Xbox Call of Duty®: Modern Warfare® clips and gameplay playing Call of Duty®: Modern Warfare®. All your Xbox clips and screenshots on GamerDVR.com. View, manage, and share easily!", - 'uploader': 'videogamer3', - # TODO more properties, either as: - # * A value - # * MD5 checksum; start the string with md5: - # * A regular expression; start the string with re: - # * Any Python type (for example int or float) + 'uploader': 'videogamer3' } } def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - video_url = self._html_search_regex(r"(.+?)', webpage, 'title') - - description = self._html_search_regex(r" Date: Fri, 13 Dec 2019 03:45:58 +0200 Subject: [PATCH 4/7] Cleaning --- youtube_dl/extractor/gamerdvr.py | 1 - 1 file changed, 1 deletion(-) diff --git a/youtube_dl/extractor/gamerdvr.py b/youtube_dl/extractor/gamerdvr.py index b8529a2c7..52f463d7b 100644 --- a/youtube_dl/extractor/gamerdvr.py +++ b/youtube_dl/extractor/gamerdvr.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals from .common import InfoExtractor - class GamerDVRIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?gamerdvr\.com/gamer/\S+/video/(?P\d+)' _TEST = { From c42551d3db974bcf4288ba1366e6561644e650b2 Mon Sep 17 00:00:00 2001 From: Joshua Lochner Date: Fri, 13 Dec 2019 04:04:15 +0200 Subject: [PATCH 5/7] Conforming to PEP8 (Flake8) --- youtube_dl/extractor/gamerdvr.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/youtube_dl/extractor/gamerdvr.py b/youtube_dl/extractor/gamerdvr.py index 52f463d7b..a37006866 100644 --- a/youtube_dl/extractor/gamerdvr.py +++ b/youtube_dl/extractor/gamerdvr.py @@ -3,16 +3,22 @@ from __future__ import unicode_literals from .common import InfoExtractor + class GamerDVRIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?gamerdvr\.com/gamer/\S+/video/(?P\d+)' + _VALID_URL = r'https?://(?:www\.)?gamerdvr\.com' + + '/gamer/\S+/video/(?P\d+)' _TEST = { 'url': 'https://gamerdvr.com/gamer/videogamer3/video/83193307', 'md5': 'f747c74fbc7617a70d8c071927623cde', 'info_dict': { 'id': '83193307', 'ext': 'mp4', - 'title': "videogamer3's Xbox Call of Duty®: Modern Warfare® clip 83193307. Find your Xbox clips on GamerDVR.com", - 'description': "videogamer3's Xbox Call of Duty®: Modern Warfare® clips and gameplay playing Call of Duty®: Modern Warfare®. All your Xbox clips and screenshots on GamerDVR.com. View, manage, and share easily!", + 'title': "videogamer3's Xbox Call of Duty®: Modern Warfare® " + + "clip 83193307. Find your Xbox clips on GamerDVR.com", + 'description': "videogamer3's Xbox Call of Duty®: Modern " + + "Warfare® clips and gameplay playing Call of Duty®: Modern " + + "Warfare®. All your Xbox clips and screenshots on GamerDVR.com. " + + "View, manage, and share easily!", 'uploader': 'videogamer3' } } @@ -20,14 +26,19 @@ class GamerDVRIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - video_url = self._html_search_regex(r"(.+?)', webpage, 'title') - description = self._html_search_regex(r"(.+?)', webpage, 'title') + description = self._html_search_regex( + r" Date: Fri, 13 Dec 2019 04:06:57 +0200 Subject: [PATCH 6/7] Fix operator --- youtube_dl/extractor/gamerdvr.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/youtube_dl/extractor/gamerdvr.py b/youtube_dl/extractor/gamerdvr.py index a37006866..48b81fb53 100644 --- a/youtube_dl/extractor/gamerdvr.py +++ b/youtube_dl/extractor/gamerdvr.py @@ -13,12 +13,8 @@ class GamerDVRIE(InfoExtractor): 'info_dict': { 'id': '83193307', 'ext': 'mp4', - 'title': "videogamer3's Xbox Call of Duty®: Modern Warfare® " + - "clip 83193307. Find your Xbox clips on GamerDVR.com", - 'description': "videogamer3's Xbox Call of Duty®: Modern " + - "Warfare® clips and gameplay playing Call of Duty®: Modern " + - "Warfare®. All your Xbox clips and screenshots on GamerDVR.com. " + - "View, manage, and share easily!", + 'title': "videogamer3's Xbox Call of Duty®: Modern Warfare® clip 83193307. Find your Xbox clips on GamerDVR.com", + 'description': "videogamer3's Xbox Call of Duty®: Modern Warfare® clips and gameplay playing Call of Duty®: Modern Warfare®. All your Xbox clips and screenshots on GamerDVR.com. View, manage, and share easily!", 'uploader': 'videogamer3' } } From 3fc187d07f58b75d551c8fa5bab46a8397283b8b Mon Sep 17 00:00:00 2001 From: Joshua Lochner Date: Fri, 13 Dec 2019 04:20:45 +0200 Subject: [PATCH 7/7] Syntax fix --- youtube_dl/extractor/gamerdvr.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/youtube_dl/extractor/gamerdvr.py b/youtube_dl/extractor/gamerdvr.py index 48b81fb53..eb6c3ecd1 100644 --- a/youtube_dl/extractor/gamerdvr.py +++ b/youtube_dl/extractor/gamerdvr.py @@ -5,8 +5,7 @@ from .common import InfoExtractor class GamerDVRIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?gamerdvr\.com' + - '/gamer/\S+/video/(?P\d+)' + _VALID_URL = r'https?://(?:www\.)?gamerdvr\.com/gamer/\S+/video/(?P\d+)' _TEST = { 'url': 'https://gamerdvr.com/gamer/videogamer3/video/83193307', 'md5': 'f747c74fbc7617a70d8c071927623cde',