urlwalker
Traverse URL redirects and rel="canonical"
's until you hit the end of the line.
Example
var urlwalker = var originalUrl = 'https://medium.com/p/3689f413af27?nonsense=something'urlwalker
You can optionally validate that the final URL actually works (does not return >=400 status). The validate
parameter defaults to false
.
// At the time of writing this, NYT generates a broken canonical URL, which should just be this// URL but without the query paramsvar originalUrl = 'http://www.nytimes.com/roomfordebate/2015/05/08/can-the-us-make-peace-with-netanyahus-new-government?a=b' urlwalker urlwalker