sviatoslav-lebediev / anki-quizlet-importer-extended

93 stars 12 forks source link

import issue #39

Closed sviatoslav-lebediev closed 1 year ago

sviatoslav-lebediev commented 2 years ago

hello, my computer is windows and I actually use a vpn, BUT still cannot import cards success. I can only function with quizlet-importer-v1.1.1-captcha

here is my description:

Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 6.3.1 PyQt 6.3.1 Platform: Windows 10 Flags: frz=True ao=True sv=2 Add-ons, last update check: 2022-10-17 15:28:24

Caught exception: Traceback (most recent call last): File "urllib3.connectionpool", line 700, in urlopen File "urllib3.connectionpool", line 994, in _prepare_proxy File "urllib3.connection", line 364, in connect File "urllib3.connection", line 499, in _connect_tlsproxy File "urllib3.util.ssl", line 453, in ssl_wrapsocket File "urllib3.util.ssl", line 495, in _ssl_wrap_socket_impl File "ssl", line 500, in wrap_socket File "ssl", line 1040, in _create File "ssl", line 1309, in do_handshake FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "requests.adapters", line 440, in send File "urllib3.connectionpool", line 785, in urlopen File "urllib3.util.retry", line 592, in increment urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='quizlet.com', port=443): Max retries exceeded with url: /190060929/flashcards (Caused by ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\songz\AppData\Roaming\Anki2\addons21\1362209126__init__.py", line 472, in run r = requests.get(self.url, verify=False, headers=headers, cookies=cookies) File "requests.api", line 75, in get File "requests.api", line 61, in request File "requests.sessions", line 529, in request File "requests.sessions", line 645, in send File "requests.adapters", line 513, in send requests.exceptions.ProxyError: HTTPSConnectionPool(host='quizlet.com', port=443): Max retries exceeded with url: /190060929/flashcards (Caused by ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\songz\AppData\Roaming\Anki2\addons21\1362209126__init__.py", line 523, in run self.errorMessage = "{}\n-----------------\n{}".format(e, r.text) AttributeError: 'NoneType' object has no attribute 'text'

would you mind help me?

———————————————————————————————————— quizlet link:https://quizlet.com/190060929/ch01german-for-reading-flash-cards/

when I try without VPN, it shows: Sorry, it's behind a captcha, try to disable VPN.

note: I come from China. Would it influence?

Songztu commented 2 years ago

Thank very much to you since you take your time to solve this issue. Hope it will not spend too much time. Sincere gratitude.

sviatoslav-lebediev commented 2 years ago

I will try to add an ability to copy/paste HTML from the quizlet.com. in this case, the addon will use that HTML instead of downloading it. Hope I will have time tomorrow

sviatoslav-lebediev commented 2 years ago

@Songztu Hi, could you please try to check if this approach works for you.

  1. Open Anki. Click Tools/Add-ons
  2. Select Quizlet to Anki 21 Importer...
  3. Click View Files
  4. Open init.py in an editor
  5. Replace content of init.py using this text code https://raw.githubusercontent.com/sviatoslav-lebediev/anki-quizlet-importer-extended/eb53ce4b61131ec0634fd2dadaa4c15e9399aaf4/__init__.py
  6. Restart Anki
  7. Your link is https://quizlet.com/190060929/ch01german-for-reading-flash-cards/ . 190060929 is the id of the deck. Try to open this URL https://quizlet.com/190060929/flashcards in your browser.
  8. Right click on the https://quizlet.com/190060929/flashcards page and select Inspect. It will open DevTools.
  9. Right click on the HTML tag and select Copy outerHTML
  10. Paste that HTML to the addon field and enter the URL
  11. Try to import.

I understand that this is a more complicated approach, but I want to check if it works for you. If it works maybe we will try to simplify it somehow. I don't want to try to solve your issue with proxy because I can take a lot of time and I don't know even how to test it.

image image image

sviatoslav-lebediev commented 2 years ago

I've updated a version of the addon, please try one more time. If you still have a problem, please create another issue.

Songztu commented 1 year ago

I've tried but failed. so sad.

anki report: 'NoneType' object has no attribute 'group' #39

sviatoslav-lebediev commented 1 year ago

could you please attach the whole text from ^ window? have you set any props using this instruction ?

To download your own private or password-protected sets, go to Tools - Add-ons - Improved Quizlet ... - Config and either set "cookies" or "qlts" and click OK. To set "cookies", open Chrome DevTools, click the Network tab, reload the page or press Ctrl+R, click on the first request and copy "cookies" value from the request headers. To set "qlts", open Chrome DevTools, click the Application tab, and copy "qlts" value from the Cookies pane - https://developers.google.com/web/tools/chrome-devtools/storage/cookies. If "qlts" is set, it takes precedence over "cookies". Once it's done it should be possible to download private or password-protected sets for a limited period of time without making them public.

Songztu commented 1 year ago

I'm sorry for not replying so many days. I just took a open surgery.

I tried the method you proposed in Oct. 24, still unsolved. Because the whole text is too long to comment, here is the whole text: [https://shimo.im/docs/Ee32MlWQnjHBPoA2]

#39(2)

Besides, i don't know how to set a prop.

Thank you very much for spending much time to help me, wish you all well.

sviatoslav-lebediev commented 1 year ago

What vpn do you use and what country do you choose ?

Songztu commented 1 year ago

I use clash for windows as vpn, and choose Singapore, Japan or America, they all failed.

sviatoslav-lebediev commented 1 year ago

:( I can't reproduce this behavior. and you always receive Sorry, it's behind a captcha, try to disable VPN., right? Can you remove this plugin and install it one more time?

Songztu commented 1 year ago

I re-install the add-on, still doesn't work. I can only import the cards with this version quizlet-importer-v1.1.1-captcha but without audio.

sviatoslav-lebediev commented 1 year ago

could you provide a link for quizlet-importer-v1.1.1-captcha ? maybe i can take some code from that plugin

Songztu commented 1 year ago

here is the link: https://github.com/kelciour/improved-quizlet-to-anki-21-importer/releases/tag/v1.1.0-captcha

Sorry, I was confused that you and kelciour are same person.

sviatoslav-lebediev commented 1 year ago

not we are different :) i will take a look and will let you know