Notice: My personal stance on AI generated artwork. Retweet and share if you agree. Let us discuss, and not immediately scream bloody murder.

Now Viewing: Error 403?
Keep it civil, do not flame or bait other users. If you notice anything illegal or inappropriate being discussed, contact an administrator or moderator.

Strahan - Group: Member - Total Posts: 81
user_avatar
Error 403?
Posted on: 10/13/15 07:53PM

Hi. I wrote a C# wallpaper program that grabs a random image from here every ten minutes. Worked great for a long time. Just today it started kicking back "403 Forbidden" failures though. I went into the code and went to the section that builds the URL to request the image. Copied it, pasted in my browser and got data back for the image. Any time it tries from the program though, it gets 403.

This is my code:

target = "gelbooru.com/index.php?pa...amp;pid=0&tags=" + tagsel;
XmlDocument CountXML = new XmlDocument(); CountXML.Load(target);
XmlNodeList Countpc = CountXML.GetElementsByTagName("posts");
int totalresults = System.Convert.ToInt32(Countpc[0].Attributes["count"].Value);
if (totalresults == 0) {
retval.Add("failed", "");
} else {
int selected = rnd.Next(0, totalresults - 1);
target = "gelbooru.com/index.php?pa...mp;limit=1&pid=" + selected.ToString() + "&tags=" + tagsel;
XmlDocument XML = new XmlDocument(); XML.Load(target);
XmlNodeList pc = XML.GetElementsByTagName("posts");
XmlNodeList nodes = XML.GetElementsByTagName("post");
byte[] imagedl = new WebClient().DownloadData(nodes[0].Attributes["file_url"].InnerText);
retval.Add("file_url", nodes[0].Attributes["file_url"].InnerText);
retval.Add("toggle", geltoggles[cfg_int["activetoggle"], 0]);
retval.Add("selection", tagsel);
retval.Add("tags", nodes[0].Attributes["tags"].InnerText);
retval.Add("id", nodes[0].Attributes["id"].InnerText);
retval.Add("width", nodes[0].Attributes["width"].InnerText);
retval.Add("height", nodes[0].Attributes["height"].InnerText);
retval.Add("rating", nodes[0].Attributes["rating"].InnerText);
retval.Add("md5", nodes[0].Attributes["md5"].InnerText);
retval.Add("image", Convert.ToBase64String(imagedl));
}

I told it to log the target URLs it built so I could test it in the browser. When I told it to pick a paper, this was the logging:

10/13/2015 8:49:34 PM: Processing paper ...
10/13/2015 8:49:36 PM: gelbooru.com/index.php?pa...ressing%20-rating:safe%20
10/13/2015 8:49:36 PM: gelbooru.com/index.php?pa...ressing%20-rating:safe%20
10/13/2015 8:49:37 PM: Exception while trying to change wallpaper:
10/13/2015 8:49:37 PM: The remote server returned an error: (403) Forbidden.

I copied the first URL and got:

<?xml version="1.0" encoding="UTF-8"?>
-<posts offset="0" count="17036">
<post source="" preview_height="84" preview_width="150" has_comments="false" has_notes="false" status="active" created_at="Tue Oct 13 17:00:24 -0500 2015" has_children="false" creator_id="79114" md5="82af2db6f2bd0e448a110a4a72a6d195" change="1444773624" width="1280" id="2883486" tags="4girls areolae ass barefoot blonde_hair blue_eyes blue_hair blush breasts brown_eyes censored feet flat_chest game_cg giga_(company) green_eyes huge_breasts izumo_kasumi_(ren'ai_phase) kagami_suzuha kumihama_yuki large_breasts legs long_hair looking_at_viewer mosaic_censoring multiple_girls navel nipples nironiro nude open_mouth panties panty_pull pink_eyes pink_hair ren'ai_phase short_hair silver_hair smile standing thighs toes tonami_kokoro towel undressing" rating="e" preview_url="gelbooru.com/thumbnails/8...a110a4a72a6d195.jpg" sample_height="478" sample_width="850" sample_url="gelbooru.com/samples/82/a...a110a4a72a6d195.jpg" parent_id="" file_url="gelbooru.com/images/82/af...a110a4a72a6d195.png" score="0" height="720"/>
</posts>

Worked fine for me in IE, as did the second:

<?xml version="1.0" encoding="UTF-8"?>
-<posts offset="2371" count="21427">
<post source="i1.pixiv.net/img-original.../32/46952216_p0.jpg" preview_height="150" preview_width="103" has_comments="false" has_notes="false" status="active" created_at="Fri Nov 07 07:15:23 -0600 2014" has_children="false" creator_id="6498" md5="02babd5e7f37938a2fc378f3ebc09335" change="1427227383" width="2000" id="2468205" tags=" 1girl absurdres bare_shoulders brown_hair collarbone green_eyes highres kotoba_noriaki navel nipples original ribs short_hair short_twintails sketch small_breasts solo twintails undressing " rating="q" preview_url="gelbooru.com/thumbnails/0...fc378f3ebc09335.jpg" sample_height="1236" sample_width="850" sample_url="simg4.gelbooru.com/sample...fc378f3ebc09335.jpg" parent_id="" file_url="simg4.gelbooru.com/images...fc378f3ebc09335.jpg" score="7" height="2909"/>
</posts>

Any idea what's up with that? Thanks!



Jerl - Group: The Real Administrator - Total Posts: 6664
user_avatar
Posted on: 10/13/15 08:46PM

We disallow direct image linking, so HTTP requests without a Gelbooru referrer (including no referrer) will not load.

You can try spoofing the referrer.



keita-kuhn - Group: Member - Total Posts: 2
user_avatar
Posted on: 10/13/15 11:07PM

Since when have you disallowed direct image linking? I was able to do it just fine for years until just earlier today



#666 - Group: The Jetsons did 9/11 - Total Posts: 133
user_avatar
Posted on: 10/13/15 11:19PM

I'm also having this issue, but in my browser. None of the images show up when I click them, and I get a 403 if I click original image.



Jerl - Group: The Real Administrator - Total Posts: 6664
user_avatar
Posted on: 10/13/15 11:26PM

keita-kuhn said:
Since when have you disallowed direct image linking? I was able to do it just fine for years until just earlier today


It has been disabled for several years. I think it was first done sometime around 2010-2011.



lozertuser - Group: The Fake Administrator - Total Posts: 2146
user_avatar
Posted on: 10/13/15 11:28PM

We have disabled blank referers until further notice.



jedi1357 - Group: Moderator - Total Posts: 5724
user_avatar
Posted on: 10/13/15 11:38PM

lozertuser said:
We have disabled blank referers until further notice.


IQDB?

I couldn't use it earlier, I think because of this.



Jerl - Group: The Real Administrator - Total Posts: 6664
user_avatar
Posted on: 10/13/15 11:40PM

IQDB works just fine, at least now.



jedi1357 - Group: Moderator - Total Posts: 5724
user_avatar
Posted on: 10/13/15 11:52PM

Update: Yea, it's working again now. I don't know why it didn't earlier. I thought I saw a red "403" related message is why I brought it up. You can ignore me now.



Strahan - Group: Member - Total Posts: 81
user_avatar
Posted on: 10/14/15 01:54AM

Thanks, that did the trick, my program is working again :)



add_replyAdd Reply


1 23456789»