]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/skylinewebcams.py
Prepare to release
[youtubedl] / youtube_dl / extractor / skylinewebcams.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class SkylineWebcamsIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?skylinewebcams\.com/[^/]+/webcam/(?:[^/]+/)+(?P<id>[^/]+)\.html'
9 _TEST = {
10 'url': 'https://www.skylinewebcams.com/it/webcam/italia/lazio/roma/scalinata-piazza-di-spagna-barcaccia.html',
11 'info_dict': {
12 'id': 'scalinata-piazza-di-spagna-barcaccia',
13 'ext': 'mp4',
14 'title': 're:^Live Webcam Scalinata di Piazza di Spagna - La Barcaccia [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
15 'description': 'Roma, veduta sulla Scalinata di Piazza di Spagna e sulla Barcaccia',
16 'is_live': True,
17 },
18 'params': {
19 'skip_download': True,
20 }
21 }
22
23 def _real_extract(self, url):
24 video_id = self._match_id(url)
25
26 webpage = self._download_webpage(url, video_id)
27
28 stream_url = self._search_regex(
29 r'url\s*:\s*(["\'])(?P<url>(?:https?:)?//.+?\.m3u8.*?)\1', webpage,
30 'stream url', group='url')
31
32 title = self._og_search_title(webpage)
33 description = self._og_search_description(webpage)
34
35 return {
36 'id': video_id,
37 'url': stream_url,
38 'ext': 'mp4',
39 'title': self._live_title(title),
40 'description': description,
41 'is_live': True,
42 }