You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

597 lines
24 KiB

  1. # encoding: utf-8
  2. from __future__ import unicode_literals
  3. import json
  4. import re
  5. import itertools
  6. from .common import InfoExtractor
  7. from .subtitles import SubtitlesInfoExtractor
  8. from ..utils import (
  9. clean_html,
  10. compat_HTTPError,
  11. compat_urllib_parse,
  12. compat_urllib_request,
  13. compat_urlparse,
  14. ExtractorError,
  15. get_element_by_attribute,
  16. InAdvancePagedList,
  17. int_or_none,
  18. RegexNotFoundError,
  19. std_headers,
  20. unsmuggle_url,
  21. urlencode_postdata,
  22. )
  23. class VimeoBaseInfoExtractor(InfoExtractor):
  24. _NETRC_MACHINE = 'vimeo'
  25. _LOGIN_REQUIRED = False
  26. def _login(self):
  27. (username, password) = self._get_login_info()
  28. if username is None:
  29. if self._LOGIN_REQUIRED:
  30. raise ExtractorError('No login info available, needed for using %s.' % self.IE_NAME, expected=True)
  31. return
  32. self.report_login()
  33. login_url = 'https://vimeo.com/log_in'
  34. webpage = self._download_webpage(login_url, None, False)
  35. token = self._search_regex(r'xsrft: \'(.*?)\'', webpage, 'login token')
  36. data = urlencode_postdata({
  37. 'email': username,
  38. 'password': password,
  39. 'action': 'login',
  40. 'service': 'vimeo',
  41. 'token': token,
  42. })
  43. login_request = compat_urllib_request.Request(login_url, data)
  44. login_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
  45. login_request.add_header('Cookie', 'xsrft=%s' % token)
  46. self._download_webpage(login_request, None, False, 'Wrong login info')
  47. class VimeoIE(VimeoBaseInfoExtractor, SubtitlesInfoExtractor):
  48. """Information extractor for vimeo.com."""
  49. # _VALID_URL matches Vimeo URLs
  50. _VALID_URL = r'''(?x)
  51. (?P<proto>(?:https?:)?//)?
  52. (?:(?:www|(?P<player>player))\.)?
  53. vimeo(?P<pro>pro)?\.com/
  54. (?!channels/[^/?#]+/?(?:$|[?#])|album/)
  55. (?:.*?/)?
  56. (?:(?:play_redirect_hls|moogaloop\.swf)\?clip_id=)?
  57. (?:videos?/)?
  58. (?P<id>[0-9]+)
  59. /?(?:[?&].*)?(?:[#].*)?$'''
  60. IE_NAME = 'vimeo'
  61. _TESTS = [
  62. {
  63. 'url': 'http://vimeo.com/56015672#at=0',
  64. 'md5': '8879b6cc097e987f02484baf890129e5',
  65. 'info_dict': {
  66. 'id': '56015672',
  67. 'ext': 'mp4',
  68. "upload_date": "20121220",
  69. "description": "This is a test case for youtube-dl.\nFor more information, see github.com/rg3/youtube-dl\nTest chars: \u2605 \" ' \u5e78 / \\ \u00e4 \u21ad \U0001d550",
  70. "uploader_id": "user7108434",
  71. "uploader": "Filippo Valsorda",
  72. "title": "youtube-dl test video - \u2605 \" ' \u5e78 / \\ \u00e4 \u21ad \U0001d550",
  73. "duration": 10,
  74. },
  75. },
  76. {
  77. 'url': 'http://vimeopro.com/openstreetmapus/state-of-the-map-us-2013/video/68093876',
  78. 'md5': '3b5ca6aa22b60dfeeadf50b72e44ed82',
  79. 'note': 'Vimeo Pro video (#1197)',
  80. 'info_dict': {
  81. 'id': '68093876',
  82. 'ext': 'mp4',
  83. 'uploader_id': 'openstreetmapus',
  84. 'uploader': 'OpenStreetMap US',
  85. 'title': 'Andy Allan - Putting the Carto into OpenStreetMap Cartography',
  86. 'description': 'md5:380943ec71b89736ff4bf27183233d09',
  87. 'duration': 1595,
  88. },
  89. },
  90. {
  91. 'url': 'http://player.vimeo.com/video/54469442',
  92. 'md5': '619b811a4417aa4abe78dc653becf511',
  93. 'note': 'Videos that embed the url in the player page',
  94. 'info_dict': {
  95. 'id': '54469442',
  96. 'ext': 'mp4',
  97. 'title': 'Kathy Sierra: Building the minimum Badass User, Business of Software 2012',
  98. 'uploader': 'The BLN & Business of Software',
  99. 'uploader_id': 'theblnbusinessofsoftware',
  100. 'duration': 3610,
  101. 'description': None,
  102. },
  103. },
  104. {
  105. 'url': 'http://vimeo.com/68375962',
  106. 'md5': 'aaf896bdb7ddd6476df50007a0ac0ae7',
  107. 'note': 'Video protected with password',
  108. 'info_dict': {
  109. 'id': '68375962',
  110. 'ext': 'mp4',
  111. 'title': 'youtube-dl password protected test video',
  112. 'upload_date': '20130614',
  113. 'uploader_id': 'user18948128',
  114. 'uploader': 'Jaime Marquínez Ferrándiz',
  115. 'duration': 10,
  116. 'description': 'This is "youtube-dl password protected test video" by Jaime Marquínez Ferrándiz on Vimeo, the home for high quality videos and the people who love them.',
  117. },
  118. 'params': {
  119. 'videopassword': 'youtube-dl',
  120. },
  121. },
  122. {
  123. 'url': 'http://vimeo.com/channels/keypeele/75629013',
  124. 'md5': '2f86a05afe9d7abc0b9126d229bbe15d',
  125. 'note': 'Video is freely available via original URL '
  126. 'and protected with password when accessed via http://vimeo.com/75629013',
  127. 'info_dict': {
  128. 'id': '75629013',
  129. 'ext': 'mp4',
  130. 'title': 'Key & Peele: Terrorist Interrogation',
  131. 'description': 'md5:8678b246399b070816b12313e8b4eb5c',
  132. 'uploader_id': 'atencio',
  133. 'uploader': 'Peter Atencio',
  134. 'duration': 187,
  135. },
  136. },
  137. {
  138. 'url': 'http://vimeo.com/76979871',
  139. 'md5': '3363dd6ffebe3784d56f4132317fd446',
  140. 'note': 'Video with subtitles',
  141. 'info_dict': {
  142. 'id': '76979871',
  143. 'ext': 'mp4',
  144. 'title': 'The New Vimeo Player (You Know, For Videos)',
  145. 'description': 'md5:2ec900bf97c3f389378a96aee11260ea',
  146. 'upload_date': '20131015',
  147. 'uploader_id': 'staff',
  148. 'uploader': 'Vimeo Staff',
  149. 'duration': 62,
  150. }
  151. },
  152. ]
  153. def _verify_video_password(self, url, video_id, webpage):
  154. password = self._downloader.params.get('videopassword', None)
  155. if password is None:
  156. raise ExtractorError('This video is protected by a password, use the --video-password option')
  157. token = self._search_regex(r'xsrft: \'(.*?)\'', webpage, 'login token')
  158. data = compat_urllib_parse.urlencode({
  159. 'password': password,
  160. 'token': token,
  161. })
  162. # I didn't manage to use the password with https
  163. if url.startswith('https'):
  164. pass_url = url.replace('https', 'http')
  165. else:
  166. pass_url = url
  167. password_request = compat_urllib_request.Request(pass_url + '/password', data)
  168. password_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
  169. password_request.add_header('Cookie', 'xsrft=%s' % token)
  170. self._download_webpage(password_request, video_id,
  171. 'Verifying the password',
  172. 'Wrong password')
  173. def _verify_player_video_password(self, url, video_id):
  174. password = self._downloader.params.get('videopassword', None)
  175. if password is None:
  176. raise ExtractorError('This video is protected by a password, use the --video-password option')
  177. data = compat_urllib_parse.urlencode({'password': password})
  178. pass_url = url + '/check-password'
  179. password_request = compat_urllib_request.Request(pass_url, data)
  180. password_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
  181. return self._download_json(
  182. password_request, video_id,
  183. 'Verifying the password',
  184. 'Wrong password')
  185. def _real_initialize(self):
  186. self._login()
  187. def _real_extract(self, url):
  188. url, data = unsmuggle_url(url)
  189. headers = std_headers
  190. if data is not None:
  191. headers = headers.copy()
  192. headers.update(data)
  193. if 'Referer' not in headers:
  194. headers['Referer'] = url
  195. # Extract ID from URL
  196. mobj = re.match(self._VALID_URL, url)
  197. video_id = mobj.group('id')
  198. orig_url = url
  199. if mobj.group('pro') or mobj.group('player'):
  200. url = 'http://player.vimeo.com/video/' + video_id
  201. # Retrieve video webpage to extract further information
  202. request = compat_urllib_request.Request(url, None, headers)
  203. try:
  204. webpage = self._download_webpage(request, video_id)
  205. except ExtractorError as ee:
  206. if isinstance(ee.cause, compat_HTTPError) and ee.cause.code == 403:
  207. errmsg = ee.cause.read()
  208. if b'Because of its privacy settings, this video cannot be played here' in errmsg:
  209. raise ExtractorError(
  210. 'Cannot download embed-only video without embedding '
  211. 'URL. Please call youtube-dl with the URL of the page '
  212. 'that embeds this video.',
  213. expected=True)
  214. raise
  215. # Now we begin extracting as much information as we can from what we
  216. # retrieved. First we extract the information common to all extractors,
  217. # and latter we extract those that are Vimeo specific.
  218. self.report_extraction(video_id)
  219. # Extract the config JSON
  220. try:
  221. try:
  222. config_url = self._html_search_regex(
  223. r' data-config-url="(.+?)"', webpage, 'config URL')
  224. config_json = self._download_webpage(config_url, video_id)
  225. config = json.loads(config_json)
  226. except RegexNotFoundError:
  227. # For pro videos or player.vimeo.com urls
  228. # We try to find out to which variable is assigned the config dic
  229. m_variable_name = re.search('(\w)\.video\.id', webpage)
  230. if m_variable_name is not None:
  231. config_re = r'%s=({.+?});' % re.escape(m_variable_name.group(1))
  232. else:
  233. config_re = [r' = {config:({.+?}),assets:', r'(?:[abc])=({.+?});']
  234. config = self._search_regex(config_re, webpage, 'info section',
  235. flags=re.DOTALL)
  236. config = json.loads(config)
  237. except Exception as e:
  238. if re.search('The creator of this video has not given you permission to embed it on this domain.', webpage):
  239. raise ExtractorError('The author has restricted the access to this video, try with the "--referer" option')
  240. if re.search('<form[^>]+?id="pw_form"', webpage) is not None:
  241. self._verify_video_password(url, video_id, webpage)
  242. return self._real_extract(url)
  243. else:
  244. raise ExtractorError('Unable to extract info section',
  245. cause=e)
  246. else:
  247. if config.get('view') == 4:
  248. config = self._verify_player_video_password(url, video_id)
  249. # Extract title
  250. video_title = config["video"]["title"]
  251. # Extract uploader and uploader_id
  252. video_uploader = config["video"]["owner"]["name"]
  253. video_uploader_id = config["video"]["owner"]["url"].split('/')[-1] if config["video"]["owner"]["url"] else None
  254. # Extract video thumbnail
  255. video_thumbnail = config["video"].get("thumbnail")
  256. if video_thumbnail is None:
  257. video_thumbs = config["video"].get("thumbs")
  258. if video_thumbs and isinstance(video_thumbs, dict):
  259. _, video_thumbnail = sorted((int(width if width.isdigit() else 0), t_url) for (width, t_url) in video_thumbs.items())[-1]
  260. # Extract video description
  261. video_description = self._html_search_regex(
  262. r'(?s)<div\s+class="[^"]*description[^"]*"[^>]*>(.*?)</div>',
  263. webpage, 'description', default=None)
  264. if not video_description:
  265. video_description = self._html_search_meta(
  266. 'description', webpage, default=None)
  267. if not video_description and mobj.group('pro'):
  268. orig_webpage = self._download_webpage(
  269. orig_url, video_id,
  270. note='Downloading webpage for description',
  271. fatal=False)
  272. if orig_webpage:
  273. video_description = self._html_search_meta(
  274. 'description', orig_webpage, default=None)
  275. if not video_description and not mobj.group('player'):
  276. self._downloader.report_warning('Cannot find video description')
  277. # Extract video duration
  278. video_duration = int_or_none(config["video"].get("duration"))
  279. # Extract upload date
  280. video_upload_date = None
  281. mobj = re.search(r'<meta itemprop="dateCreated" content="(\d{4})-(\d{2})-(\d{2})T', webpage)
  282. if mobj is not None:
  283. video_upload_date = mobj.group(1) + mobj.group(2) + mobj.group(3)
  284. try:
  285. view_count = int(self._search_regex(r'UserPlays:(\d+)', webpage, 'view count'))
  286. like_count = int(self._search_regex(r'UserLikes:(\d+)', webpage, 'like count'))
  287. comment_count = int(self._search_regex(r'UserComments:(\d+)', webpage, 'comment count'))
  288. except RegexNotFoundError:
  289. # This info is only available in vimeo.com/{id} urls
  290. view_count = None
  291. like_count = None
  292. comment_count = None
  293. # Vimeo specific: extract request signature and timestamp
  294. sig = config['request']['signature']
  295. timestamp = config['request']['timestamp']
  296. # Vimeo specific: extract video codec and quality information
  297. # First consider quality, then codecs, then take everything
  298. codecs = [('vp6', 'flv'), ('vp8', 'flv'), ('h264', 'mp4')]
  299. files = {'hd': [], 'sd': [], 'other': []}
  300. config_files = config["video"].get("files") or config["request"].get("files")
  301. for codec_name, codec_extension in codecs:
  302. for quality in config_files.get(codec_name, []):
  303. format_id = '-'.join((codec_name, quality)).lower()
  304. key = quality if quality in files else 'other'
  305. video_url = None
  306. if isinstance(config_files[codec_name], dict):
  307. file_info = config_files[codec_name][quality]
  308. video_url = file_info.get('url')
  309. else:
  310. file_info = {}
  311. if video_url is None:
  312. video_url = "http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s&quality=%s&codecs=%s&type=moogaloop_local&embed_location=" \
  313. % (video_id, sig, timestamp, quality, codec_name.upper())
  314. files[key].append({
  315. 'ext': codec_extension,
  316. 'url': video_url,
  317. 'format_id': format_id,
  318. 'width': file_info.get('width'),
  319. 'height': file_info.get('height'),
  320. })
  321. formats = []
  322. for key in ('other', 'sd', 'hd'):
  323. formats += files[key]
  324. if len(formats) == 0:
  325. raise ExtractorError('No known codec found')
  326. subtitles = {}
  327. text_tracks = config['request'].get('text_tracks')
  328. if text_tracks:
  329. for tt in text_tracks:
  330. subtitles[tt['lang']] = 'http://vimeo.com' + tt['url']
  331. video_subtitles = self.extract_subtitles(video_id, subtitles)
  332. if self._downloader.params.get('listsubtitles', False):
  333. self._list_available_subtitles(video_id, subtitles)
  334. return
  335. return {
  336. 'id': video_id,
  337. 'uploader': video_uploader,
  338. 'uploader_id': video_uploader_id,
  339. 'upload_date': video_upload_date,
  340. 'title': video_title,
  341. 'thumbnail': video_thumbnail,
  342. 'description': video_description,
  343. 'duration': video_duration,
  344. 'formats': formats,
  345. 'webpage_url': url,
  346. 'view_count': view_count,
  347. 'like_count': like_count,
  348. 'comment_count': comment_count,
  349. 'subtitles': video_subtitles,
  350. }
  351. class VimeoChannelIE(InfoExtractor):
  352. IE_NAME = 'vimeo:channel'
  353. _VALID_URL = r'https?://vimeo\.com/channels/(?P<id>[^/?#]+)/?(?:$|[?#])'
  354. _MORE_PAGES_INDICATOR = r'<a.+?rel="next"'
  355. _TITLE_RE = r'<link rel="alternate"[^>]+?title="(.*?)"'
  356. _TESTS = [{
  357. 'url': 'http://vimeo.com/channels/tributes',
  358. 'info_dict': {
  359. 'title': 'Vimeo Tributes',
  360. },
  361. 'playlist_mincount': 25,
  362. }]
  363. def _page_url(self, base_url, pagenum):
  364. return '%s/videos/page:%d/' % (base_url, pagenum)
  365. def _extract_list_title(self, webpage):
  366. return self._html_search_regex(self._TITLE_RE, webpage, 'list title')
  367. def _extract_videos(self, list_id, base_url):
  368. video_ids = []
  369. for pagenum in itertools.count(1):
  370. webpage = self._download_webpage(
  371. self._page_url(base_url, pagenum), list_id,
  372. 'Downloading page %s' % pagenum)
  373. video_ids.extend(re.findall(r'id="clip_(\d+?)"', webpage))
  374. if re.search(self._MORE_PAGES_INDICATOR, webpage, re.DOTALL) is None:
  375. break
  376. entries = [self.url_result('http://vimeo.com/%s' % video_id, 'Vimeo')
  377. for video_id in video_ids]
  378. return {'_type': 'playlist',
  379. 'id': list_id,
  380. 'title': self._extract_list_title(webpage),
  381. 'entries': entries,
  382. }
  383. def _real_extract(self, url):
  384. mobj = re.match(self._VALID_URL, url)
  385. channel_id = mobj.group('id')
  386. return self._extract_videos(channel_id, 'http://vimeo.com/channels/%s' % channel_id)
  387. class VimeoUserIE(VimeoChannelIE):
  388. IE_NAME = 'vimeo:user'
  389. _VALID_URL = r'https?://vimeo\.com/(?![0-9]+(?:$|[?#/]))(?P<name>[^/]+)(?:/videos|[#?]|$)'
  390. _TITLE_RE = r'<a[^>]+?class="user">([^<>]+?)</a>'
  391. _TESTS = [{
  392. 'url': 'http://vimeo.com/nkistudio/videos',
  393. 'info_dict': {
  394. 'title': 'Nki',
  395. },
  396. 'playlist_mincount': 66,
  397. }]
  398. def _real_extract(self, url):
  399. mobj = re.match(self._VALID_URL, url)
  400. name = mobj.group('name')
  401. return self._extract_videos(name, 'http://vimeo.com/%s' % name)
  402. class VimeoAlbumIE(VimeoChannelIE):
  403. IE_NAME = 'vimeo:album'
  404. _VALID_URL = r'https?://vimeo\.com/album/(?P<id>\d+)'
  405. _TITLE_RE = r'<header id="page_header">\n\s*<h1>(.*?)</h1>'
  406. _TESTS = [{
  407. 'url': 'http://vimeo.com/album/2632481',
  408. 'info_dict': {
  409. 'title': 'Staff Favorites: November 2013',
  410. },
  411. 'playlist_mincount': 13,
  412. }]
  413. def _page_url(self, base_url, pagenum):
  414. return '%s/page:%d/' % (base_url, pagenum)
  415. def _real_extract(self, url):
  416. mobj = re.match(self._VALID_URL, url)
  417. album_id = mobj.group('id')
  418. return self._extract_videos(album_id, 'http://vimeo.com/album/%s' % album_id)
  419. class VimeoGroupsIE(VimeoAlbumIE):
  420. IE_NAME = 'vimeo:group'
  421. _VALID_URL = r'(?:https?://)?vimeo\.com/groups/(?P<name>[^/]+)'
  422. _TESTS = [{
  423. 'url': 'http://vimeo.com/groups/rolexawards',
  424. 'info_dict': {
  425. 'title': 'Rolex Awards for Enterprise',
  426. },
  427. 'playlist_mincount': 73,
  428. }]
  429. def _extract_list_title(self, webpage):
  430. return self._og_search_title(webpage)
  431. def _real_extract(self, url):
  432. mobj = re.match(self._VALID_URL, url)
  433. name = mobj.group('name')
  434. return self._extract_videos(name, 'http://vimeo.com/groups/%s' % name)
  435. class VimeoReviewIE(InfoExtractor):
  436. IE_NAME = 'vimeo:review'
  437. IE_DESC = 'Review pages on vimeo'
  438. _VALID_URL = r'https?://vimeo\.com/[^/]+/review/(?P<id>[^/]+)'
  439. _TESTS = [{
  440. 'url': 'https://vimeo.com/user21297594/review/75524534/3c257a1b5d',
  441. 'file': '75524534.mp4',
  442. 'md5': 'c507a72f780cacc12b2248bb4006d253',
  443. 'info_dict': {
  444. 'title': "DICK HARDWICK 'Comedian'",
  445. 'uploader': 'Richard Hardwick',
  446. }
  447. }, {
  448. 'note': 'video player needs Referer',
  449. 'url': 'http://vimeo.com/user22258446/review/91613211/13f927e053',
  450. 'md5': '6295fdab8f4bf6a002d058b2c6dce276',
  451. 'info_dict': {
  452. 'id': '91613211',
  453. 'ext': 'mp4',
  454. 'title': 'Death by dogma versus assembling agile - Sander Hoogendoorn',
  455. 'uploader': 'DevWeek Events',
  456. 'duration': 2773,
  457. 'thumbnail': 're:^https?://.*\.jpg$',
  458. }
  459. }]
  460. def _real_extract(self, url):
  461. mobj = re.match(self._VALID_URL, url)
  462. video_id = mobj.group('id')
  463. player_url = 'https://player.vimeo.com/player/' + video_id
  464. return self.url_result(player_url, 'Vimeo', video_id)
  465. class VimeoWatchLaterIE(VimeoBaseInfoExtractor, VimeoChannelIE):
  466. IE_NAME = 'vimeo:watchlater'
  467. IE_DESC = 'Vimeo watch later list, "vimeowatchlater" keyword (requires authentication)'
  468. _VALID_URL = r'https?://vimeo\.com/home/watchlater|:vimeowatchlater'
  469. _LOGIN_REQUIRED = True
  470. _TITLE_RE = r'href="/home/watchlater".*?>(.*?)<'
  471. _TESTS = [{
  472. 'url': 'http://vimeo.com/home/watchlater',
  473. 'only_matching': True,
  474. }]
  475. def _real_initialize(self):
  476. self._login()
  477. def _page_url(self, base_url, pagenum):
  478. url = '%s/page:%d/' % (base_url, pagenum)
  479. request = compat_urllib_request.Request(url)
  480. # Set the header to get a partial html page with the ids,
  481. # the normal page doesn't contain them.
  482. request.add_header('X-Requested-With', 'XMLHttpRequest')
  483. return request
  484. def _real_extract(self, url):
  485. return self._extract_videos('watchlater', 'https://vimeo.com/home/watchlater')
  486. class VimeoLikesIE(InfoExtractor):
  487. _VALID_URL = r'https?://(?:www\.)?vimeo\.com/user(?P<id>[0-9]+)/likes/?(?:$|[?#]|sort:)'
  488. IE_NAME = 'vimeo:likes'
  489. IE_DESC = 'Vimeo user likes'
  490. _TEST = {
  491. 'url': 'https://vimeo.com/user755559/likes/',
  492. 'playlist_mincount': 293,
  493. "info_dict": {
  494. "description": "See all the videos urza likes",
  495. "title": 'Videos urza likes',
  496. },
  497. }
  498. def _real_extract(self, url):
  499. user_id = self._match_id(url)
  500. webpage = self._download_webpage(url, user_id)
  501. page_count = self._int(
  502. self._search_regex(
  503. r'''(?x)<li><a\s+href="[^"]+"\s+data-page="([0-9]+)">
  504. .*?</a></li>\s*<li\s+class="pagination_next">
  505. ''', webpage, 'page count'),
  506. 'page count', fatal=True)
  507. PAGE_SIZE = 12
  508. title = self._html_search_regex(
  509. r'(?s)<h1>(.+?)</h1>', webpage, 'title', fatal=False)
  510. description = self._html_search_meta('description', webpage)
  511. def _get_page(idx):
  512. page_url = '%s//vimeo.com/user%s/likes/page:%d/sort:date' % (
  513. self.http_scheme(), user_id, idx + 1)
  514. webpage = self._download_webpage(
  515. page_url, user_id,
  516. note='Downloading page %d/%d' % (idx + 1, page_count))
  517. video_list = self._search_regex(
  518. r'(?s)<ol class="js-browse_list[^"]+"[^>]*>(.*?)</ol>',
  519. webpage, 'video content')
  520. paths = re.findall(
  521. r'<li[^>]*>\s*<a\s+href="([^"]+)"', video_list)
  522. for path in paths:
  523. yield {
  524. '_type': 'url',
  525. 'url': compat_urlparse.urljoin(page_url, path),
  526. }
  527. pl = InAdvancePagedList(_get_page, page_count, PAGE_SIZE)
  528. return {
  529. '_type': 'playlist',
  530. 'id': 'user%s_likes' % user_id,
  531. 'title': title,
  532. 'description': description,
  533. 'entries': pl,
  534. }