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