Unblock Reddit Image - reddit.com

12/17/2023, 2:10:12 PM

ავტორი
shouya
დღიური ინსტალაციები
1
მთლიანი ინსტალაციები
174
რეიტინგი
0 0 0
ვერსია
1.1
შექმნილია
17.12.2023
განახლებულია
01.03.2024
ლიცენზია
WTFPL
გამოყენებს მათ

Reddit currently blocks access from VPN ("Whoa there, pardner!" message). However, old.reddit.com is unaffected, except for image. Direct image links like https://i.redd.it/yf54x6mhfq4c1.jpg will be redirected to the main reddit domain (i.e. https://www.reddit.com/media?url=https://i.redd.it/yf54x6mhfq4c1.jpg), where the access is blocked.

I found that the redirection happens only when the browser requests for a html mime types. Compare the following:

$ curl 'https://i.redd.it/yf54x6mhfq4c1.jpg'
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.

$ curl 'https://i.redd.it/yf54x6mhfq4c1.jpg' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/jxl,image/webp,*/*;q=0.8'
(307 redirected)

This script fixes that by rewriting the "Whoa pardner" page with a single image element pointing to that image.