Giter VIP home page Giter VIP logo

anki_cambridge's Introduction

Publish on ankiweb.net

Anki Add-on for integration with Cambridge Dictionary website - https://dictionary.cambridge.org/

IMPORTANT: This add-on doesn't use official API - only web-scraping.

What it's new:

  • Upgraded to Qt6
  • Creating notes from link to a word (word title, definition, grammar, IPA, sound, meanings, examples)
  • Fetching words from your word lists (with auto-deletion)
  • Config settings management - save cookie, word list IDs
  • Native authentication - through Cambridge account

Auth with native authentication

  • Click on Sign in
  • Write your Cambridge email and password
  • Click on Log in
  • Once you are authenticated, you can close the web window
  • The cookie will be stored automatically in the configuration

Development

Official Anki Add-on writing reference

anki_cambridge's People

Contributors

am-silex avatar christianavila avatar fedy2 avatar the-man-w-laughs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

anki_cambridge's Issues

Add-on compatibility with Anki Qt6

Anki 23.12.1 (1a1d4d54) (ao)
Python 3.9.15 Qt 6.5.3 PyQt 6.5.3
Platform: macOS-14.2.1-x86_64-i386-64bit
Anki message :
The following add-ons failed to load: ⁨
Cambridge Dictionary
They may need to be updated to support this version of Anki. Click the Check for Updates button to see if any updates are available.
You can use the Copy Debug Info button to get information that you can paste in a report to the add-on author.
For add-ons that don't have an update available, you can disable or delete the add-on to prevent this message from appearing.

Debug info:

When loading Cambridge Dictionary:
Traceback (most recent call last):
File "aqt.addons", line 245, in loadAddons
File "/Users/den/Library/Application Support/Anki2/addons21/1875288089/init.py", line 19, in
from . import main
File "/Users/den/Library/Application Support/Anki2/addons21/1875288089/main.py", line 12, in
from .gui import *
File "/Users/den/Library/Application Support/Anki2/addons21/1875288089/gui.py", line 15, in
from PyQt5.QtGui import QIcon, QFont
ModuleNotFoundError: No module named 'PyQt5'

Please help me, I'm desperate

I don't know how many videos I've already seen or post to figure out how to copy the cookie of my profile at Cambridge. Please, would you be available to write a guideline or at least a video. Thanks!

Fetching failed

Fetching failed:
Traceback (most recent call last):
File "C:\Users\allen\AppData\Roaming\Anki2\addons21\1875288089\gui.py", line 538, in run
self._fetch_wordlist()
File "C:\Users\allen\AppData\Roaming\Anki2\addons21\1875288089\gui.py", line 568, in _fetch_wordlist
self.downloader.fetch_wordlist_entries(wordlist_id)
File "C:\Users\allen\AppData\Roaming\Anki2\addons21\1875288089\Cambridge.py", line 323, in fetch_wordlist_entries
response = urlopen(self.req)
File "urllib\request.py", line 222, in urlopen
File "urllib\request.py", line 525, in open
File "urllib\request.py", line 542, in _open
File "urllib\request.py", line 502, in _call_chain
File "urllib\request.py", line 1393, in https_open
File "urllib\request.py", line 1350, in do_open
File "http\client.py", line 1255, in request
File "http\client.py", line 1296, in _send_request
File "http\client.py", line 1228, in putheader
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2026' in position 512: ordinal not in range(256)

2.1 Not working; cookie?

On the latest version, trying to install the plugin. Getting the following error when I click on Get New Notes from Link:


Debug info:
Anki 2.1.26 (70784154) Python 3.8.0 Qt 5.13.1 PyQt 5.14.1
Platform: Mac 10.14
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-07-11 23:05:18
Add-ons possibly involved: ⁨Cambridge Dictionary⁩

Error in sys.excepthook:
Traceback (most recent call last):
  File "aqt/errors.py", line 19, in excepthook
  File "aqt/errors.py", line 48, in write
UnicodeEncodeError: 'ascii' codec can't encode character '\u2013' in position 458: ordinal not in range(128)

Original exception was:
Traceback (most recent call last):
  File "/Users/Jim/Library/Application Support/Anki2/addons21/1875288089/main.py", line 20, in ask_user_for_link
    window = LinkDialogue()
  File "/Users/Jim/Library/Application Support/Anki2/addons21/1875288089/gui.py", line 45, in __init__
    self.initUI()
  File "/Users/Jim/Library/Application Support/Anki2/addons21/1875288089/gui.py", line 50, in initUI
      File "aqt/__init__.py", line 185, in fn__
UnicodeEncodeError: 'ascii' codec can't encode character '\u2013' in position 137: ordinal not in range(128)

Also, I wasn't sure which cookie value exactly to paste into the cookie field from cambridge plus's site. I have like 10 of them, so I tried the JSESSIONID value. Some examples would be helpful.

In the config file it reads:

{
    "cookie": "54619xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-x1",
    "wordlist_ids": [
        "209xxxxx"
    ]
}

