mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-24 09:16:50 +01:00
[condenast] fix extraction and add support for other sites
This commit is contained in:
parent
9b166fc1f8
commit
882fc9052e
@ -2,7 +2,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
@ -24,13 +23,25 @@ class CondeNastIE(InfoExtractor):
|
|||||||
# The keys are the supported sites and the values are the name to be shown
|
# The keys are the supported sites and the values are the name to be shown
|
||||||
# to the user and in the extractor description.
|
# to the user and in the extractor description.
|
||||||
_SITES = {
|
_SITES = {
|
||||||
'wired': 'WIRED',
|
'allure': 'Allure',
|
||||||
'gq': 'GQ',
|
'architecturaldigest': 'Architectural Digest',
|
||||||
'vogue': 'Vogue',
|
'arstechnica': 'Ars Technica',
|
||||||
'glamour': 'Glamour',
|
'bonappetit': 'Bon Appetit',
|
||||||
'wmagazine': 'W Magazine',
|
'brides': 'Brides',
|
||||||
'vanityfair': 'Vanity Fair',
|
|
||||||
'cnevids': 'Condé Nast',
|
'cnevids': 'Condé Nast',
|
||||||
|
'cntraveler': 'Condé Nast Traveler',
|
||||||
|
'details': 'Details',
|
||||||
|
'epicurious': 'Epicurious',
|
||||||
|
'glamour': 'Glamour',
|
||||||
|
'golfdigest': 'Golf Digest',
|
||||||
|
'gq': 'GQ',
|
||||||
|
'newyorker': 'The New Yorker',
|
||||||
|
'self': 'SELF',
|
||||||
|
'teenvogue': 'Teen Vogue',
|
||||||
|
'vanityfair': 'Vanity Fair',
|
||||||
|
'vogue': 'Vogue',
|
||||||
|
'wired': 'WIRED',
|
||||||
|
'wmagazine': 'W Magazine',
|
||||||
}
|
}
|
||||||
|
|
||||||
_VALID_URL = r'http://(video|www|player)\.(?P<site>%s)\.com/(?P<type>watch|series|video|embed)/(?P<id>[^/?#]+)' % '|'.join(_SITES.keys())
|
_VALID_URL = r'http://(video|www|player)\.(?P<site>%s)\.com/(?P<type>watch|series|video|embed)/(?P<id>[^/?#]+)' % '|'.join(_SITES.keys())
|
||||||
@ -86,8 +97,8 @@ class CondeNastIE(InfoExtractor):
|
|||||||
info_url = base_info_url + data
|
info_url = base_info_url + data
|
||||||
info_page = self._download_webpage(info_url, video_id,
|
info_page = self._download_webpage(info_url, video_id,
|
||||||
'Downloading video info')
|
'Downloading video info')
|
||||||
video_info = self._search_regex(r'var video = ({.+?});', info_page, 'video info')
|
video_info = self._search_regex(r'var\s*video\s*=\s*({.+?});', info_page, 'video info')
|
||||||
video_info = json.loads(video_info)
|
video_info = self._parse_json(video_info, video_id)
|
||||||
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'format_id': '%s-%s' % (fdata['type'].split('/')[-1], fdata['quality']),
|
'format_id': '%s-%s' % (fdata['type'].split('/')[-1], fdata['quality']),
|
||||||
|
Loading…
Reference in New Issue
Block a user