]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/lifenews.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import unified_strdate
10 class LifeNewsIE(InfoExtractor
):
12 IE_DESC
= 'LIFE | NEWS'
13 _VALID_URL
= r
'http://lifenews\.ru/(?:mobile/)?news/(?P<id>\d+)'
16 'url': 'http://lifenews.ru/news/126342',
18 'md5': 'e1b50a5c5fb98a6a544250f2e0db570a',
20 'title': 'МВД разыскивает мужчин, оставивших в IKEA сумку с автоматом',
21 'description': 'Камеры наблюдения гипермаркета зафиксировали троих мужчин, спрятавших оружейный арсенал в камере хранения.',
22 'thumbnail': 'http://lifenews.ru/static/posts/2014/1/126342/.video.jpg',
23 'upload_date': '20140130',
27 def _real_extract(self
, url
):
28 mobj
= re
.match(self
._VALID
_URL
, url
)
29 video_id
= mobj
.group('id')
31 webpage
= self
._download
_webpage
('http://lifenews.ru/mobile/news/%s' % video_id
, video_id
, 'Downloading page')
33 video_url
= self
._html
_search
_regex
(
34 r
'<video.*?src="([^"]+)"></video>', webpage
, 'video URL')
36 thumbnail
= self
._html
_search
_regex
(
37 r
'<video.*?poster="([^"]+)".*?"></video>', webpage
, 'video thumbnail')
39 title
= self
._og
_search
_title
(webpage
)
40 TITLE_SUFFIX
= ' - Первый по срочным новостям — LIFE | NEWS'
41 if title
.endswith(TITLE_SUFFIX
):
42 title
= title
[:-len(TITLE_SUFFIX
)]
44 description
= self
._og
_search
_description
(webpage
)
46 view_count
= self
._html
_search
_regex
(
47 r
'<div class=\'views
\'>(\d
+)</div
>', webpage, 'view count
')
48 comment_count = self._html_search_regex(
49 r'<div
class=\'comments
\'>(\d
+)</div
>', webpage, 'comment count
')
51 upload_date = self._html_search_regex(
52 r'<time datetime
=\'([^
\']+)\'>', webpage, 'upload date
')
57 'thumbnail
': thumbnail,
59 'description
': description,
60 'view_count
': view_count,
61 'comment_count
': comment_count,
62 'upload_date
': unified_strdate(upload_date),