Teleport to a Random Webpage Because Why Not
h
SpicedSpices (286)

Have you ever wanted to just visit a random webpage without any knowledge of what is on it? Because if so, this is the perfect Repl for you.

I was bored at 1:47 AM this morning, so I came up with an idea. I decided to try to make a Repl that will redirect you to a completely random webpage. I didn't know how to come up with the random webpage though.

After some careful consideration, I decided on randomly generating a string with a random length, and searching it up in Bing to take the first link that shows up.

I don't know why I tried to do this, but I guess it is pretty cool.


Disclaimer:

Obviously random is not possible in the world of computing, so the way I found a 'random' webpage, was to create a random string with letters A-Z and numbers 0-9, and searching it up into Bing to take the first link that appeared.

Although not totally random, it still produces really weird websites.


Libraries / Frameworks

  • Express.JS for sending files and links to client.
  • HTTP for creating a server
  • Crawler for searching the web to take this links.

Code

Randomly Generated String
let length = Math.floor(Math.random()*(max+1-min))+min;
  let str = (Math.floor(Math.random()*36**length)+1).toString(36);
Redirect to External Website
res.status(301).redirect("https://www.youtube.com/watch?v=dQw4w9WgXcQ");

Disclaimer #2 ?

I used Bing to search things up because it is easier to find things in inspect element when this crawls the web.

Bing does have a safe search on by default, so this will be protected from any NSFW websites. Although it has safe search, that does not mean that there are malicious websites that might slip through the filter. Please while using this site, be cautious . If you would like, use a VPN, proxy, or a VM to make sure that no malicious websites will be bad for your computer.


Thank you for checking out this Repl.

If you enjoyed it, an upvote would always be appreciated. If not, please tell me how I could improve this Repl in the comments. Thanks :)

You are viewing a single comment. View All
ChezCoder (1580)

this is a beautiful demonstration of the uses of web crawling, pseudo random, and many other aspects of programming, fit so snuggly in one project. Bravo, heres an upvote!

Edit, look what site i was sent to :/

Edit x2: Make a button and a input, the input contains a number, the button opens multiple webpages depending on the input. If the input were 4, then it opens 4 new webpages.

Edit x3: I will never forgive my self: http://v2mk.net/default.aspx

SpicedSpices (286)

wow thanks @ChezCoder i appreciate that :)

For Edit 1: Thats pretty secretive lol
For Edit 2: Ok that makes sense i'll have a cap on it though so no insane lag
For Edit 3: Bruh... glad i have a disclaimer :p that needs to be fixed