Advertisement
urgoz

m3_old2

Jul 21st, 2023 (edited)
1,669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. import re
  2. from streamlink.plugin import Plugin, pluginmatcher
  3. from streamlink.stream import HLSStream
  4. from streamlink.plugin.api import useragents
  5.  
  6. @pluginmatcher(re.compile(r'https?://archivum.mtva.hu/m3'))
  7.  
  8. class M3(Plugin):
  9.     def _get_streams(self):
  10.         headers = {"User-Agent": useragents.CHROME,
  11.                    "Referer": "https://archivum.mtva.hu/m3",
  12.                   }
  13.         body = self.session.http.get('https://archivum.mtva.hu/api/m3/v3/stream?target=live', headers=headers).text
  14.         mrl = None
  15.         match = re.search(r'url":"(.*?)\"', body)
  16.         if match:
  17.             mrl = match.group(1).replace('\/','/').replace("HLS.smil","nodrm.smil")
  18.         if mrl:
  19.             return HLSStream.parse_variant_playlist(self.session, mrl, headers=headers)
  20.  
  21. __plugin__ = M3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement