]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/vine.py
1 from __future__
import unicode_literals
7 from .common
import InfoExtractor
8 from ..utils
import unified_strdate
11 class VineIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?vine\.co/(?:v|oembed)/(?P<id>\w+)'
14 'url': 'https://vine.co/v/b9KOOWX7HUx',
15 'md5': '2f36fed6235b16da96ce9b4dc890940d',
20 'alt_title': 'Vine by Jack Dorsey',
21 'description': 'Chicken.',
22 'upload_date': '20130519',
23 'uploader': 'Jack Dorsey',
27 'url': 'https://vine.co/v/MYxVapFvz2z',
28 'md5': '7b9a7cbc76734424ff942eb52c8f1065',
32 'title': 'Fuck Da Police #Mikebrown #justice #ferguson #prayforferguson #protesting #NMOS14',
33 'alt_title': 'Vine by Luna',
34 'description': 'Fuck Da Police #Mikebrown #justice #ferguson #prayforferguson #protesting #NMOS14',
35 'upload_date': '20140815',
37 'uploader_id': '1102363502380728320',
40 'url': 'https://vine.co/v/bxVjBbZlPUH',
41 'md5': 'ea27decea3fa670625aac92771a96b73',
45 'title': '#mw3 #ac130 #killcam #angelofdeath',
46 'alt_title': 'Vine by Z3k3',
47 'description': '#mw3 #ac130 #killcam #angelofdeath',
48 'upload_date': '20130430',
50 'uploader_id': '936470460173008896',
53 'url': 'https://vine.co/oembed/MYxVapFvz2z.json',
54 'only_matching': True,
57 def _real_extract(self
, url
):
58 video_id
= self
._match
_id
(url
)
59 webpage
= self
._download
_webpage
('https://vine.co/v/' + video_id
, video_id
)
61 data
= self
._parse
_json
(
62 self
._html
_search
_regex
(
63 r
'window\.POST_DATA = { %s: ({.+?}) };\s*</script>' % video_id
,
64 webpage
, 'vine data'),
68 'format_id': '%(format)s-%(rate)s' % f
,
69 'vcodec': f
['format'],
72 } for f
in data
['videoUrls']]
74 self
._sort
_formats
(formats
)
78 'title': self
._og
_search
_title
(webpage
),
79 'alt_title': self
._og
_search
_description
(webpage
),
80 'description': data
['description'],
81 'thumbnail': data
['thumbnailUrl'],
82 'upload_date': unified_strdate(data
['created']),
83 'uploader': data
['username'],
84 'uploader_id': data
['userIdStr'],
85 'like_count': data
['likes']['count'],
86 'comment_count': data
['comments']['count'],
87 'repost_count': data
['reposts']['count'],
92 class VineUserIE(InfoExtractor
):
94 _VALID_URL
= r
'(?:https?://)?vine\.co/(?P<u>u/)?(?P<user>[^/]+)/?(\?.*)?$'
95 _VINE_BASE_URL
= "https://vine.co/"
98 'url': 'https://vine.co/Visa',
102 'playlist_mincount': 46,
105 'url': 'https://vine.co/u/941705360593584128',
106 'only_matching': True,
110 def _real_extract(self
, url
):
111 mobj
= re
.match(self
._VALID
_URL
, url
)
112 user
= mobj
.group('user')
115 profile_url
= "%sapi/users/profiles/%s%s" % (
116 self
._VINE
_BASE
_URL
, 'vanity/' if not u
else '', user
)
117 profile_data
= self
._download
_json
(
118 profile_url
, user
, note
='Downloading user profile data')
120 user_id
= profile_data
['data']['userId']
122 for pagenum
in itertools
.count(1):
123 timeline_url
= "%sapi/timelines/users/%s?page=%s&size=100" % (
124 self
._VINE
_BASE
_URL
, user_id
, pagenum
)
125 timeline_page
= self
._download
_json
(
126 timeline_url
, user
, note
='Downloading page %d' % pagenum
)
127 timeline_data
.extend(timeline_page
['data']['records'])
128 if timeline_page
['data']['nextPage'] is None:
132 self
.url_result(e
['permalinkUrl'], 'Vine') for e
in timeline_data
]
133 return self
.playlist_result(entries
, user
)