minor fixed rghost
[archive.git] / Apkawa / konachan_api.py
blob0ffbe58ff8dc3cd0c59f37fc5467a0d9179ddbc3
1 import urllib,re
3 host = 'konachan.com'
4 xml = '/post/index.xml'
5 tag = 'lucky_star'
7 quere = urllib.urlencode({'tags':tag, 'limit':'1'})
8 print quere
9 src = urllib.urlopen('http://%s%s?%s'%(host,xml,quere)).read()
10 #preview_url="http://konachan.com/data/preview/200d8628e9cae4e092b86b99e9709c99.jpg" parent_id="" id="34689" score="1" file_url="http://konachan.com/image/200d8628e9cae4e092b86b99e9709c99/Konachan.com%20-%2034689%20izumi_konata%20lucky_star.png"
11 preview_urls = re.findall('preview_url="(http://konachan.com/data/preview/.*?)"',src)
12 file_urls = re.findall('file_url="(http://konachan.com/image/.*?)"',src)
13 print src, preview_urls, file_urls