def for_rc():
#rc = []
apiurl="https://zh.moegirl.org/api.php"
format="%Y%m%d%H%M%S"
utc=datetime.datetime.utcnow()
rcstart=(utc-datetime.timedelta(hours=1)).strftime(format)
rcend=utc.strftime(format)
parmas=urllib.urlencode({'format':'json','action':'query','list':'recentchanges','rcstart':rcstart,'rcend':rcend,'rcdir':'newer','rcnamespace':'0','rctoponly':'','rctype':'edit|new','continue':'','rcprop':'title|sizes'})
req=urllib2.Request(url=apiurl,data=parmas)
res_data=urllib2.urlopen(req)
ori=res_data.read()
rcc=json.loads(ori,object_hook=_decode_dict)
rcc=OrderedDict(rcc)
key = rcc['query'].keys()[0]
lists = rcc['query'][key]
#print type(value)
#for i in range(len(value)):
#rc.append(value[i]['title'])
return lists
评论列表
文章目录