# Is this site down or is it just me?

## Challenge

The challenge is simple, using http://isup.me, determine whether an inputted website is up or down.

If the site is up, you should return a truthy value and if the site is down, you should return a falsey value.

## Rules

The input will be a web address such as stackexchange.com or google.co.uk. The input will never have http://, https:// etc. at the start of the string, but may have www. or codegolf. at start etc.

You should use the site isup.me/URL where URL is the input.

When a site is up, it will look like:

http://isup.me/codegolf.stackexchange.com

If a site is down, it will look like:

http://isup.me/does.not.exist

URL shorteners are disallowed apart from isup.me.

## Example inputs

Probably up (depending on current circumstances):

google.de
codegolf.stackexchange.com
worldbuilding.meta.stackexchange.com
tio.run
store.nascar.com
isup.me


Will be down:

made.up.com
fake.com.us
why.why.why.delilah
store.antarcticrhubarbassociation.an


## Winning

Shortest code in bytes wins.

• By the way: "made.up.co.uk" is actually up. Jul 2 '17 at 23:40
• I've just registered fake.com.us to mess with your test cases!
– YSC
Jul 3 '17 at 9:18
• But what if isup.me is down?
– Okx
Jul 3 '17 at 12:01
• @Oks Are you sure it's not just you? Jul 3 '17 at 13:05
• Recommended test case: isup.me. It returns a result other than what, say, google.com may return.
– Okx
Jul 3 '17 at 14:02

# sh (+ curl + grep), 28 26 bytes

curl -L isup.me/$1|grep ^I  Outputs via exit status (0 for up, 1 for down). Looks for an I at the beginning of a line, which matches when the domain is up (even for the special case of isup.me/isup.me). • curl -L isup.me/$1|grep u! saves 1 byte. This assumes that ! is not a valid character in the domain name.
– user4768
Jul 3 '17 at 7:11
• Is 0 truthy in sh? Jul 3 '17 at 8:20
• 0 is indeed truthy in sh, with all nonzero values being falsy. Also, IMO it's really nice that the sh version is so short, since it's absolutely the right language for this task even without considering golfing. Jul 3 '17 at 8:46
• That said this will fail on something like spthissitedoesntexist.invalid Jul 3 '17 at 8:53
• It matches on my machine. It matches this bit: <a href="http://spthissitedoesntexist.invalid" class="domain">spthissitedoesntexist.invalid</a> Specifically it matches inside the href. Jul 3 '17 at 9:39

# Stacked, 44 bytes

['http://isup.me/'\+[CS'!'eq sum 2=out]curl]


Asynchronous function that outputs 0 if the site is not up, and any other number greater than 0 if it is up.

Example a:

['http://isup.me/'\+['s u'split#'1-put]curl] @:isup



Output (probably): Is google up? 1

• Can you add linked to Stacked GH page? Jul 2 '17 at 23:17
• @Downgoat Done. Jul 2 '17 at 23:17
• If this is checking for an occurrence of s u, note that this occurs on any input beginning with u (whether up or down). Jul 3 '17 at 1:16
• @AndersKaseorg Fixed, thanks. Jul 3 '17 at 1:45
• Better example: 'Is example.com up?' put 'example.com' isup output (not just probably but surely): Is example.com up? 1 Jul 3 '17 at 9:18

# Kotlin REPL - 131 108 106 93 79 55 53 64 63 bytes

First try at Kotlin golfing.
Expects the website in a variable or value named a.

Now with reduced whitespace.
Who said "loo" isn't enough?
Fixed and shorter, doesn't rely on http://isup.me anymore.
No need to open the connection ourselves, just get the stream of data (or not)
The task was to use http://isup.me, right? Also: < is not a valid character in a URL.
Now works with isup.me as the website

Now reads the website as a line, because one can't assume a variable to contain the website.

"m h" !in java.net.URL("http://isup.me/"+readLine()).readText()


Reads one line containing just the website.
Checks for the m h part of from here that is sent when a site is down.

Returns "true" or "false" respectively.

# As a Lambda - 172 120 118 99 85 67 66 bytes

{a:String->"m h" !in java.net.URL("http://isup.me/$a").readText()}  Can be invoked directly: { ... }("google.com")  • forgive me if I'm wrong, but couldn't this be converted to a lambda fairly easily? Jul 2 '17 at 23:17 • @NickClifford sure, but it would actually be longer due to the argument and type definition (15 chars because type inference doesn't work here) Jul 2 '17 at 23:19 • I don't know the language, but it seems like you are checking to see if "loo" is in the returned text. Is it not the case that this text also returns the (variable) site name? And if it is, does that mean you get false negatives for sites like loo.com? – cole Jul 3 '17 at 0:01 • @Cole you are definitely right, I completely forgot about this (I was only testing Google and the fake website). I will update the code next morning (it's 2am where I am currently) Jul 3 '17 at 0:06 • This one will fail on sites with loo in the name. electric.boogaloo doesn't exist but the string loo will be in the output there. Jul 3 '17 at 9:02 # Python 2 or 3 with Requests (7069 68 bytes) from requests import*;lambda u:"u. "in get("http://isup.me/"+u).text  1 byte shaved: "u. "" u" Nope, not a valid optimisation. 1 byte shaved: __import__('requests').from requests import*; This is now really a REPL-only piece of code, and after running this line the function will be named _. • Syntax error at the end (probably a stray )). Jul 3 '17 at 10:47 • Fails for inputs starting with u. Jul 3 '17 at 10:49 • Using from requests import* and get is 1 byte shorter. Jul 3 '17 at 16:59 • it is not REPL-only, it's allowed to answer with unnamed functions (lambdas in python) Jul 4 '17 at 13:31 • It is an unnamed function, but the script as a whole can't be used as an expression (since it uses import), so I think it's safer to just call it a REPL line. Jul 4 '17 at 15:41 # Python3 141133113192 141 bytes Requires Selenium (including webdriver) for python. Thanks to @cairdcoinheringaahing for reducing 42 bytes! Thanks to @V.Courtois for pointing out a simple fix! from selenium import* d=webdriver.Firefox();d.get("http://isup.me/"+input());print("up"in d.find_element_by_xpath("//*[@id='content']/p[1]"))  Prints 1 if site is up and running, else prints 0. Ungolfed version: from selenium import webdriver from selenium.webdriver.common.keys import Keys urlToTest = "www.f.com" driver = webdriver.Firefox() driver.get("http://downforeveryoneorjustme.com/"+urlToTest) res = driver.find_element_by_xpath("//*[@id='content']/p[1]") print(1 if "up" in res.text else 0)  • They said isup.me is fine in the comments; you can win some bytes :) Jul 3 '17 at 7:12 • -1 This is a snippet. Full programs or functions are required and input cannot be assumed in a variable (such as t). Also, you can golf the print statement to print("up"in r.text) Jul 3 '17 at 16:45 • @cairdcoinheringaahing Okay, will make those changes, thank you! This is my second answer, so I didn't know whether to post a snippet or a full fledged program. So I posted both. Jul 4 '17 at 5:46 • 141 bytes Jul 4 '17 at 6:15 # Javascript (ES6), 74 66 bytes f=s=>fetch('//isup.me/'+s).then(r=>r.text()).then(t=>/u!/.test(t))  Thanks to @Shaggy, who brought to my attention that a resolved promise counts as output. Problem with this solution that it will throw a CORS error unless I test it on a page that's already at isup.me. But currently, that gets redirected to downforeveryoneorjustme.com Older version: f=s=>fetch('//isup.me/'+s).then(r=>r.text()).then(t=>alert(t.match(/u!/))) • You can get rid of the alert and just return the Promise. See here. I think you might also be able to make a saving with /u!/.test(t). Jul 4 '17 at 8:25 # Pyth, 24 bytes }" u"s'+"http://isup.me/  Return True if the site is up, False otherwise. The input URL must be quoted. That cannot be tested on the online interpreter because ' is disabled on it for safety reasons; instead you will need a local copy of Pyth. Explanation  Q # Implicit input +"http://isup.me/ # Concatenate "http://isup.me/" with the input ' # Open the URL s # Concatenate all the lines of the returned HTML page }" u" # Test whether " u" is in the page or not  • Fails for inputs starting with u. Jul 3 '17 at 10:57 # 05AB1E, 22 bytes "isup.me/ÿ".w#214è'‚‰Q  Try it online! Unfortunately "isup.me/ÿ".w§„ uå doesn't seem to work. ## PowerShell, 32 bytes (iwr isup.me/$args)-notmatch'u!'

