[movingimage] Adapt to the new domain name and fix extraction
authorYen Chi Hsuan <yan12125@gmail.com>
Thu, 1 Sep 2016 08:58:16 +0000 (16:58 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Thu, 1 Sep 2016 08:58:16 +0000 (16:58 +0800)
Closes #10466

ChangeLog
youtube_dl/extractor/extractors.py
youtube_dl/extractor/movingimage.py [new file with mode: 0644]
youtube_dl/extractor/ssa.py [deleted file]

index 0f8076d96d0794d81cf71784f905647b45500280..877e8112e4462a9cc643fa86e71b408d847f023b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+version <unreleased>
+
+Extractors
+* [movingimage] Fix for the new site name (#10466)
+
+
 version 2016.08.31
 
 Extractors
index 21efa96b2364d8a79646802843267852a802481b..8d0688f5398f3e438a36787279d33604c0d9ccf8 100644 (file)
@@ -486,6 +486,7 @@ from .motherless import MotherlessIE
 from .motorsport import MotorsportIE
 from .movieclips import MovieClipsIE
 from .moviezine import MoviezineIE
+from .movingimage import MovingImageIE
 from .msn import MSNIE
 from .mtv import (
     MTVIE,
@@ -806,7 +807,6 @@ from .srgssr import (
     SRGSSRPlayIE,
 )
 from .srmediathek import SRMediathekIE
-from .ssa import SSAIE
 from .stanfordoc import StanfordOpenClassroomIE
 from .steam import SteamIE
 from .streamable import StreamableIE
diff --git a/youtube_dl/extractor/movingimage.py b/youtube_dl/extractor/movingimage.py
new file mode 100644 (file)
index 0000000..bb789c3
--- /dev/null
@@ -0,0 +1,52 @@
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+    unescapeHTML,
+    parse_duration,
+)
+
+
+class MovingImageIE(InfoExtractor):
+    _VALID_URL = r'https?://movingimage\.nls\.uk/film/(?P<id>\d+)'
+    _TEST = {
+        'url': 'http://movingimage.nls.uk/film/3561',
+        'md5': '4caa05c2b38453e6f862197571a7be2f',
+        'info_dict': {
+            'id': '3561',
+            'ext': 'mp4',
+            'title': 'SHETLAND WOOL',
+            'description': 'md5:c5afca6871ad59b4271e7704fe50ab04',
+            'duration': 900,
+            'thumbnail': 're:^https?://.*\.jpg$',
+        },
+    }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+
+        webpage = self._download_webpage(url, video_id)
+
+        formats = self._extract_m3u8_formats(
+            self._html_search_regex(r'file\s*:\s*"([^"]+)"', webpage, 'm3u8 manifest URL'),
+            video_id, ext='mp4', entry_protocol='m3u8_native')
+
+        def search_field(field_name, fatal=False):
+            return self._search_regex(
+                r'<span\s+class="field_title">%s:</span>\s*<span\s+class="field_content">([^<]+)</span>' % field_name,
+                webpage, 'title', fatal=fatal)
+
+        title = unescapeHTML(search_field('Title', fatal=True)).strip('()[]')
+        description = unescapeHTML(search_field('Description'))
+        duration = parse_duration(search_field('Running time'))
+        thumbnail = self._search_regex(
+            r"image\s*:\s*'([^']+)'", webpage, 'thumbnail', fatal=False)
+
+        return {
+            'id': video_id,
+            'formats': formats,
+            'title': title,
+            'description': description,
+            'duration': duration,
+            'thumbnail': thumbnail,
+        }
diff --git a/youtube_dl/extractor/ssa.py b/youtube_dl/extractor/ssa.py
deleted file mode 100644 (file)
index 54d1843..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-from __future__ import unicode_literals
-
-from .common import InfoExtractor
-from ..utils import (
-    unescapeHTML,
-    parse_duration,
-)
-
-
-class SSAIE(InfoExtractor):
-    _VALID_URL = r'https?://ssa\.nls\.uk/film/(?P<id>\d+)'
-    _TEST = {
-        'url': 'http://ssa.nls.uk/film/3561',
-        'info_dict': {
-            'id': '3561',
-            'ext': 'flv',
-            'title': 'SHETLAND WOOL',
-            'description': 'md5:c5afca6871ad59b4271e7704fe50ab04',
-            'duration': 900,
-            'thumbnail': 're:^https?://.*\.jpg$',
-        },
-        'params': {
-            # rtmp download
-            'skip_download': True,
-        },
-    }
-
-    def _real_extract(self, url):
-        video_id = self._match_id(url)
-
-        webpage = self._download_webpage(url, video_id)
-
-        streamer = self._search_regex(
-            r"'streamer'\s*,\S*'(rtmp[^']+)'", webpage, 'streamer')
-        play_path = self._search_regex(
-            r"'file'\s*,\s*'([^']+)'", webpage, 'file').rpartition('.')[0]
-
-        def search_field(field_name, fatal=False):
-            return self._search_regex(
-                r'<span\s+class="field_title">%s:</span>\s*<span\s+class="field_content">([^<]+)</span>' % field_name,
-                webpage, 'title', fatal=fatal)
-
-        title = unescapeHTML(search_field('Title', fatal=True)).strip('()[]')
-        description = unescapeHTML(search_field('Description'))
-        duration = parse_duration(search_field('Running time'))
-        thumbnail = self._search_regex(
-            r"'image'\s*,\s*'([^']+)'", webpage, 'thumbnails', fatal=False)
-
-        return {
-            'id': video_id,
-            'url': streamer,
-            'play_path': play_path,
-            'ext': 'flv',
-            'title': title,
-            'description': description,
-            'duration': duration,
-            'thumbnail': thumbnail,
-        }