4 xml
= '/post/index.xml'
7 quere
= urllib
.urlencode({'tags':tag
, 'limit':'1'})
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