Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #58198

Re: How to get final URL after redirection

Date 2013-10-31 18:42 +0100
From Andreas Perstinger <andipersti@gmail.com>
Subject Re: How to get final URL after redirection
References <d728b722-d978-4f94-b053-e0374a09ffbb@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.1887.1383242269.18130.python-list@python.org> (permalink)

Show all headers | View raw


nishant bhakta <bhaktanishant@gmail.com> wrote:

>I have a link that will redirect to any-other link and i have to work
>with that final link. For example if i have a link "www.bit.ly/2V6CFi"
>that will redirect to "www.google.com". Here i want that i take
>"www.bit.ly/2V6CFi" and find the final redirect link and append
>"#q=python" to that link and produce an output that is
>"www.google.com/#q=python".

For bitly links you need to use their API:
http://dev.bitly.com/links.html#v3_expand

There is a python module for interacting with it:
https://github.com/bitly/bitly-api-python

Bye, Andreas

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to get final URL after redirection nishant bhakta <bhaktanishant@gmail.com> - 2013-10-31 09:17 -0700
  Re: How to get final URL after redirection Andreas Perstinger <andipersti@gmail.com> - 2013-10-31 18:42 +0100
    Re: How to get final URL after redirection nishant bhakta <bhaktanishant@gmail.com> - 2013-10-31 11:10 -0700
      Re: How to get final URL after redirection Roy Smith <roy@panix.com> - 2013-10-31 11:33 -0700
        Re: How to get final URL after redirection Joel Goldstick <joel.goldstick@gmail.com> - 2013-10-31 14:43 -0400
        Re: How to get final URL after redirection Roy Smith <roy@panix.com> - 2013-10-31 14:50 -0400

csiph-web