]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/appleconnect.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class AppleConnectIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://itunes\.apple\.com/\w{0,2}/?post/idsa\.(?P<id>[\w-]+)'
14 'url': 'https://itunes.apple.com/us/post/idsa.4ab17a39-2720-11e5-96c5-a5b38f6c42d3',
15 'md5': '10d0f2799111df4cb1c924520ca78f98',
17 'id': '4ab17a39-2720-11e5-96c5-a5b38f6c42d3',
21 'thumbnail': 'http://is5.mzstatic.com/image/thumb/Video5/v4/78/61/c5/7861c5fa-ad6d-294b-1464-cf7605b911d6/source/1920x1080sr.jpg',
22 'upload_date': '20150710',
23 'timestamp': 1436545535,
27 def _real_extract(self
, url
):
28 video_id
= self
._match
_id
(url
)
29 webpage
= self
._download
_webpage
(url
, video_id
)
32 video_json
= self
._html
_search
_regex
(
33 r
'class="auc-video-data">(\{.*?\})', webpage
, 'json')
34 except ExtractorError
:
35 raise ExtractorError('This post doesn\'t contain a video', expected
=True)
37 video_data
= self
._parse
_json
(video_json
, video_id
)
38 timestamp
= str_to_int(self
._html
_search
_regex
(r
'data-timestamp="(\d+)"', webpage
, 'timestamp'))
39 like_count
= str_to_int(self
._html
_search
_regex
(r
'(\d+) Loves', webpage
, 'like count'))
43 'url': video_data
['sslSrc'],
44 'title': video_data
['title'],
45 'description': video_data
['description'],
46 'uploader': video_data
['artistName'],
47 'thumbnail': video_data
['artworkUrl'],
48 'timestamp': timestamp
,
49 'like_count': like_count
,