def update_streaming_url_web(self):
"""Updates streaming urls from the showroom website.
Fallback if api changes again"""
r = self._session.get(self._room.long_url)
if r.ok:
match = hls_url_re1.search(r.text)
# TODO: check if there was a match
if not match:
# no url found in the page
# probably the stream has ended but is_live returned true
# just don't update the urls
# except what happens if they are still "" ?
return
hls_url = match.group(0)
rtmps_url = match.group(1).replace('https', 'rtmps')
rtmp_url = "rtmp://{}.{}.{}.{}:1935/liveedge/{}".format(*match.groups()[1:])
with self._lock:
self._rtmp_url = rtmp_url
self._hls_url = hls_url
self._rtmps_url = rtmps_url
评论列表
文章目录