Categories

获取重定向后的url

1. bash

curl --head -q http://yourURL.com/webpage.html | grep Location | awk '{ print $2 ;}'

2. Python urllib

urllib.urlopen('http://redirect.url').geturl()

3. Python urllib2

urllib2.urlopen('http://redirect.url').geturl()

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  

  

  

*