Localize media fails with response code: 400

The media does loads properly in Chrome, the Anki editor and when reviewing. But the localize media addon hangs with “Unexpected response code: 400” on invoking.

One of the remote media URLs in the note:


Maybe the Anki media fetcher doesn’t like GET params?

I believe the problem is that Anki is seeing a & and converting it to &, which is what you’d normally see in a query string. But that site is strange and seems to expect an &. I’m fear changing the existing behaviour would break other use cases, so you’ll need to make the necessary modifications on a local copy of the add-on - reimplementing _retrieveURL() from Anki and stopping it from calling unquote().

@dae Ah thanks, but I am not familiar with writing Anki addons, how do I go about reimplementing _retrieveURL()?

If you update to Anki 2.1.61, there is a new version of the add-on available. Download it, then edit the add-on and remove this line:

url = urllib.parse.unquote(url)

Thanks Damian, that works!

Hope you succeed in coming up with a fix which doesn’t break other use cases eventually.