Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_free_android_games_by_day_link_automator.py
- try:
- # Python2
- from Tkinter import *
- from urllib2 import urlopen
- except ImportError:
- # Python3
- from tkinter import *
- from urllib.request import urlopen
- import webbrowser
- import time
- from datetime import datetime, timedelta
- html='?????'
- max=''
- w,h = '160','160'
- root=Tk()
- root.geometry('1280x654+0+0')
- root.title('Free Android Games Link Automator')
- topFrame=LabelFrame(root,text="",height=600)
- topFrame.pack(fill=X)
- topFrame.pack_propagate(False)
- Frame2=LabelFrame(root,height=24,borderwidth=0)
- Frame2.pack(fill=X)
- Frame2.pack_propagate(False)
- Frame3=LabelFrame(root,height=30,borderwidth=0)
- Frame3.pack(fill=X)
- Frame3.pack_propagate(False)
- ffff=Listbox(topFrame,selectmode=SINGLE)
- ffff.pack(fill=BOTH,expand=YES,side=LEFT)
- ffff.configure(selectmode=SINGLE)
- def dblclk(event):
- html=ffff.curselection()
- html=goto[int(html[0])]
- webbrowser.open(html)
- ffff.bind("<Double-Button-1>", dblclk)
- scroll=Scrollbar(topFrame)
- scroll.pack(side=RIGHT,fill=Y,expand=NO)
- scroll.configure(command=ffff.yview)
- ffff.configure(yscrollcommand=scroll.set)
- links=[]
- goto=[]
- #
- def update_list(items):
- ffff.delete(0, END)
- for item in items:
- ffff.insert(END,item)
- root.update()
- update_list(goto) # None
- #
- def from_clipboard():
- data = root.clipboard_get()
- url.set(data)
- root.update()
- url_text()
- #
- def all_links():
- global links, goto, max
- links=[]
- goto=[]
- t=''
- zyear,zmonth,zday=[int(i) for i in max.split('-')]
- i=datetime.now()-datetime(zyear, zmonth, zday)
- i=i.days
- while 1:
- ttt=datetime.now()-timedelta(days=i)
- if ttt.year < 1992 or len(links) > 399: break
- ttt='%s-%s-%s' %(ttt.year,ttt.month,ttt.day)
- tmp=html+'&hl=en&biw='+w+'&bih='+h+'&source=lnt&tbs=cdr%3A1%2Ccd_min%3A'+ttt+'%2Ccd_max%3A'+ttt+'&tbm=isch'
- links.append(ttt)
- goto.append(tmp)
- t+=tmp+'\n\n'
- i+=1
- print t
- print
- goto=goto[1:]
- update_list(links[1:])
- #
- def url_text():
- global html, max
- html=url.get()
- print html
- if "play.google.com%2Fstore%2Fapps+" not in html:
- html='https://www.google.ca/search?q=site%3Ahttps%3A%2F%2Fplay.google.com%2Fstore%2Fapps+free+games+strategy&gs_l'
- try:
- max=html[html.index('%2Ccd_max%3A')+12:html.index('&tbm=isch')]
- except:pass
- if not max:
- td=datetime.now()
- max='%s-%s-%s' %(td.year,td.month,td.day)
- try:
- html=html[:html.index('&hl=en')]
- except: pass
- all_links()
- #
- btn=Button(Frame2,text="Enter URL",width=16,command=url_text)
- btn.pack(side=LEFT)
- url=StringVar()
- ent=Entry(Frame2,width="160",textvariable=url)
- ent.pack(side=LEFT)
- cpb=Button(Frame3,text="Clipboard",width=16,command=from_clipboard)
- cpb.pack(side=LEFT)
- lbl=Label(Frame3)
- lbl.pack(side=LEFT)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement