Plugin.nicolive:resolve API format change (#3061)

- Currently, “broadcast_id” field of Nicolive api is not needed.
- Fail early if `self.wss_api_url` is None

Co-authored-by: back-to <backto@protonmail.ch>
This commit is contained in:
tnira 2020-07-06 16:16:58 +09:00 committed by GitHub
parent cec8761bce
commit adb0307181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 8 deletions

View File

@ -108,18 +108,13 @@ class NicoLive(Plugin):
try:
self.wss_api_url = extract_text(
resp.text, "&quot;webSocketUrl&quot;:&quot;", "&quot;")
if not self.wss_api_url:
return False
except Exception as e:
_log.debug(e)
_log.debug("Failed to extract wss api url")
return False
try:
self.broadcast_id = extract_text(
resp.text, "&quot;broadcastId&quot;:&quot;", "&quot;")
except Exception as e:
_log.debug(e)
_log.warning("Failed to extract broadcast id")
try:
self.frontend_id = extract_text(
resp.text, "&quot;frontendId&quot;:", ",&quot;")
@ -132,7 +127,6 @@ class NicoLive(Plugin):
_log.debug("Video page response code: {0}".format(resp.status_code))
_log.trace(u"Video page response body: {0}".format(resp.text))
_log.debug("Got wss_api_url: {0}".format(self.wss_api_url))
_log.debug("Got broadcast_id: {0}".format(self.broadcast_id))
_log.debug("Got frontend_id: {0}".format(self.frontend_id))
return self.wss_api_url.startswith("wss://")