Meta source Douban Books can't work any more
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| calibre |
Undecided
|
xcffl |
Bug Description
Starting a few days before, meta source Douban Books can't work any more。
Error message:
-------
Running identify query with parameters:
{u'authors': [u'\u5f20\u9a8f'], u'identifiers': {u'mobi-asin': u'B07YFPC1P3', u'douban': u'34455756', u'isbn': u'9787121366727'}, u'title': u'\u8fb9\
Using plugins: Douban Books (2, 1, 1)
The log from individual plugins is below
*******
Found 0 results
Downloading from Douban Books took 0.44000005722
Failed to make identify query: u'https:/
Traceback (most recent call last):
File "site-packages\
File "site-packages\
File "site-packages\
httperror_
*******
The identify phase took 0.60 seconds
The longest time (0.440000) was taken by: Douban Books
Merging results from different sources
We have 0 merged results, merging took: 0.00 seconds
-------
I guess it may be because apikey was blocked? Is there a way to change apikey for Douban Books API?
Kovid Goyal (kovid) wrote : | #1 |
Changed in calibre: | |
assignee: | nobody → Li Fanxi (lifanxi) |
status: | New → Triaged |
Li Fanxi (lifanxi) wrote : | #2 |
Douban.com has announced to close the public API for a long time. However, it keeps working until last week.
I'm contacting Douban to see if there's any way to workaround this problem. I'll update once I get response from Douban.
idealclover (idealclover) wrote : | #3 |
If Douban cannot provide the public API, it would be possible to get data by web.
Reffered to https:/
xuyang (xuygelba) wrote : | #4 |
I found a valid key from internet and wrote a test code like this:
-------
.....
headers = {
# 测试必须用老版本的UA标识,否则会失败
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)' +
' Chrome/
'Referer': 'https:/
}
# 从网上找的别人的apikey
url = douban_base_url_ofc + 'isbn/' + isbn + '?apikey=
log.debug(
item = DoubanItem()
...
-------
the code worked, then i downloaded source code of calibre and replaced key in calibre\
Anather solution is i send this key to you, but i don't know if there will be a legal problem to use this key in calibre.
xuyang (xuygelba) wrote : | #5 |
The key what i found, is in this web site: https:/
Kovid Goyal (kovid) wrote : | #6 |
You can run calibre directly from source by following the instructions: https:/
no need to mess around with .pyo replacement.
Kovid Goyal (kovid) wrote : | #7 |
And I think a more sustainable solution is to use web scraping for this, since API keys are trivial to block. Or if you really want to use API keys, maybe make this a non-builtin plugin.
xuyang (xuygelba) wrote : | #8 |
I ran calibre directly from source, found that, old key can not be replaced directly with the key which i found.
Because, calibre are using api '...api.
Kevin Liao (pwliao) wrote : | #9 |
I used douban api v2 to write a new plugin.
https:/
After installing the plugin, you need to click "Customize Plugin" and input apikey by yourself.
You can find apikey on the internet.
xcffl (xcffl) wrote : | #10 |
I made a patch based on the previous plugin.
Changed in calibre: | |
assignee: | Li Fanxi (lifanxi) → xcffl (xcffl) |
information type: | Public → Public Security |
information type: | Public Security → Public |
Changed in calibre: | |
status: | Triaged → In Progress |
Kovid Goyal (kovid) wrote : Fixed in master | #11 |
Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.
status fixreleased
Changed in calibre: | |
status: | In Progress → Fix Released |
xuyang (xuygelba) wrote : | #12 |
Great jobs! tkx.
As far as I know the API key is hardcoded in the plugin source code, so someone will need to get a working key and replace it.