neobooru / SzuruChrome

Chrome/Firefox extension which can import media from various sites into a szurubooru instance.
MIT License
42 stars 5 forks source link

"HTTP 403. (Forbidden)" on multiple sites #38

Closed myalow closed 1 year ago

myalow commented 1 year ago

On sites like Rule34.US and Gelbooru, when attempting to download anything, I get the following error message:

    { "name": "DownloadError", "title": "Processing error", "description": "Download target returned HTTP 403. (Forbidden)", "URL": "https://img2.rule34.us/images/ab/2a/qwertyuiop.jpeg" }

I believe it used to happen on Twitter, but Twitter is working for me now. It might happen on other sites as well (and I know Sankaku comes up with an error 500) but I find these to be pretty weird.

It is likely worth noting that szuruchrome connects to my instance locally, so it connects to http://server.local:1234, but I don't see why that should cause issues downloading files.

phil-flip commented 1 year ago

Is that the address on which you are reaching your szuru instance?

myalow commented 1 year ago

Is that the address on which you are reaching your szuru instance?

I'm sorry, I don't fully understand, but I am reaching my szuru instance, which is hosted locally only on my server machine, from my desktop on the same LAN. my instance is not public-facing, nor do i have it configured to have ssl in any way.

phil-flip commented 1 year ago

yes, but are you reaching it with http://server.local:1234 the normal szurubooru instance?

myalow commented 1 year ago

yes, but are you reaching it with http://server.local:1234 the normal szurubooru instance?

yes, that url does work to reach my szuru instance, and when i use szuruchrome on sites like danbooru or twitter, it works without issue.

phil-flip commented 1 year ago

So I tried gelbooru and that did work. The link in the error message unfortunately returns a 404 for me

myalow commented 1 year ago

the link i used was a placeholder. i don't know if how github's terms are for nsfw links but go to rule34.us and try downloading a random image, perhaps

phil-flip commented 1 year ago

For me, it worked without issue. Where are you getting this error message?

myalow commented 1 year ago

in a red box at the top of the pop-up after hitting import. I'll attach a screenshot: Screenshot_20230205_175253

hujle commented 1 year ago

I have a similar problem, but only with Pixiv. Neither search for similar posts and uploading doesn't work for me.

neobooru commented 1 year ago

SzuruChrome uploads the posts by sending the image URL to the server, however this doesn't work if said image URL has hotlink protection. I'll try to make something where it first downloads the image locally and then uploads it on the server. This is a slower process, but might work. It is also the our only option without editing the szurubooru server software.

That said, maybe that is not the issue here. You can try pasting the image URL in this tool (https://altlab.com/hotlinkchecker.php), and if it fails to display the image then hotlink protection might be the issue.

myalow commented 1 year ago

That said, maybe that is not the issue here. You can try pasting the image URL in this tool (https://altlab.com/hotlinkchecker.php), and if it fails to display the image then hotlink protection might be the issue.

Somewhat interesting results when I tried that. Gelbooru gives me image not found, and danbooru and rule34.us work fine. Gelbooru I expected not to work, and Danbooru I expected to work, but Rule34 throws me for a loop. Double-checked and despite the hotlink checker working just fine, SzuruChrome still gives me the red 403 message.

neobooru commented 1 year ago

And what happens if you manually enter the image URL in the "Alternatively, paste and URL here" field on szurubooru's upload page, and then try to upload it from there?

myalow commented 1 year ago

both gelbooru and rule34.us give me the same 403 error. danbooru URLs work fine on szurubooru's upload page, holding in-line with szuruchrome.

I guess this issue lies more on the end of szurubooru itself then?

myalow commented 1 year ago

Closing since it appears this is more a Szurubooru issue than a SzuruChrome one. Continuing here: rr-/szurubooru#555

neobooru commented 1 year ago

For visibility, setting the user_agent string in server/config.yml solves this issue (original answer here). Kinda silly that I forgot about that setting, oh well.