redlib icon indicating copy to clipboard operation
redlib copied to clipboard

🐛 Bug Report: deal with 403 blocked gracefully

Open RayBB opened this issue 1 year ago • 6 comments

Describe the bug

Recently the hetzner IP I've been using for redlib was blocked. When I ssh into my VPS I see this:

wget -qO- https://www.reddit.com/
wget: server returned error: HTTP/1.1 403 Blocked

If I open reddit when proxying through that VPS I see this:

Spoiler
<html class="res-accountSwitcher-dropDownStyle-alien res-RESMenu-gearIconClickAction-toggleMenuNoHover res-searchHelper-searchPageTabs res-showImages res-showImages-highlightNSFWButton res-showImages-highlightSpoilerButton res-showImages-displayImageCaptions res-showImages-captionsPosition-titleAbove res-navTop res-styleTweaks-showExpandos res-styleTweaks-hideUnvotable res-styleTweaks-showFullLinkFlair-never res-styleTweaks-scrollSubredditDropdown res-styleTweaks-postTitleCapitalization-none res-styleTweaks-flairEmojiAsText-never res-tableTools-sort res-userHighlight res res-v5 res-v5-24 res-v5-24-6"><head>
  <title>Blocked</title>
  <style>
    body {
        font: small verdana, arial, helvetica, sans-serif;
        width: 600px;
        margin: 0 auto;
    }

    h1 {
        height: 40px;
        background: transparent url(//www.redditstatic.com/reddit.com.header.png) no-repeat scroll top right;
    }
  </style>
<style>
.tagline .author.friend,
.crosspost-preview-tagline .author.friend {
	color: #ffffff !important;
	font-weight: bold;
	padding: 0 2px 0 2px;
	border-radius: 3px;
	background-color: #ff4500 !important;
}
.collapsed .tagline .author.friend,
.collapsed .crosspost-preview-tagline .author.friend {
	color: white !important;
	background-color: #AAA !important;
}
.tagline .author.friend:hover,
.crosspost-preview-tagline .author.friend:hover {
	background-color: #b33000 !important;
	text-decoration: none !important;
}
	

.tagline .author.submitter,
.crosspost-preview-tagline .author.submitter {
	color: #ffffff !important;
	font-weight: bold;
	padding: 0 2px 0 2px;
	border-radius: 3px;
	background-color: #0055df !important;
}
.collapsed .tagline .author.submitter,
.collapsed .crosspost-preview-tagline .author.submitter {
	color: white !important;
	background-color: #AAA !important;
}
.tagline .author.submitter:hover,
.crosspost-preview-tagline .author.submitter:hover {
	background-color: #4e7eab !important;
	text-decoration: none !important;
}
	

.tagline .author.moderator,
.crosspost-preview-tagline .author.moderator {
	color: #ffffff !important;
	font-weight: bold;
	padding: 0 2px 0 2px;
	border-radius: 3px;
	background-color: #228822 !important;
}
.collapsed .tagline .author.moderator,
.collapsed .crosspost-preview-tagline .author.moderator {
	color: white !important;
	background-color: #AAA !important;
}
.tagline .author.moderator:hover,
.crosspost-preview-tagline .author.moderator:hover {
	background-color: #134913 !important;
	text-decoration: none !important;
}
	

.tagline .author.admin,
.crosspost-preview-tagline .author.admin {
	color: #ffffff !important;
	font-weight: bold;
	padding: 0 2px 0 2px;
	border-radius: 3px;
	background-color: #ff0011 !important;
}
.collapsed .tagline .author.admin,
.collapsed .crosspost-preview-tagline .author.admin {
	color: white !important;
	background-color: #AAA !important;
}
.tagline .author.admin:hover,
.crosspost-preview-tagline .author.admin:hover {
	background-color: #b3000c !important;
	text-decoration: none !important;
}
	

.tagline .author.alum,
.crosspost-preview-tagline .author.alum {
	color: #ffffff !important;
	font-weight: bold;
	padding: 0 2px 0 2px;
	border-radius: 3px;
	background-color: #be1337 !important;
}
.collapsed .tagline .author.alum,
.collapsed .crosspost-preview-tagline .author.alum {
	color: white !important;
	background-color: #AAA !important;
}
.tagline .author.alum:hover,
.crosspost-preview-tagline .author.alum:hover {
	background-color: #8f0e29 !important;
	text-decoration: none !important;
}
	</style><meta name="jsapi.consumer" content="reddit-enhancement-suite"></head>
<body class="res-accountSwitcher-dropDownStyle-alien res-RESMenu-gearIconClickAction-toggleMenuNoHover res-searchHelper-searchPageTabs res-showImages res-showImages-highlightNSFWButton res-showImages-highlightSpoilerButton res-showImages-displayImageCaptions res-showImages-captionsPosition-titleAbove res-navTop res-styleTweaks-showExpandos res-styleTweaks-hideUnvotable res-styleTweaks-showFullLinkFlair-never res-styleTweaks-scrollSubredditDropdown res-styleTweaks-postTitleCapitalization-none res-styleTweaks-flairEmojiAsText-never res-tableTools-sort res-userHighlight res res-v5 res-v5-24 res-v5-24-6">
  <h1>whoa there, pardner!</h1>

<p>Your request has been blocked due to a network policy.</p>

<p>Try logging in or creating an account <a href="https://www.reddit.com/login/">here</a> to get back to browsing.</p>

<p>If you're running a script or application, please register or sign in with your developer credentials <a href="https://www.reddit.com/wiki/api/">here</a>. Additionally make sure your User-Agent is not empty and is something unique and descriptive and try again. if you're supplying an alternate User-Agent string,
try changing back to default as that can sometimes result in a block.</p>

<p>You can read Reddit's Terms of Service <a href="https://www.reddit.com/wiki/api/">here</a>.</p>

<p>if you think that we've incorrectly blocked you or you would like to discuss
easier ways to get the data you want, please file a ticket <a href="https://support.reddithelp.com/hc/en-us/requests/new?ticket_form_id=11111111">here</a>.</p>

<p>when contacting us, please include your ip address which is: <strong>111.111.111.111</strong> and reddit account</p>


  <div class="res-floater-belowNavbar" style="top: 70px;"><ul class="res-floater-list"><li style="order: 3"><span id="RESAccountSwitcherIcon" role="button"></span></li><li style="order: 9"><a class="pageNavigator res-icon" data-id="top" href="#header" title="To Top"></a></li></ul></div><div id="RESNotifications"></div><div id="RESConsoleVersion" style="display: none;" data-id="jid1-xUfzOsOFlzSOXg@jetpack">5.24.6</div></body></html>

However, redlib only shows 404 page not found and I also don't see any logs about this. Logs just say

2024-09-08T16:54:36.989147736Z Starting Redlib...
2024-09-08T16:54:37.813015096Z Running Redlib v0.31.0 on 0.0.0.0:8080!

Steps to reproduce the bug

You can't really reproduce it without having a blocked IP :)

What's the expected behavior?

At least log that it's blocked so it's easy to see the issue. Even better if a warning can be shown on the 404 page.

Thanks for all your hard work on this awesome tool :)

RayBB avatar Sep 09 '24 22:09 RayBB