def f5(): wait= dialog.Wait(cn("正在刷新列表!")) wait.show() try: s.cookie=open(path+"cookie.ini").read() s.tbnet.BDUSS=s.cookie except: t=s.getcookie() if t=="error": wait.close() return wait.set_label(cn("正在刷新列表!")) if 1: s.tblist=[] tmp=s.tbnet.getUserLikedForum() tmp=tmp["forum_list"] for i in range(len(tmp)): s.tblist.append(cn(en(s.tbnet.uto(tmp[i]["name"])))) open(path+"allbar.txt","w").write(str(s.tblist)) ui.note(cn("获取完成!共获取"+str(len(s.tblist))+"个喜欢的贴吧!")) else: ui.note(cn("获取喜欢的吧失败!请检查帐号密码是否正确!")) wait.close() for i in range(len(s.tblist)): if(s.tblist[i] in s.oldlist): s.tblist[i]=cn("√ "+en(s.tblist[i])) reload(s.tblist)
def getcookie(s): wait= dialog.Wait(cn("正在获取cookie!")) wait.show() t=s.tbnet.login() if t!="success": return "error" s.cookie=s.tbnet.BDUSS if(ui.query(cn("是否保存cookie?"),"query")): open(path+"cookie.ini","w").write(s.cookie) ui.note(cn("cookie保存成功!")) wait.close()
def web_source(): myurl = m.get() try: str(myurl) if len(myurl) == 0: appuifw.note(cn('请先输入网址!'), 'error') pass else: w = dialog.Wait(cn("正在联网获取\n请稍后 …")) w.show() try: params = urllib.urlencode({"": ""}) headers = { 'Content-type': 'application/x-www-form-urlencoded', 'Accept': 'text/plain' } conn = httplib.HTTPConnection('10.0.0.172', 80) conn.request('POST', myurl, params, headers) data = conn.getresponse().read() conn.close() n = (cn(data).replace(u'amp;', u'')) f = cn('e:\\网页源码.txt') b = open(en(f), 'w') b.write(en(n)) b.close() if appuifw.query(cn('现在查看 ?'), 'query'): m.color = 0x238623 m.set(n) else: m.color = 0x0000ff m.add(cn('\n\n\n任务完成,网页源码已保存至\n\n\t')) m.color = 0xff00ff m.add(f) except: pass m.color = 0xff00ff m.add(cn('\n\n获取源码失败 !!')) w.close() except: appuifw.note(cn('网址中不能含有中文!'), 'error') pass
def web_source(): try: myurl = m.get() str(myurl) w = dialog.Wait(cn("正在联网获取\n请稍后 …")) w.show() params = urllib.urlencode({"": ""}) headers = { 'Content-type': 'application/x-www-form-urlencoded', 'Accept': 'text/plain' } conn = httplib.HTTPConnection('10.0.0.172', 80) conn.request('POST', myurl, params, headers) data = conn.getresponse().read() conn.close() m.set(cn(data)) except: appuifw.note(cn("无法获取!"), "error") m.set( cn("网页源码无法获取,可能发生了以下错误:\n1.网址中含中文\n2.网址不存在\n3.网址没以“http://”开头\n4.用户处于离线状态" ))
import dialog,e32#dialog是进度条模块 def cn(x):return x.decode("utf8") wait=dialog.Wait(cn("请稍后…"))#设置初现字幕 wait.show()#显示进度条 e32.ao_sleep(2)#这里放上程序 wait.set_label(cn("正在安装…"))#更改显示的字幕 e32.ao_sleep(2)#这里放上程序 wait.close()#关闭进度条