1 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import unified_strdate
10 class VineIE(InfoExtractor):
11 _VALID_URL = r'https?://(?:www\.)?vine\.co/(?:v|oembed)/(?P<id>\w+)'
13 'url': 'https://vine.co/v/b9KOOWX7HUx',
14 'md5': '2f36fed6235b16da96ce9b4dc890940d',
19 'alt_title': 'Vine by Jack Dorsey',
20 'description': 'Chicken.',
21 'upload_date': '20130519',
22 'uploader': 'Jack Dorsey',
26 'url': 'https://vine.co/v/MYxVapFvz2z',
27 'md5': '7b9a7cbc76734424ff942eb52c8f1065',
31 'title': 'Fuck Da Police #Mikebrown #justice #ferguson #prayforferguson #protesting #NMOS14',
32 'alt_title': 'Vine by Luna',
33 'description': 'Fuck Da Police #Mikebrown #justice #ferguson #prayforferguson #protesting #NMOS14',
34 'upload_date': '20140815',
36 'uploader_id': '1102363502380728320',
39 'url': 'https://vine.co/v/bxVjBbZlPUH',
40 'md5': 'ea27decea3fa670625aac92771a96b73',
44 'title': '#mw3 #ac130 #killcam #angelofdeath',
45 'alt_title': 'Vine by Z3k3',
46 'description': '#mw3 #ac130 #killcam #angelofdeath',
47 'upload_date': '20130430',
49 'uploader_id': '936470460173008896',
52 'url': 'https://vine.co/oembed/MYxVapFvz2z.json',
53 'only_matching': True,
55 'url': 'https://vine.co/v/e192BnZnZ9V',
59 'title': u'\u0e22\u0e34\u0e49\u0e21~ \u0e40\u0e02\u0e34\u0e19~ \u0e2d\u0e32\u0e22~ \u0e19\u0e48\u0e32\u0e23\u0e49\u0e32\u0e01\u0e2d\u0e49\u0e30 >//< @n_whitewo @orlameena #lovesicktheseries #lovesickseason2',
60 'alt_title': 'Vine by Pimry_zaa',
61 'description': u'\u0e22\u0e34\u0e49\u0e21~ \u0e40\u0e02\u0e34\u0e19~ \u0e2d\u0e32\u0e22~ \u0e19\u0e48\u0e32\u0e23\u0e49\u0e32\u0e01\u0e2d\u0e49\u0e30 >//< @n_whitewo @orlameena #lovesicktheseries #lovesickseason2',
62 'upload_date': '20150705',
63 'uploader': 'Pimry_zaa',
64 'uploader_id': '1135760698325307392',
67 'skip_download': True,
71 def _real_extract(self, url):
72 video_id = self._match_id(url)
73 webpage = self._download_webpage('https://vine.co/v/' + video_id, video_id)
75 data = self._parse_json(
76 self._html_search_regex(
77 r'window\.POST_DATA = { %s: ({.+?}) };\s*</script>' % video_id,
78 webpage, 'vine data'),
82 'format_id': '%(format)s-%(rate)s' % f,
83 'vcodec': f['format'],
86 } for f in data['videoUrls']]
88 self._sort_formats(formats)
92 'title': data['description'],
93 'alt_title': 'Vine by %s' % data['username'],
94 'description': data['description'],
95 'thumbnail': data['thumbnailUrl'],
96 'upload_date': unified_strdate(data['created']),
97 'uploader': data['username'],
98 'uploader_id': data['userIdStr'],
99 'like_count': data['likes']['count'],
100 'comment_count': data['comments']['count'],
101 'repost_count': data['reposts']['count'],
106 class VineUserIE(InfoExtractor):
107 IE_NAME = 'vine:user'
108 _VALID_URL = r'(?:https?://)?vine\.co/(?P<u>u/)?(?P<user>[^/]+)/?(\?.*)?$'
109 _VINE_BASE_URL = "https://vine.co/"
112 'url': 'https://vine.co/Visa',
116 'playlist_mincount': 46,
119 'url': 'https://vine.co/u/941705360593584128',
120 'only_matching': True,
124 def _real_extract(self, url):
125 mobj = re.match(self._VALID_URL, url)
126 user = mobj.group('user')
129 profile_url = "%sapi/users/profiles/%s%s" % (
130 self._VINE_BASE_URL, 'vanity/' if not u else '', user)
131 profile_data = self._download_json(
132 profile_url, user, note='Downloading user profile data')
134 user_id = profile_data['data']['userId']
136 for pagenum in itertools.count(1):
137 timeline_url = "%sapi/timelines/users/%s?page=%s&size=100" % (
138 self._VINE_BASE_URL, user_id, pagenum)
139 timeline_page = self._download_json(
140 timeline_url, user, note='Downloading page %d' % pagenum)
141 timeline_data.extend(timeline_page['data']['records'])
142 if timeline_page['data']['nextPage'] is None:
146 self.url_result(e['permalinkUrl'], 'Vine') for e in timeline_data]
147 return self.playlist_result(entries, user)