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