ChanThreadWatch
ChanThreadWatch copied to clipboard
use APIs instead of parsing HTML
especially important for archives, because (on mine) a fair amount of requests are from CTW and it wastes valuable CPU time generating HTML
https://github.com/4chan/4chan-API https://foolfuuka.readthedocs.org/en/latest/code_guide/documentation/api.html
This is indeed a long overdue change. I feared the APIs didn't expose all the information CTW needs for all its features. I'll take a look and see if that's still the case whenever I can.
Do you know how you would implement .json handling (While also supporting boards without this)? I have working prototypes, but I wouldn't want to try and ham-fist something in. The only thing I can see that the API doesn't expose at all is getting CrossLinks, but those, we could still parse out of the post text field.
If the user downloads the .html, it would still need to make a request for the html AFAIK.
The SiteHelper could behave differently depending on what you provide it (HtmlParser, Json, ...).
As you pointed out, the only use case where using the API would be beneficial is when the user doesn't want to download the HTML (only media). I don't think that's the most popular use case for CTW but maybe I'm wrong.