Compare commits

..

2 Commits

Author SHA1 Message Date
schn0sch
c2a8547fdc
[peekvids] Add extractor (#2414)
Authored by: schn0sch
2022-02-14 19:21:27 -08:00
Bricio
0a19532ead
[Caltrans] Add extractor (#2781)
Closes #2775

Authored by: Bricio
2022-02-14 18:45:36 -08:00
3 changed files with 128 additions and 0 deletions

View File

@ -0,0 +1,41 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class CaltransIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/]+\.)?ca\.gov/vm/loc/[^/]+/(?P<id>[a-z0-9_]+)\.htm'
_TEST = {
'url': 'https://cwwp2.dot.ca.gov/vm/loc/d3/hwy50at24th.htm',
'info_dict': {
'id': 'hwy50at24th',
'ext': 'ts',
'title': 'US-50 : Sacramento : Hwy 50 at 24th',
'live_status': 'is_live',
'thumbnail': 'https://cwwp2.dot.ca.gov/data/d3/cctv/image/hwy50at24th/hwy50at24th.jpg',
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
global_vars = self._search_regex(
r'<script[^<]+?([^<]+\.m3u8[^<]+)</script>',
webpage, 'Global Vars')
route_place = self._search_regex(r'routePlace\s*=\s*"([^"]+)"', global_vars, 'Route Place', fatal=False)
location_name = self._search_regex(r'locationName\s*=\s*"([^"]+)"', global_vars, 'Location Name', fatal=False)
poster_url = self._search_regex(r'posterURL\s*=\s*"([^"]+)"', global_vars, 'Poster Url', fatal=False)
video_stream = self._search_regex(r'videoStreamURL\s*=\s*"([^"]+)"', global_vars, 'Video Stream URL', fatal=False)
formats = self._extract_m3u8_formats(video_stream, video_id, 'ts', live=True)
self._sort_formats(formats)
return {
'id': video_id,
'title': f'{route_place} : {location_name}',
'is_live': True,
'formats': formats,
'thumbnail': poster_url,
}

View File

@ -195,6 +195,7 @@ from .byutv import BYUtvIE
from .c56 import C56IE from .c56 import C56IE
from .cableav import CableAVIE from .cableav import CableAVIE
from .callin import CallinIE from .callin import CallinIE
from .caltrans import CaltransIE
from .cam4 import CAM4IE from .cam4 import CAM4IE
from .camdemy import ( from .camdemy import (
CamdemyIE, CamdemyIE,
@ -1140,6 +1141,7 @@ from .patreon import (
) )
from .pbs import PBSIE from .pbs import PBSIE
from .pearvideo import PearVideoIE from .pearvideo import PearVideoIE
from .peekvids import PeekVidsIE, PlayVidsIE
from .peertube import ( from .peertube import (
PeerTubeIE, PeerTubeIE,
PeerTubePlaylistIE, PeerTubePlaylistIE,

View File

@ -0,0 +1,85 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import remove_end
class PeekVidsIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://(?:www\.)?peekvids\.com/
(?:(?:[^/?#]+/){2}|embed/?\?(?:[^#]*&)?v=)
(?P<id>[^/?&#]*)
'''
_TESTS = [{
'url': 'https://peekvids.com/pc/dane-jones-cute-redhead-with-perfect-tits-with-mini-vamp/BSyLMbN0YCd',
'md5': '2ff6a357a9717dc9dc9894b51307e9a2',
'info_dict': {
'id': 'BSyLMbN0YCd',
'ext': 'mp4',
'title': 'Dane Jones - Cute redhead with perfect tits with Mini Vamp',
'age_limit': 18,
},
}]
_DOMAIN = 'www.peekvids.com'
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
short_video_id = self._html_search_regex(r'<video [^>]*data-id="(.+?)"', webpage, 'short video ID')
srcs = self._download_json(
f'https://{self._DOMAIN}/v-alt/{short_video_id}', video_id,
note='Downloading list of source files')
formats = [{
'url': url,
'ext': 'mp4',
'format_id': name[8:],
} for name, url in srcs.items() if len(name) > 8 and name.startswith('data-src')]
if not formats:
formats = [{'url': url} for url in srcs.values()]
self._sort_formats(formats)
title = remove_end(self._html_search_regex(
(r'<h1.*?>\s*(.+?)\s*</h1>', r'<title>\s*(.+?)\s*</title>'),
webpage, 'video title', default=None), ' - PeekVids')
return {
'id': video_id,
'title': title,
'age_limit': 18,
'formats': formats,
}
class PlayVidsIE(PeekVidsIE):
_VALID_URL = r'https?://(?:www\.)?playvids\.com/(?:embed/|[^/]{2}/)?(?P<id>[^/?#]*)'
_TESTS = [{
'url': 'https://www.playvids.com/U3pBrYhsjXM/pc/dane-jones-cute-redhead-with-perfect-tits-with-mini-vamp',
'md5': '2f12e50213dd65f142175da633c4564c',
'info_dict': {
'id': 'U3pBrYhsjXM',
'ext': 'mp4',
'title': 'Dane Jones - Cute redhead with perfect tits with Mini Vamp',
'age_limit': 18,
},
}, {
'url': 'https://www.playvids.com/es/U3pBrYhsjXM/pc/dane-jones-cute-redhead-with-perfect-tits-with-mini-vamp',
'md5': '2f12e50213dd65f142175da633c4564c',
'info_dict': {
'id': 'U3pBrYhsjXM',
'ext': 'mp4',
'title': 'Dane Jones - Cute redhead with perfect tits with Mini Vamp',
'age_limit': 18,
},
}, {
'url': 'https://www.playvids.com/embed/U3pBrYhsjXM',
'md5': '2f12e50213dd65f142175da633c4564c',
'info_dict': {
'id': 'U3pBrYhsjXM',
'ext': 'mp4',
'title': 'U3pBrYhsjXM',
'age_limit': 18,
},
}]
_DOMAIN = 'www.playvids.com'