(I added x's as to not reveal the string)

Any help would be great, thanks.

error while adding from from link

Add-ons possibly involved: ⁨Cambridge Dictionary⁩

Caught exception:
Traceback (most recent call last):
  File "/home/user/.local/share/Anki2/addons21/1875288089/gui.py", line 84, in get_word_definitions_from_link
    downloader.get_word_defs()
  File "/home/user/.local/share/Anki2/addons21/1875288089/Cambridge.py", line 85, in get_word_defs
    response = urlopen(req)
  File "urllib/request.py", line 222, in urlopen
  File "urllib/request.py", line 525, in open
  File "urllib/request.py", line 542, in _open
  File "urllib/request.py", line 502, in _call_chain
  File "urllib/request.py", line 1362, in https_open
  File "urllib/request.py", line 1323, in do_open
  File "http/client.py", line 1322, in getresponse
  File "http/client.py", line 303, in begin
  File "http/client.py", line 272, in _read_status
http.client.RemoteDisconnected: Remote end closed connection without response

Version 2.1.22 (0ecc189a)
Python 3.8.1 Qt 5.14.1 PyQt 5.14.1

Operating System: Manjaro Linux
KDE Plasma Version: 5.19.3
KDE Frameworks Version: 5.72.0
Qt Version: 5.15.0
Kernel Version: 5.7.9-1-MANJARO
OS Type: 64-bit

I used this link
https://dictionary.cambridge.org/dictionary/english/appointment

By the way, I have a question: have you thought about an add-on that would make use of dictionary on DVD somehow drawing data from its original database files? That would prevent errors from Cambridge changing their website. Or alternatively from Oxford Advanced Learner's Dictionary on DVD 9th edition.

SyntaxWarning

Debug info:
Anki 2.1.22 (0ecc189a) Python 3.8.1 Qt 5.14.1 PyQt 5.14.1
Platform: Linux
Flags: frz=True ao=True sv=?
Add-ons, last update check: 2020-05-11 18:19:58
Add-ons possibly involved: ⁨Cambridge Dictionary⁩

/home/username/.local/share/Anki2/addons21/1875288089/lib/selenium/webdriver/firefox/firefox_profile.py:208: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if setting is None or setting is '':

Fetching fails

I'm currently logged into Cambridge Dictionary with Google, set copied and pasted the cookie content, but fetching my wordlist does not work.
It says: "Fetching failed:
Authentification failed. Either your cookie expired or your are trying to delete entries from a community wordlist."

Limit visualization of definition to a list of dictionaries

When importing a word, the add-on visualizes a series of definitions from different dictionaries, for example Cambridge American English Dictionary, Cambridge Advanced Learners Dictionary – Thesaurus and Cambridge Business English Dictionary.

Would be nice to limit the visualised list of definitions to a select list of dictionaries.

Fetching failed:

When I Fetch new words from user wordlists but always fail, it shows as below, could you help me how to fix it? Thank you a lot. 👍

Fetching failed:
Traceback (most recent call last):
File "C:\Users\MATT\AppData\Roaming\Anki2\addons21\1875288089\gui.py", line 538, in run
self._fetch_wordlist()
File "C:\Users\MATT\AppData\Roaming\Anki2\addons21\1875288089\gui.py", line 568, in _fetch_wordlist
self.downloader.fetch_wordlist_entries(wordlist_id)
File "C:\Users\MATT\AppData\Roaming\Anki2\addons21\1875288089\Cambridge.py", line 323, in fetch_wordlist_entries
response = urlopen(self.req)
File "urllib.request", line 214, in urlopen
File "urllib.request", line 523, in open
File "urllib.request", line 632, in http_response
File "urllib.request", line 561, in error
File "urllib.request", line 494, in _call_chain
File "urllib.request", line 641, in http_error_default
urllib.error.HTTPError: HTTP Error 400: Bad Request

can't encode character '\u2026' in position 512: ordinal not in range(256)

Keep getting the following error.

Fetching failed:
Traceback (most recent call last):
File "/Users/XXXXX/Library/Application Support/Anki2/addons21/1875288089/gui.py", line 538, in run
self._fetch_wordlist()
File "/Users/XXXXX/Library/Application Support/Anki2/addons21/1875288089/gui.py", line 568, in _fetch_wordlist
self.downloader.fetch_wordlist_entries(wordlist_id)
File "/Users/XXXXX/Library/Application Support/Anki2/addons21/1875288089/Cambridge.py", line 323, in fetch_wordlist_entries
response = urlopen(self.req)
File "urllib/request.py", line 222, in urlopen
File "urllib/request.py", line 525, in open
File "urllib/request.py", line 542, in _open
File "urllib/request.py", line 502, in _call_chain
File "urllib/request.py", line 1393, in https_open
File "urllib/request.py", line 1350, in do_open
File "http/client.py", line 1255, in request
File "http/client.py", line 1296, in _send_request
File "http/client.py", line 1228, in putheader
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2026' in position 512: ordinal not in range(256)

The "…" is in the cookie fyi.

edit: It appears that firefox abbreviates the cookie, hence the ellipsis. Copying it from raw works fine.

Import verb's parts as separate cards

Maybe out of scope for this add-on, but would be nice to import the verb's parts as separate cards.

For example, the verb throw has: throw (base form/infinitive), threw (past simple) and thrown (past participle).

The add-on can create:
a. a card with the three parts as answer.
b. a card for each part.

The user can configure which one to use.

Links guide does not work.

Links in the file "Readme.md" does not work correctly.
The website clip2net.com restricted access to data. Only paid clients can view the data.
Screenshot_2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.