Skip to content

Instantly share code, notes, and snippets.

@showyou
Created February 25, 2010 17:46
Show Gist options
  • Select an option

  • Save showyou/314804 to your computer and use it in GitHub Desktop.

Select an option

Save showyou/314804 to your computer and use it in GitHub Desktop.
#! -*- coding:utf-8 -*-
import urllib
url = "http://pcod.no-ip.org/yats/search?"
url2 ="http://showyou.ath.cx/kyoukitter/json?"
word = u"アプリ"
urls1 = url2 + urllib.urlencode({'word': word.encode('utf-8')}) + "&max=5"
f = urllib.urlopen(urls1)
import simplejson
data = simplejson.loads(f.read())
query = word
for d in data:
if query != "": query += " or "
query += d["word"]
print query
query = { 'query': query.encode('utf-8') }
urls = url + urllib.urlencode(query) + '&json'
f = urllib.urlopen(urls)
data = simplejson.loads(f.read())
for d in data:
print d["user"], ":", d["content"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment