mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-01-07 17:16:08 +00:00
[vimeo:likes] Add new extractor (Fixes #3835)
This commit is contained in:
parent
76e7d1e74b
commit
d6e6a42256
|
@ -139,7 +139,9 @@ def generator(test_case):
|
||||||
|
|
||||||
if is_playlist:
|
if is_playlist:
|
||||||
self.assertEqual(res_dict['_type'], 'playlist')
|
self.assertEqual(res_dict['_type'], 'playlist')
|
||||||
|
self.assertTrue('entries' in res_dict)
|
||||||
expect_info_dict(self, test_case.get('info_dict', {}), res_dict)
|
expect_info_dict(self, test_case.get('info_dict', {}), res_dict)
|
||||||
|
|
||||||
if 'playlist_mincount' in test_case:
|
if 'playlist_mincount' in test_case:
|
||||||
assertGreaterEqual(
|
assertGreaterEqual(
|
||||||
self,
|
self,
|
||||||
|
@ -188,7 +190,7 @@ def generator(test_case):
|
||||||
expect_info_dict(self, tc.get('info_dict', {}), info_dict)
|
expect_info_dict(self, tc.get('info_dict', {}), info_dict)
|
||||||
finally:
|
finally:
|
||||||
try_rm_tcs_files()
|
try_rm_tcs_files()
|
||||||
if is_playlist and res_dict is not None:
|
if is_playlist and res_dict is not None and res_dict.get('entries'):
|
||||||
# Remove all other files that may have been extracted if the
|
# Remove all other files that may have been extracted if the
|
||||||
# extractor returns full results even with extract_flat
|
# extractor returns full results even with extract_flat
|
||||||
res_tcs = [{'info_dict': e} for e in res_dict['entries']]
|
res_tcs = [{'info_dict': e} for e in res_dict['entries']]
|
||||||
|
|
|
@ -412,11 +412,12 @@ from .videoweed import VideoWeedIE
|
||||||
from .vidme import VidmeIE
|
from .vidme import VidmeIE
|
||||||
from .vimeo import (
|
from .vimeo import (
|
||||||
VimeoIE,
|
VimeoIE,
|
||||||
VimeoChannelIE,
|
|
||||||
VimeoUserIE,
|
|
||||||
VimeoAlbumIE,
|
VimeoAlbumIE,
|
||||||
|
VimeoChannelIE,
|
||||||
VimeoGroupsIE,
|
VimeoGroupsIE,
|
||||||
|
VimeoLikesIE,
|
||||||
VimeoReviewIE,
|
VimeoReviewIE,
|
||||||
|
VimeoUserIE,
|
||||||
VimeoWatchLaterIE,
|
VimeoWatchLaterIE,
|
||||||
)
|
)
|
||||||
from .vimple import VimpleIE
|
from .vimple import VimpleIE
|
||||||
|
|
|
@ -397,12 +397,6 @@ class GenericIE(InfoExtractor):
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
def report_download_webpage(self, video_id):
|
|
||||||
"""Report webpage download."""
|
|
||||||
if not self._downloader.params.get('test', False):
|
|
||||||
self._downloader.report_warning('Falling back on generic information extractor.')
|
|
||||||
super(GenericIE, self).report_download_webpage(video_id)
|
|
||||||
|
|
||||||
def report_following_redirect(self, new_url):
|
def report_following_redirect(self, new_url):
|
||||||
"""Report information extraction."""
|
"""Report information extraction."""
|
||||||
self._downloader.to_screen('[redirect] Following redirect to %s' % new_url)
|
self._downloader.to_screen('[redirect] Following redirect to %s' % new_url)
|
||||||
|
@ -502,6 +496,7 @@ class GenericIE(InfoExtractor):
|
||||||
|
|
||||||
url, smuggled_data = unsmuggle_url(url)
|
url, smuggled_data = unsmuggle_url(url)
|
||||||
force_videoid = None
|
force_videoid = None
|
||||||
|
is_intentional = smuggled_data and smuggled_data.get('to_generic')
|
||||||
if smuggled_data and 'force_videoid' in smuggled_data:
|
if smuggled_data and 'force_videoid' in smuggled_data:
|
||||||
force_videoid = smuggled_data['force_videoid']
|
force_videoid = smuggled_data['force_videoid']
|
||||||
video_id = force_videoid
|
video_id = force_videoid
|
||||||
|
@ -544,6 +539,9 @@ class GenericIE(InfoExtractor):
|
||||||
'upload_date': upload_date,
|
'upload_date': upload_date,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if not self._downloader.params.get('test', False) and not is_intentional:
|
||||||
|
self._downloader.report_warning('Falling back on generic information extractor.')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
@ -15,6 +15,7 @@ from ..utils import (
|
||||||
get_element_by_attribute,
|
get_element_by_attribute,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
RegexNotFoundError,
|
RegexNotFoundError,
|
||||||
|
smuggle_url,
|
||||||
std_headers,
|
std_headers,
|
||||||
unsmuggle_url,
|
unsmuggle_url,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
|
@ -529,3 +530,35 @@ class VimeoWatchLaterIE(VimeoBaseInfoExtractor, VimeoChannelIE):
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
return self._extract_videos('watchlater', 'https://vimeo.com/home/watchlater')
|
return self._extract_videos('watchlater', 'https://vimeo.com/home/watchlater')
|
||||||
|
|
||||||
|
|
||||||
|
class VimeoLikesIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?vimeo\.com/user(?P<id>[0-9]+)/likes(?:$|[?#])'
|
||||||
|
IE_NAME = 'vimeo:likes'
|
||||||
|
IE_DESC = 'Vimeo user likes'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'https://vimeo.com/user20132939/likes',
|
||||||
|
'playlist_mincount': 4,
|
||||||
|
'add_ies': ['Generic'],
|
||||||
|
"info_dict": {
|
||||||
|
"description": "Videos Philipp Hagemeister likes on Vimeo.",
|
||||||
|
"title": "Vimeo / Philipp Hagemeister's likes",
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'extract_flat': False,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
user_id = self._match_id(url)
|
||||||
|
rss_url = '%s//vimeo.com/user%s/likes/rss' % (
|
||||||
|
self.http_scheme(), user_id)
|
||||||
|
surl = smuggle_url(rss_url, {
|
||||||
|
'force_videoid': '%s_likes' % user_id,
|
||||||
|
'to_generic': True,
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
'_type': 'url',
|
||||||
|
'url': surl,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue