Advertisement
urgoz

m3_old3

Feb 23rd, 2024 (edited)
979
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 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. import requests
  6. from urllib3.exceptions import InsecureRequestWarning
  7.  
  8. @pluginmatcher(re.compile(r'https?://archivum.mtva.hu/m3'))
  9. @pluginmatcher(re.compile(r'https?://nemzetiarchivum.hu/m3'))
  10.  
  11. class M3(Plugin):
  12.     def _get_streams(self):
  13.         self.session.http.verify = False
  14.         requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
  15.         headers = {"User-Agent": useragents.CHROME,
  16.                    "Referer": "https://nemzetiarchivum.hu/m3",
  17.                   }
  18.         body = self.session.http.get('https://nemzetiarchivum.hu/api/m3/v3/stream?target=live', headers=headers).text
  19.         mrl = None
  20.         match = re.search(r'type":"hls","url":"(.*?)\"', body)
  21.         if match:
  22.             mrl = match.group(1).replace('\/','/').replace("HLS.smil","nodrm.smil")
  23.         if mrl:
  24.             return HLSStream.parse_variant_playlist(self.session, mrl, headers=headers)
  25.  
  26. __plugin__ = M3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement