Create a gist now

Instantly share code, notes, and snippets.

@oelmekki /demo.md Secret
Last active Sep 26, 2016

What would you like to do?

If I use curl to post it on ExplainToMe, I get:

$ curl -X POST -H "Content-Type: application/json" -d '{"url": "https://t.co/20KazEmiQ3"}' https://explaintome.herokuapp.com/api/v1.0/summary
{
  "max_sent": 10, 
  "meta": {
    "authors": [], 
    "domain": "t.co", 
    "image": null, 
    "meta": {
      "canonical": "https://t.co/20KazEmiQ3", 
      "description": "", 
      "favicon": "",
      "keywords": "",
      "lang": null
    },
    "opengraph": {},
    "publish_date": null,
    "tags": [],
    "title": "https://medium.com/product-hunt/what-should-you-focus-on-as-a-new-startup-founder-eab06161f6b3?source=twitterShare-6d3266d9a2d7-1474640398"
  },
  "summary": [
    "<goose.article.Article object at 0x7f40aaf1ec50>"
  ],
  "url": "https://t.co/20KazEmiQ3"
}

If think we can agree that "goose.article.Article" is not a very good summary ;)

If I use curl on that t.co link (which is actually a redirect to bit.ly, then a redirect to medium), I get:

$ curl -I https://t.co/20KazEmiQ3
HTTP/1.1 301 Moved Permanently
cache-control: private,max-age=300
content-length: 0
date: Sat, 24 Sep 2016 12:34:15 GMT
expires: Sat, 24 Sep 2016 12:39:15 GMT
location: https://medium.com/product-hunt/what-should-you-focus-on-as-a-new-startup-founder-eab06161f6b3?source=twitterShare-6d3266d9a2d7-1474640398

Even worse, when using fetch in the browser:

fetch( 'https://t.co/20KazEmiQ3' ).then( function(resp){ console.log("response",resp.status); resp.text().then(function(resp){ console.log(resp); }); })
// => response 200
// =>  <head><noscript><META http-equiv="refresh" content="0;URL=https://medium.com/product-hunt/what-should-you-focus-on-as-a-new-startup-founder-eab06161f6b3?source=twitterShare-6d3266d9a2d7-1474640398"></noscript><title>https://medium.com/product-hunt/what-should-you-focus-on-as-a-new-startup-founder-eab06161f6b3?source=twitterShare-6d3266d9a2d7-1474640398</title></head><script>window.opener = null; location.replace("https:\/\/medium.com\/product-hunt\/what-should-you-focus-on-as-a-new-startup-founder-eab06161f6b3?source=twitterShare-6d3266d9a2d7-1474640398")</script>

This is not even a http redirection, bit.ly generate a 200 success response with the redirection embedded in html document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment