2 from __future__ import unicode_literals
7 from .common import InfoExtractor
10 compat_urllib_request,
18 class MoeVideoIE(InfoExtractor):
19 IE_DESC = 'LetitBit video services: moevideo.net, playreplay.net and videochart.net'
21 https?://(?P<host>(?:www\.)?
22 (?:(?:moevideo|playreplay|videochart)\.net))/
23 (?:video|framevideo)/(?P<id>[0-9]+\.[0-9A-Za-z]+)'''
24 _API_URL = 'http://api.letitbit.net/'
25 _API_KEY = 'tVL0gjqo5'
28 'url': 'http://moevideo.net/video/00297.0036103fe3d513ef27915216fd29',
29 'md5': '129f5ae1f6585d0e9bb4f38e774ffb3a',
31 'id': '00297.0036103fe3d513ef27915216fd29',
33 'title': 'Sink cut out machine',
34 'description': 'md5:f29ff97b663aefa760bf7ca63c8ca8a8',
35 'thumbnail': 're:^https?://.*\.jpg$',
43 'url': 'http://playreplay.net/video/77107.7f325710a627383d40540d8e991a',
44 'md5': '74f0a014d5b661f0f0e2361300d1620e',
46 'id': '77107.7f325710a627383d40540d8e991a',
48 'title': 'Operacion Condor.',
49 'description': 'md5:7e68cb2fcda66833d5081c542491a9a3',
50 'thumbnail': 're:^https?://.*\.jpg$',
54 'filesize': 588257923,
59 def _real_extract(self, url):
60 mobj = re.match(self._VALID_URL, url)
61 video_id = mobj.group('id')
63 webpage = self._download_webpage(
64 'http://%s/video/%s' % (mobj.group('host'), video_id),
65 video_id, 'Downloading webpage')
67 title = self._og_search_title(webpage)
68 thumbnail = self._og_search_thumbnail(webpage)
69 description = self._og_search_description(webpage)
80 r_json = json.dumps(r)
81 post = compat_urllib_parse.urlencode({'r': r_json})
82 req = compat_urllib_request.Request(self._API_URL, post)
83 req.add_header('Content-type', 'application/x-www-form-urlencoded')
85 response = self._download_json(req, video_id)
86 if response['status'] != 'OK':
88 '%s returned error: %s' % (self.IE_NAME, response['data']),
91 item = response['data'][0]
92 video_url = item['link']
93 duration = int_or_none(item['length'])
94 width = int_or_none(item['width'])
95 height = int_or_none(item['height'])
96 filesize = int_or_none(item['convert_size'])
100 'http_headers': {'Range': 'bytes=0-'}, # Required to download
104 'filesize': filesize,
110 'thumbnail': thumbnail,
111 'description': description,
112 'duration': duration,