ongyx / tankobon

A web scraper disguised as a manga downloader
MIT License
1 stars 0 forks source link

Problem running Tankobon 2021.6.6 #1

Closed bleached45 closed 3 years ago

bleached45 commented 3 years ago

I can view help and version but if I try to add any titles, run the GUI, refresh, etc I get the same error. File "c:\users\user\appdata\local\programs\python\python39\lib\site-packages\tankobon\models.py", line 80, in __post_init__ self.desc[lang] = localized.strip().replace("\r\n", "\n") AttributeError: 'dict' object has no attribute 'strip'

I had tried running Tankobon in the Windows Subsystem for Linux (Ubuntu) and also ran into issues. I assumed it was because of WSL so I switched to running it in Windows directly.

Is there some way to fix this? Is it just me? Thanks.

ongyx commented 3 years ago

It could be related to how tankobon now treats descriptions as dictionaries, but it's strange that there are nested dictionaries. Could you paste here your index file (at ~/.local/share/tankobon/index.json.gz)?

After you upload the index file, remove it from ~/.local/share/tankobon/. tankobon will create a new empty index file and the GUI should work again.

bleached45 commented 3 years ago

index.json.gz The file was long so I didn't want to paste just the contents, hopefully just pasting the file itself works for you.

You are correct though, it looks like the GUI works after removing that index. I didn't think it was the series I was adding.

ongyx commented 3 years ago

I realised that the description field was being converted to a dictionary twice:

https://github.com/ongyx/tankobon/blob/94778f3075c0ca5549773b212215a7422cf26524/tankobon/sources/catmanga.py#L43-L48

https://github.com/ongyx/tankobon/blob/94778f3075c0ca5549773b212215a7422cf26524/tankobon/models.py#L76-L77

Because models.Metadata already converted the string description to a dict, and the catmanga source did not check for this, hence the nested dictionary.

Thanks for opening this issue. I'll push the bugfix as version 2021.6.7.

EDIT: I also tested the catmanga URL in your index file, and tankobon adds it correctly now.

ongyx commented 3 years ago

As for WSL2 support, tankobon's GUI should work if an X server (like vcxsrv) is running on Windows. I actually set up a Bash script that makes the WSL shell aware of vcxsrv, you can check it out in this gist.

bleached45 commented 3 years ago

Awesome, thank you. I can confirm that I was able to get the last few chapters now. Thanks for looking into this. I have not tried it in WSL yet but will try to give it a shot. (I do not have an X server since I've only used it for basic tasks, but that could be fun to setup).

One last, unrelated question. Are there any plans to add download limiting? I know a lot of online readers watch for fast traffic that looks like a scraper. Either way, thanks for the great work.

ongyx commented 3 years ago

Yes, it's possible to rate limit. The core.Downloader class uses concurrent.futures internally to download pages, so we can control the maximum number of requests made using max_workers.

As for the 'looks like a scraper' part, tankobon deliberately obfuscates this by setting the User-Agent and Referer fields in downloader sessions.

(mangakakalot apparently blocks requests using Cloudflare if the user agent is python-requests.)

bleached45 commented 3 years ago

Awesome, thanks for the info. I appreciate all of the work going into this.