On 2018-02-21 (00:52 MST), Charles Sprickman <sp...@bway.net> wrote:
> 
> You can also see all the analytics by appending “.info” to the URL, eg: 
> http://goo.gl/ylUAd.info

True, but that is a web browser solution, not something that could, for 
example, be scripted (well, not easily or realistically for this sort of task).

Also, appending a "+" I believe does the same thing, and is easier to type. 
http://goo.gl/ylUAd+

Either way, that redirects to a URL in the form

<https://goo.gl/#analytics/goo.gl/<shortcode>/all_time>

So that could probably be scraped as well if you really wanted to scrape a web 
page.

Still, this isn't a viable solution for spam checking, though I suspect there 
is a low-cost "get redirect URI" library that would have less overhead than 
curl and could grab the Location from the 301 (or 302?) redirect, much like 
curl can do with a -I or -i flags.

Regardless, Reindl was clearly wrong that checking the shortner targets would 
require loading the target URL.

Maybe curl ain't so bad?

# time curl -sI http://goo.gl/ylUAd | grep -o "http.*"
http://www.hollywoodreporter.com/thr-esq/donald-trump-threatens-sue-macy-422135

real    0m0.098s
user    0m0.000s
sys     0m0.008s

I threw this together in a few minutes and it seems to work:

---
#!/bin/bash

  if [ "$1" = "" ]; then
   echo "usage $0 <URL>"
   exit 1
  else 
   URL="$1"
  fi

myInfo=$(curl -sI $URL | grep -o "http.*")
if [ "$myInfo" = "" ]; then
   exit 404
else
   echo $myInfo
fi
---

 # curlri www.covisp.net # This uses rewrite
https://www.covisp.net/
 # curlri www.google.com # No redirect, so returned 404
 # curlri http://goo.gl/ylUAd # Voila!
http://www.hollywoodreporter.com/thr-esq/donald-trump-threatens-sue-macy-422135

It even works for the t.co link:

 # curlri http://t.co/UShCXQG
http://www.youtube.com/watch?v=dfJ6oCdjY9Y

-- 
It is one thing to be mistaken; it is quite another to be willfully
ignorant ~Cecil Adams

Reply via email to