]>
Commit | Line | Data |
---|---|---|
5fb9077e NJ |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
5fb9077e NJ |
4 | import re |
5 | ||
6 | from .common import InfoExtractor | |
1cc79574 | 7 | from ..utils import ( |
8569058f | 8 | clean_html, |
5fb9077e NJ |
9 | int_or_none, |
10 | ) | |
11 | ||
12 | ||
13 | class MoeVideoIE(InfoExtractor): | |
ff0ba8ce | 14 | IE_DESC = 'LetitBit video services: moevideo.net, playreplay.net and videochart.net' |
5fb9077e NJ |
15 | _VALID_URL = r'''(?x) |
16 | https?://(?P<host>(?:www\.)? | |
8569058f RA |
17 | (?:(?:moevideo|playreplay|videochart)\.net|thesame\.tv))/ |
18 | (?:video|framevideo|embed)/(?P<id>[0-9a-z]+\.[0-9A-Za-z]+)''' | |
5fb9077e NJ |
19 | _API_URL = 'http://api.letitbit.net/' |
20 | _API_KEY = 'tVL0gjqo5' | |
21 | _TESTS = [ | |
22 | { | |
23 | 'url': 'http://moevideo.net/video/00297.0036103fe3d513ef27915216fd29', | |
24 | 'md5': '129f5ae1f6585d0e9bb4f38e774ffb3a', | |
25 | 'info_dict': { | |
26 | 'id': '00297.0036103fe3d513ef27915216fd29', | |
27 | 'ext': 'flv', | |
28 | 'title': 'Sink cut out machine', | |
29 | 'description': 'md5:f29ff97b663aefa760bf7ca63c8ca8a8', | |
ec85ded8 | 30 | 'thumbnail': r're:^https?://.*\.jpg$', |
5fb9077e NJ |
31 | 'width': 540, |
32 | 'height': 360, | |
33 | 'duration': 179, | |
0dc53655 | 34 | 'filesize': 17822500, |
92c9c2a8 YCH |
35 | }, |
36 | 'skip': 'Video has been removed', | |
5fb9077e NJ |
37 | }, |
38 | { | |
39 | 'url': 'http://playreplay.net/video/77107.7f325710a627383d40540d8e991a', | |
40 | 'md5': '74f0a014d5b661f0f0e2361300d1620e', | |
41 | 'info_dict': { | |
42 | 'id': '77107.7f325710a627383d40540d8e991a', | |
43 | 'ext': 'flv', | |
44 | 'title': 'Operacion Condor.', | |
45 | 'description': 'md5:7e68cb2fcda66833d5081c542491a9a3', | |
ec85ded8 | 46 | 'thumbnail': r're:^https?://.*\.jpg$', |
5fb9077e NJ |
47 | 'width': 480, |
48 | 'height': 296, | |
49 | 'duration': 6027, | |
0dc53655 | 50 | 'filesize': 588257923, |
a1e9e644 S |
51 | }, |
52 | 'skip': 'Video has been removed', | |
5fb9077e NJ |
53 | }, |
54 | ] | |
55 | ||
56 | def _real_extract(self, url): | |
8569058f | 57 | host, video_id = re.match(self._VALID_URL, url).groups() |
5fb9077e NJ |
58 | |
59 | webpage = self._download_webpage( | |
8569058f | 60 | 'http://%s/video/%s' % (host, video_id), |
5fb9077e NJ |
61 | video_id, 'Downloading webpage') |
62 | ||
63 | title = self._og_search_title(webpage) | |
5fb9077e | 64 | |
8569058f RA |
65 | embed_webpage = self._download_webpage( |
66 | 'http://%s/embed/%s' % (host, video_id), | |
67 | video_id, 'Downloading embed webpage') | |
68 | video = self._parse_json(self._search_regex( | |
69 | r'mvplayer\("#player"\s*,\s*({.+})', | |
70 | embed_webpage, 'mvplayer'), video_id)['video'] | |
5fb9077e NJ |
71 | |
72 | return { | |
73 | 'id': video_id, | |
74 | 'title': title, | |
8569058f RA |
75 | 'thumbnail': video.get('poster') or self._og_search_thumbnail(webpage), |
76 | 'description': clean_html(self._og_search_description(webpage)), | |
77 | 'duration': int_or_none(self._og_search_property('video:duration', webpage)), | |
78 | 'url': video['ourUrl'], | |
5fb9077e | 79 | } |