1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-01-25 07:02:53 +08:00

[Vine] Add support for playlists

This commit is contained in:
TRox1972 2016-06-21 12:33:49 +02:00
parent cdfc187cd5
commit 1f0cd0a1b8
3 changed files with 29 additions and 0 deletions

View File

@ -835,6 +835,11 @@ class InfoExtractor(object):
'title': unescapeHTML(json_ld.get('headline')),
'description': unescapeHTML(json_ld.get('articleBody')),
})
elif item_type == 'ItemList':
info.update({
'url': unescapeHTML(json_ld.get('url')),
'itemListElement': json_ld.get('itemListElement'),
})
return dict((k, v) for k, v in info.items() if v is not None)
@staticmethod

View File

@ -956,6 +956,7 @@ from .vimeo import (
from .vimple import VimpleIE
from .vine import (
VineIE,
VinePlaylistIE,
VineUserIE,
)
from .viki import (

View File

@ -116,6 +116,29 @@ class VineIE(InfoExtractor):
}
class VinePlaylistIE(InfoExtractor):
IE_NAME = 'vine:playlist'
_VALID_URL = r'https?://(?:www\.)?vine\.co/playlists/(?P<id>[^/]+)/?(\?.*)?$'
TEST = {
'url': 'https://vine.co/playlists/songcollab-kenzie-nimmo',
'info_dict': {
'id': 'songcollab-kenzie-nimmo',
'title': 'SongCollab: Kenzie Nimmo',
},
'playlist_mincount': 20,
}
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
title = self._html_search_regex(r'<h1>(.+)</h1>', webpage, 'title', None)
data = self._search_json_ld(webpage, display_id)['itemListElement']
entries = [self.url_result(e['url'], 'Vine') for e in data]
return self.playlist_result(entries, display_id, title)
class VineUserIE(InfoExtractor):
IE_NAME = 'vine:user'
_VALID_URL = r'(?:https?://)?vine\.co/(?P<u>u/)?(?P<user>[^/]+)/?(\?.*)?$'