• Missed your answer before I posted mine sorry! some weird irm behavior saved me a bunch on this one. mine here Jul 4 '17 at 9:50

!(irm isup.me/$args).html  Uses the fact that Invoke-RestMethod returns the page with a .html property only on failure. (no idea why exactly this happens...) inverts the line to convert to bool, outputs True for a live site or False for a down site. PS C:\Users\sweeneyc\Desktop> .\Test-SiteUp.ps1 "connorlsw.com" True PS C:\Users\sweeneyc\Desktop> .\Test-SiteUp.ps1 "connorlsw.notawebsite" False PS C:\Users\sweeneyc\Desktop> .\Test-SiteUp.ps1 "google.com" True PS C:\Users\sweeneyc\Desktop> .\Test-SiteUp.ps1 "isthisreallyasite.com" False  • @TessellatingHeckler irm returns plaintext for non-parsable pages, I was going to do a plaintext match so it would have behaved the same as iwr, regardless I guess if it works it works. Jul 6 '17 at 8:48 # Halovi, 20 bytes oisup.me/⁰ \p ye$hd0


Outputs p. if the site is down, and e. if it is up.

Explanation:

oisup.me/⁰  ~# Open the concatination of "isup.me/" and arg0
\p          ~# Select first p element
ye$hd0 ~# Edit text with neovim and output result: ~# Go one character before the end of the line and .. ~# delete until beginning  # Haskell (Lambdabot), 157 bytes import Data.ByteString.Lazy.Char8 import Network.HTTP.Simple f s=httpLBS(parseRequest_$"http://isup.me/"++s)>>=print.not.isInfixOf"u!".unpack.getResponseBody


Unfortunately you can't import Network.HTTP.Simple on tio.run, the easiest way to test would be to run this script (you'll need stack):

#!/usr/bin/env stack
-- stack --install-ghc --resolver lts-8.19 runghc --package http-conduit

import Data.ByteString.Lazy.Char8
import Network.HTTP.Simple
import Data.List

main :: IO ()
f s=httpLBS(parseRequest_$"http://isup.me/"++s) >>=print.not.isInfixOf"u!".unpack.getResponseBody  # Go, 111 bytes In typical Go fashion, the shortest method is to shell it out. import"os/exec" func h(a string)bool{return exec.Command("sh","-c","curl -L isup.me/"+a+"|grep ^I").Run()!=nil}  Other implementations here: https://play.golang.org/p/8T5HSDQFmC # Clojure, 63 bytes #(clojure.string/includes?(slurp(str"http://isup.me/"%))"'s j")  Checks if the HTML returned by slurp contains the string "'s j" (as in, "It 's just you"). I might be able to find a smaller string that's unique to the page, but it would at most save me 2 bytes. It would also potentially make it less accurate. "'s j" isn't going to appear in the markup anywhere except in that one scenario. A string like "u." however could potentially appear in the URL, which would break it. (defn is-up? [site] (clojure.string/includes? (slurp (str "http://isup.me/" site)) "'s j"))  # Nim, 108 bytes import httpclient,strutils echo newhttpclient().getcontent("//isup.me/"&stdin.readline.string).find("ks ")<0  Unfortunate that strutils is needed for contains. Learning Nim, tips appreciated! # PHP, 82 78 bytes <?=$i=$argv[1],+!preg_match("/!.*$i/",file_get_contents("http://isup.me/$i"));  Example i/o runs: $ php script.php google.com

$php script.php does.not.exist > does.not.exist0  • Almost the shortest solution possible. Empty output is "a falsy value" too, so you can remove the +. And with $argn instead of \$argv[1] you could use another 6 (minus 1) bytes. Dec 17 '17 at 18:33