Fix for #1 : core_multithread

This commit is contained in:
taizan-hokuto
2020-02-01 01:25:42 +09:00
parent bbf7a2906a
commit 0d8ecb778f
2 changed files with 8 additions and 5 deletions

View File

@@ -73,7 +73,6 @@ class LiveChatAsync:
'''
_setup_finished = False
_logger = config.logger(__name__)
def __init__(self, video_id,
seektime = 0,
@@ -249,8 +248,7 @@ class LiveChatAsync:
continuation = urllib.parse.quote(continuation)
livechat_json = None
status_code = 0
url =(
f"https://www.youtube.com/{self._fetch_url}{continuation}&pbj=1")
url =f"https://www.youtube.com/{self._fetch_url}{continuation}&pbj=1"
for _ in range(MAX_RETRY + 1):
async with session.get(url ,headers = headers) as resp:
try:

View File

@@ -74,7 +74,6 @@ class LiveChat:
_setup_finished = False
#チャット監視中のListenerのリスト
_listeners = []
_logger = config.logger(__name__)
def __init__(self, video_id,
seektime = 0,
@@ -222,9 +221,15 @@ class LiveChat:
'''Try to fetch archive chat data.'''
self._parser.is_replay = True
self._fetch_url = "live_chat_replay/get_live_chat_replay?continuation="
continuation = arcparam.getparam(self.video_id, self.seektime)
continuation = arcparam.getparam(
self.video_id, self.seektime, self._topchat_only)
livechat_json = ( self._get_livechat_json(
continuation, session, headers))
reload_continuation = self._parser.reload_continuation(
self._parser.get_contents(livechat_json))
if reload_continuation:
livechat_json = (self._get_livechat_json(
reload_continuation, session, headers))
contents = self._parser.get_contents(livechat_json)
self._first_fetch = False
return contents