Wednesday, October 21, 2009

How to fetch feed url from web page in python


import urllib2
from lxml import etree

webPageUrl = ""
opener = urllib2.build_opener()
response =
if response.headers.__getitem__('Content-Type').startswith('text/html'):
html_element = etree.HTML( )
link_elements =html_element.findall('.//link[@rel="alternate"]')
if link_elements.__len__() > 0:
# so we can have several link tags, i use just the first
feedUrl = link_elements.__getitem__(0).get('href')

except urllib2.URLError:
# commander! do something violent

Tuesday, October 13, 2009 API

Dear Sudar'! ^_^
Please! Try out API.
It's implemented on json-rpc.
method: shorten
argument: url
return: shorten_url

Some examples:


$client = new jsonRPCClient("");

echo $client->shorten( "");


Also JSON-RPC PHP lib here

Have a nice shortening!
Powered by Blogger.