From: Sergey M․ Date: Sun, 21 Jun 2015 17:11:25 +0000 (+0600) Subject: [generic] Add support for xhamster embeds X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=2bb5b6d0a1671957c7a2e6d6433901b2a1b8f48f;p=youtube-dl [generic] Add support for xhamster embeds --- diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py index 07939b196..e108bde66 100644 --- a/youtube_dl/extractor/generic.py +++ b/youtube_dl/extractor/generic.py @@ -43,6 +43,7 @@ from .senateisvp import SenateISVPIE from .bliptv import BlipTVIE from .svt import SVTIE from .pornhub import PornHubIE +from .xhamster import XHamsterEmbedIE from .vimeo import VimeoIE from .dailymotion import DailymotionCloudIE @@ -1331,6 +1332,11 @@ class GenericIE(InfoExtractor): if pornhub_url: return self.url_result(pornhub_url, 'PornHub') + # Look for embedded XHamster player + xhamster_urls = XHamsterEmbedIE._extract_urls(webpage) + if xhamster_urls: + return _playlist_from_matches(xhamster_urls, ie='XHamsterEmbed') + # Look for embedded Tvigle player mobj = re.search( r']+?src=(["\'])(?P(?:https?:)?//cloud\.tvigle\.ru/video/.+?)\1', webpage) diff --git a/youtube_dl/extractor/xhamster.py b/youtube_dl/extractor/xhamster.py index ae3c5962b..725e01ac3 100644 --- a/youtube_dl/extractor/xhamster.py +++ b/youtube_dl/extractor/xhamster.py @@ -149,6 +149,12 @@ class XHamsterEmbedIE(InfoExtractor): } } + @staticmethod + def _extract_urls(webpage): + return [url for _, url in re.findall( + r']+?src=(["\'])(?P(?:https?:)?//(?:www\.)?xhamster\.com/xembed\.php\?video=\d+)\1', + webpage)] + def _real_extract(self, url): video_id = self._match_id(url)