Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins.goodgame: Update for API change #1527

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions src/livestreamer/plugins/goodgame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,16 @@
from livestreamer.plugin.api import http
from livestreamer.stream import HLSStream

HLS_URL_FORMAT = "http://hls.goodgame.ru/hls/{0}{1}.m3u8"
HLS_URL_FORMAT = "https://hls.goodgame.ru/hls/{0}{1}.m3u8"
QUALITIES = {
"1080p": "",
"720p": "_720",
"480p": "_480",
"240p": "_240"
}

_url_re = re.compile("http://(?:www\.)?goodgame.ru/channel/(?P<user>\w+)")
_stream_re = re.compile(
"iframe frameborder=\"0\" width=\"100%\" height=\"100%\" src=\"http://goodgame.ru/player(\d)?\?(\w+)\""
)
_ddos_re = re.compile(
"document.cookie=\"(__DDOS_[^;]+)"
)
_url_re = re.compile("https://(?:www\.)?goodgame.ru/channel/(?P<user>\w+)")
_stream_re = re.compile(r'var src = "([^"]+)";')

class GoodGame(Plugin):
@classmethod
Expand All @@ -36,16 +31,11 @@ def _get_streams(self):
}
res = http.get(self.url, headers=headers)

match = _ddos_re.search(res.text)
if (match):
headers["Cookie"] = match.group(1)
res = http.get(self.url, headers=headers)

match = _stream_re.search(res.text)
if not match:
return

stream_id = match.group(2)
stream_id = match.group(1)
streams = {}
for name, url_suffix in QUALITIES.items():
url = HLS_URL_FORMAT.format(stream_id, url_suffix)
Expand Down