Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
更新有道词典API,解决首次登录无法唤出登陆页的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
megachweng committed Mar 16, 2021
1 parent 7a7761c commit 2ad9c17
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion addon/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = 'v6.1.4'
VERSION = 'v6.1.5'
RELEASE_URL = 'https://github.com/megachweng/Dict2Anki'
VERSION_CHECK_API = 'https://api.github.com/repos/megachweng/Dict2Anki/releases/latest'
MODEL_NAME = f'Dict2Anki-{VERSION}'
Expand Down
5 changes: 1 addition & 4 deletions addon/dictionary/youdao.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import re
import hashlib
import logging
from math import ceil

import requests
from bs4 import BeautifulSoup
from urllib3.util.retry import Retry
Expand Down Expand Up @@ -36,7 +33,7 @@ def checkCookie(self, cookie: dict) -> bool:
:return: bool
"""
rsp = requests.get('http://dict.youdao.com/login/acc/query/accountinfo', cookies=cookie, headers=self.headers)
if rsp.json()['code'] == 0:
if rsp.json().get('code', None) == 0:
self.indexSoup = BeautifulSoup(rsp.text, features="html.parser")
logger.info('Cookie有效')
cookiesJar = requests.utils.cookiejar_from_dict(cookie, cookiejar=None, overwrite=True)
Expand Down
2 changes: 2 additions & 0 deletions anki_addon_page.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<strong>Dict2Anki</strong> 是一款方便<a href="http://cidian.youdao.com/multi.html" rel="nofollow">有道词典</a>、<a href="https://www.eudic.net/" rel="nofollow">欧陆词典</a>用户同步生成单词本卡片至<a href="https://apps.ankiweb.net/#download" rel="nofollow">Anki</a>的插件

<strong>Change Logs</strong>:
<strong>v6.1.5</strong>:
更新有道词典API,解决首次登录无法唤出登陆页的问题
<strong>v6.1.4</strong>:
修复Anki 2.1.4版本同步失败的问题 THX to <a href="https://github.com/megachweng/Dict2Anki/pull/92">@YLongo</a>
修复Anki 2.1.4版本首次同步默认到Default Deck的问题
Expand Down

0 comments on commit 2ad9c17

Please sign in to comment.