1 from .common
import InfoExtractor
4 class CaltransIE(InfoExtractor
):
5 _VALID_URL
= r
'https?://(?:[^/]+\.)?ca\.gov/vm/loc/[^/]+/(?P<id>[a-z0-9_]+)\.htm'
7 'url': 'https://cwwp2.dot.ca.gov/vm/loc/d3/hwy50at24th.htm',
11 'title': 'US-50 : Sacramento : Hwy 50 at 24th',
12 'live_status': 'is_live',
13 'thumbnail': 'https://cwwp2.dot.ca.gov/data/d3/cctv/image/hwy50at24th/hwy50at24th.jpg',
17 def _real_extract(self
, url
):
18 video_id
= self
._match
_id
(url
)
19 webpage
= self
._download
_webpage
(url
, video_id
)
21 global_vars
= self
._search
_regex
(
22 r
'<script[^<]+?([^<]+\.m3u8[^<]+)</script>',
23 webpage
, 'Global Vars')
24 route_place
= self
._search
_regex
(r
'routePlace\s*=\s*"([^"]+)"', global_vars
, 'Route Place', fatal
=False)
25 location_name
= self
._search
_regex
(r
'locationName\s*=\s*"([^"]+)"', global_vars
, 'Location Name', fatal
=False)
26 poster_url
= self
._search
_regex
(r
'posterURL\s*=\s*"([^"]+)"', global_vars
, 'Poster Url', fatal
=False)
27 video_stream
= self
._search
_regex
(r
'videoStreamURL\s*=\s*"([^"]+)"', global_vars
, 'Video Stream URL', fatal
=False)
29 formats
= self
._extract
_m
3u8_formats
(video_stream
, video_id
, 'ts', live
=True)
33 'title': f
'{route_place} : {location_name}',
36 'thumbnail': poster_url
,