]>
Commit | Line | Data |
---|---|---|
fd95105e RA |
1 | from .common import InfoExtractor |
2 | from ..compat import compat_str | |
3 | from ..utils import int_or_none | |
4 | ||
5 | ||
6 | class LiveJournalIE(InfoExtractor): | |
7 | _VALID_URL = r'https?://(?:[^.]+\.)?livejournal\.com/video/album/\d+.+?\bid=(?P<id>\d+)' | |
8 | _TEST = { | |
9 | 'url': 'https://andrei-bt.livejournal.com/video/album/407/?mode=view&id=51272', | |
10 | 'md5': 'adaf018388572ced8a6f301ace49d4b2', | |
11 | 'info_dict': { | |
12 | 'id': '1263729', | |
13 | 'ext': 'mp4', | |
14 | 'title': 'Истребители против БПЛА', | |
15 | 'upload_date': '20190624', | |
16 | 'timestamp': 1561406715, | |
17 | } | |
18 | } | |
19 | ||
20 | def _real_extract(self, url): | |
21 | video_id = self._match_id(url) | |
22 | webpage = self._download_webpage(url, video_id) | |
23 | record = self._parse_json(self._search_regex( | |
24 | r'Site\.page\s*=\s*({.+?});', webpage, | |
25 | 'page data'), video_id)['video']['record'] | |
26 | storage_id = compat_str(record['storageid']) | |
27 | title = record.get('name') | |
28 | if title: | |
29 | # remove filename extension(.mp4, .mov, etc...) | |
30 | title = title.rsplit('.', 1)[0] | |
31 | return { | |
32 | '_type': 'url_transparent', | |
33 | 'id': video_id, | |
34 | 'title': title, | |
35 | 'thumbnail': record.get('thumbnail'), | |
36 | 'timestamp': int_or_none(record.get('timecreate')), | |
37 | 'url': 'eagleplatform:vc.videos.livejournal.com:' + storage_id, | |
38 | 'ie_key': 'EaglePlatform', | |
39 | } |