podaboutlist / linkfix-for-discord

LinkFix brings link embeds back to your Discord server! Simply post Twitter, Instagram, TikTok, or Reddit links and LinkFix will reply with a rich media embed.
https://discord.com/application-directory/385950397493280805
GNU Affero General Public License v3.0
18 stars 5 forks source link

Reddit: Some `reddit.com/(r|user)/s/:id` URLs are actually redirects to other sites. #34

Open RalphORama opened 11 months ago

RalphORama commented 11 months ago

Fixing these would require using curl (or libcurl or w/e) to check if the location header in the request to vxreddit is a site other than reddit.com

Example (shell):

curl -v https://vxreddit.com/r/nfl/s/klVXoLSTdX 2>&1 | grep -i location
#< location: https://twitter.com/kahuna_med/status/1741580123327869157?s=46&amp;t=m2SMNFb9k8aBi4agkkqcQA
shoegaze commented 6 months ago

Looks like we can handle redirects within Node.js using follow-redirects