似乎修复「KeyError: courseId」

master
Mufanc 3 years ago
parent d4bdc59050
commit 0a569f872c

@ -64,6 +64,8 @@ class Browser(object):
pages = (await client.get(f'http://127.0.0.1:{self.port}/json')).json() pages = (await client.get(f'http://127.0.0.1:{self.port}/json')).json()
for page in pages: for page in pages:
params = dict(parser.parse_qsl(parser.urlsplit(page['url']).query)) params = dict(parser.parse_qsl(parser.urlsplit(page['url']).query))
if 'courseId' not in params:
continue
if 'bookId' in params: if 'bookId' in params:
return params['courseId'], params['bookId'] return params['courseId'], params['bookId']
return params['courseId'], None return params['courseId'], None

Loading…
Cancel
Save