Advertisement
urgoz

m3_old1

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