skylinewebcams.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from .common import InfoExtractor
  2. class SkylineWebcamsIE(InfoExtractor):
  3. _VALID_URL = r'https?://(?:www\.)?skylinewebcams\.com/[^/]+/webcam/(?:[^/]+/)+(?P<id>[^/]+)\.html'
  4. _TEST = {
  5. 'url': 'https://www.skylinewebcams.com/it/webcam/italia/lazio/roma/scalinata-piazza-di-spagna-barcaccia.html',
  6. 'info_dict': {
  7. 'id': 'scalinata-piazza-di-spagna-barcaccia',
  8. 'ext': 'mp4',
  9. '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}$',
  10. 'description': 'Roma, veduta sulla Scalinata di Piazza di Spagna e sulla Barcaccia',
  11. 'is_live': True,
  12. },
  13. 'params': {
  14. 'skip_download': True,
  15. }
  16. }
  17. def _real_extract(self, url):
  18. video_id = self._match_id(url)
  19. webpage = self._download_webpage(url, video_id)
  20. stream_url = self._search_regex(
  21. r'(?:url|source)\s*:\s*(["\'])(?P<url>(?:https?:)?//.+?\.m3u8.*?)\1', webpage,
  22. 'stream url', group='url')
  23. title = self._og_search_title(webpage)
  24. description = self._og_search_description(webpage)
  25. return {
  26. 'id': video_id,
  27. 'url': stream_url,
  28. 'ext': 'mp4',
  29. 'title': title,
  30. 'description': description,
  31. 'is_live': True,
  32. }