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

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <andipersti@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'output': 0.05; 'append': 0.09; 'url:github': 0.09; 'subject:How': 0.10; 'python': 0.11; '>that': 0.16; 'andreas': 0.16; 'bye,': 0.16; 'interacting': 0.16; 'skip:> 20': 0.16; 'subject:URL': 0.16; 'subject:after': 0.16; 'wrote:': 0.18; 'module': 0.19; 'example': 0.22; 'url:dev': 0.24; 'header:In-Reply-To:1': 0.27; 'link.': 0.33; 'received:google.com': 0.35; 'there': 0.35; 'charset:us-ascii': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'here': 0.66; 'subject:get': 0.81; 'url:bitly': 0.84; 'url:links': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; bh=hbfFR9wR9pEneTVmzkIryBiDhWMdEdr9Djl6NtA2Y3o=; b=pSjh1F+bdHBbUOefslrZ5HUGqP6FwTZrICNabINzkhWL0OfPhOCd8WxSj72VxUeoR0 /53OixELFSPQny7DjVXyaepkd0TvzHpYqSqbnKYpOppiQCflUbl+9W7HG6lCBeHMX5lS 5OahO0AcTbjhXE/cRCbutFuvGqDzlJrNlZ91kQ70Iuf5kBDwpjVF4bnAsWvjSxsV0HaF T1JSejk/A69bZ3AQYCUi885n5WL1kZ/Qqlj4MuhmRBB6qgke4L+In0hzKr9p1YcVzI72 Actix9QaQccFg/Ww13D5rp0tckvUX7+k8hvm524AbmnY/s7+tYGvv8kaNHS/Ca4DA4Hp TE1w==
X-Received by 10.205.78.5 with SMTP id zk5mr3060353bkb.25.1383241359762; Thu, 31 Oct 2013 10:42:39 -0700 (PDT)
Date Thu, 31 Oct 2013 18:42:35 +0100
From Andreas Perstinger <andipersti@gmail.com>
To python-list@python.org
Subject Re: How to get final URL after redirection
In-Reply-To <d728b722-d978-4f94-b053-e0374a09ffbb@googlegroups.com>
References <d728b722-d978-4f94-b053-e0374a09ffbb@googlegroups.com>
X-Mailer Claws Mail 3.8.0 (GTK+ 2.24.10; i686-pc-linux-gnu)
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1887.1383242269.18130.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1383242269 news.xs4all.nl 15867 [2001:888:2000:d::a6]:48096
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:58198

Show key headers only | 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