]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[tnaflixnetwork:embed] Add extractor
authorSergey M․ <dstftw@gmail.com>
Sat, 27 Feb 2016 10:58:11 +0000 (16:58 +0600)
committerSergey M․ <dstftw@gmail.com>
Sat, 27 Feb 2016 10:58:11 +0000 (16:58 +0600)
youtube_dl/extractor/__init__.py
youtube_dl/extractor/tnaflix.py

index c306797363e0a9326919ffe3a61f616f0bc04947..5817140c0c407c8f0c9468dd7df3efd3e5f29500 100644 (file)
@@ -737,6 +737,7 @@ from .tmz import (
     TMZArticleIE,
 )
 from .tnaflix import (
+    TNAFlixNetworkEmbedIE,
     TNAFlixIE,
     EMPFlixIE,
     MovieFapIE,
index 49516abca690721a83dee5044bb2cdd6540d4a07..547d83d09b1531f86bf8f4a9d0d90e84efdfc48a 100644 (file)
@@ -71,7 +71,7 @@ class TNAFlixNetworkBaseIE(InfoExtractor):
     def _real_extract(self, url):
         mobj = re.match(self._VALID_URL, url)
         video_id = mobj.group('id')
-        display_id = mobj.group('display_id')
+        display_id = mobj.group('display_id') if 'display_id' in mobj.groupdict() else video_id
 
         webpage = self._download_webpage(url, display_id)
 
@@ -152,6 +152,30 @@ class TNAFlixNetworkBaseIE(InfoExtractor):
         }
 
 
+class TNAFlixNetworkEmbedIE(TNAFlixNetworkBaseIE):
+    _VALID_URL = r'https?://player\.(?:tna|emp)flix\.com/video/(?P<id>\d+)'
+
+    _TITLE_REGEX = r'<title>([^<]+)</title>'
+
+    _TESTS = [{
+        'url': 'https://player.tnaflix.com/video/6538',
+        'info_dict': {
+            'id': '6538',
+            'display_id': '6538',
+            'ext': 'mp4',
+            'title': 'Educational xxx video',
+            'thumbnail': 're:https?://.*\.jpg$',
+            'age_limit': 18,
+        },
+        'params': {
+            'skip_download': True,
+        },
+    }, {
+        'url': 'https://player.empflix.com/video/33051',
+        'only_matching': True,
+    }]
+
+
 class TNAFlixIE(TNAFlixNetworkBaseIE):
     _VALID_URL = r'https?://(?:www\.)?tnaflix\.com/[^/]+/(?P<display_id>[^/]+)/video(?P<id>\d+)'