dimanche 16 novembre 2014

Cut and resubmit url in python


Vote count:

0




I'm new to python and trying to figure this out, so sorry if this has been asked. I couldn't find it and don't know what this may be called.


So the short of it. I want to take a link like.


http://ift.tt/1uwMh4n


and turn it into this http://ift.tt/1t1FjP6


The long of it, I have been working on a addon for xbmc that goes to a website, grabs a url, goes to that url to find another url. Basically a url resolver.


So the program searches the site and comes up with somekeyhere-650x370.html But that page is in java and is unusable to me. but when I go to com/somekeyhere that code is usable. So I need to grab the first url, change the url to the usable page and then scrape that page.


So far the code I have is



if 'somename' in name:
try:
n=re.compile('<iframe title="somename" frameborder="0"',re.DOTALL).findall(net().http_GET(url).content)[0]
CONVERT URL HERE SO BELOW NA CAN READ IT.
na = re.compile("'file=(.+?)&.+?'",re.DOTALL).findall(net().http_GET(na).content)[0]


Any suggestions to how I can accomplish converting the url?



asked 18 secs ago







Cut and resubmit url in python

Aucun commentaire:

Enregistrer un commentaire