[Python] Get full url from shorten url using python

Discussão em 'Python' iniciado por Stack, Março 29, 2025.

  1. Stack

    Stack Membro Participativo

    I am having list of urls like ,

    l=['bit.ly/1bdDlXc','bit.ly/1bdDlXc',.......,'bit.ly/1bdDlXc']


    I just want to see the full url from the short one for every element in that list.

    Here is my approach,

    import urllib2

    for i in l:
    print urllib2.urlopen(i).url


    But when list contains thousands of url , the program takes long time.

    My question : Is there is any way to reduce execution time or any other approach I have to follow ?

    Continue reading...

Compartilhe esta Página