Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_list_reclaim.py ZZZ
- import urllib
- import re
- import tempfile
- import webbrowser
- srcfilename=tempfile.mktemp(".html", "demo_")
- web="""<!DOCTYPE html>
- <html>
- <body><p><b>@</p></body>
- </html>"""
- try:
- # Python2
- from Tkinter import *
- from urllib2 import urlopen
- except ImportError:
- # Python3
- from tkinter import *
- from urllib.request import urlopen
- root=Tk()
- root.geometry('400x40+0+0')
- root.title('list reclaim')
- Frame3=LabelFrame(root,height=30,borderwidth=0)
- Frame3.pack(fill=X)
- Frame3.pack_propagate(False)
- zzz='''
- www.website1.com/images...logo-2.jpg
- www.website1.com/images...logo-14.jpg
- www.website4.com/images...logo-6.jpg
- www.website6.com/images...logo-7.jpg
- www.website7.com/images...logo-14.jpg
- www.website9.com/images...logo-18.jpg
- '''.split('\n')
- #
- def from_clipboard():
- global zzz
- crawled_urls = []
- def dblchk(z):
- if z not in crawled_urls:
- crawled_urls.append(z)
- url = root.clipboard_get()
- url=url.replace('.jpg','.jpg@@@')
- url=url.split('@@@')
- for z in zzz:
- v=0
- for c in url:
- if '...' in z:
- a,b=z.split('...')
- if a in c and b in c:
- dblchk(c)
- v=1
- else:
- dblchk(z)
- v=2
- if v is 0: print z
- if crawled_urls:
- temp=open(srcfilename, 'w')
- zzz='<br>'.join(crawled_urls)
- temp.write(web.replace('@',zzz))
- temp.close()
- webbrowser.open_new_tab(srcfilename)
- #
- 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