Skip to content

Instantly share code, notes, and snippets.

@intact
Last active July 13, 2017 21:16
Show Gist options
  • Save intact/3ca1e0ea0e8051d8956816ec8d1aee53 to your computer and use it in GitHub Desktop.
Save intact/3ca1e0ea0e8051d8956816ec8d1aee53 to your computer and use it in GitHub Desktop.
Arconai Tv plugin for livestreamer
import re
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http
from livestreamer.plugin.api.utils import parse_json
from livestreamer.stream import HLSStream
_url_re = re.compile(r"https?://www\.arconaitv\.me/stream\.php\?id=\d+")
SOURCE_RE = re.compile(r'source +src="([^"]+)" ')
USER_AGENT = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36"
class ArconaiTv(Plugin):
@classmethod
def can_handle_url(cls, url):
return _url_re.match(url)
def _get_streams(self):
page = http.get(self.url)
match = SOURCE_RE.search(page.text)
if match is None or not match.group(1).endswith(".m3u8"):
return
yield "live", HLSStream(self.session, match.group(1), headers={"User-Agent": USER_AGENT, 'Referer': self.url})
__plugin__ = ArconaiTv
@lokmiin
Copy link

lokmiin commented May 28, 2017

@Intac
Hello Sir Intac,
You are such honorable person. It take only a couple hours.
I already got responded from you with working plugin.
Thank you very much.

@cirrusUK
Copy link

thanks for this cousin ++

@unlocKing
Copy link

Site has been updated, please take a look.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment