]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/learnr.py
[JWPlatform] Use non-capturing group in RE
[youtube-dl] / youtube_dl / extractor / learnr.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class LearnrIE(InfoExtractor):
8     _VALID_URL = r'https?://(?:www\.)?learnr\.pro/view/video/(?P<id>[0-9]+)'
9     _TEST = {
10         'url': 'http://www.learnr.pro/view/video/51624-web-development-tutorial-for-beginners-1-how-to-build-webpages-with-html-css-javascript',
11         'md5': '3719fdf0a68397f49899e82c308a89de',
12         'info_dict': {
13             'id': '51624',
14             'ext': 'mp4',
15             'title': 'Web Development Tutorial for Beginners (#1) - How to build webpages with HTML, CSS, Javascript',
16             'description': 'md5:b36dbfa92350176cdf12b4d388485503',
17             'uploader': 'LearnCode.academy',
18             'uploader_id': 'learncodeacademy',
19             'upload_date': '20131021',
20         },
21         'add_ie': ['Youtube'],
22     }
23
24     def _real_extract(self, url):
25         video_id = self._match_id(url)
26         webpage = self._download_webpage(url, video_id)
27
28         return {
29             '_type': 'url_transparent',
30             'url': self._search_regex(
31                 r"videoId\s*:\s*'([^']+)'", webpage, 'youtube id'),
32             'id': video_id,
33         }