├── README.md ├── SD_Finder.exe ├── SD_Finder.py ├── searcher.py ├── sieve.py ├── test.py ├── web_list copy.txt └── web_list.txt /README.md: -------------------------------------------------------------------------------- 1 | # SD-Finder 2 | Find available stable diffusion online 3 | -------------------------------------------------------------------------------- /SD_Finder.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheKOG/SD-Finder/6f942e8805e3b90a59ec180a19df389656659491/SD_Finder.exe -------------------------------------------------------------------------------- /SD_Finder.py: -------------------------------------------------------------------------------- 1 | #-*-coding:utf-8-*- 2 | import _thread 3 | import time 4 | import ctypes 5 | import tkinter as tk 6 | from webbrowser import open as webopen 7 | from searcher import Search 8 | from sieve import Sieve 9 | import _thread 10 | import tkinter.messagebox 11 | import os 12 | 13 | EDGE=100 14 | urls={} 15 | flag=[False] 16 | 17 | class Win(tk.Tk, object): 18 | def __init__(self): 19 | super(Win, self).__init__() 20 | self.title('SD Finder') 21 | moni=ctypes.windll.user32 22 | global wt 23 | global ht 24 | wt=moni.GetSystemMetrics(0) 25 | ht=moni.GetSystemMetrics(1) 26 | self._build_win() 27 | #self.geometry('{0}x{1}'.format(10 * 30, 10 * 30)) 28 | self.resizable(False,False) 29 | 30 | def _build_win(self): 31 | self.geometry("{0}x{1}+{2}+{3}".format(EDGE*5,EDGE*5,int((wt-EDGE*5)/2),int((ht-EDGE*5)/2))) 32 | self.b1=tk.Scrollbar(self,width=20) 33 | self.b1.pack(side = tk.RIGHT, fill = tk.Y) 34 | self.lb = tk.Listbox(self,yscrollcommand=self.b1.set,height=30,width=30) 35 | self.lb.pack(side=tk.RIGHT) 36 | self.b1.config(command=self.lb.yview) 37 | self.refresh=tk.Button(self,text='刷新',command=lambda:Refresh(self)) 38 | self.sieve=tk.Button(self,text='筛除',command=lambda:_thread.start_new_thread(Sieve_,(root,))) 39 | self.search=tk.Button(self,text='搜索',command=lambda:_thread.start_new_thread(Search_,(root,))) 40 | self.stop=tk.Button(self,text='停止',command=Stop) 41 | self.refresh.pack() 42 | self.sieve.pack() 43 | self.search.pack() 44 | self.b2=tk.Scrollbar(self,width=20) 45 | self.b2.pack(side=tk.LEFT, fill=tk.Y) 46 | self.lb2 = tk.Listbox(self,yscrollcommand=self.b2.set,height=20,width=30) 47 | self.lb2.pack(side=tk.LEFT) 48 | self.b2.config(command=self.lb2.yview) 49 | self.refresh.place(x=20,y=10) 50 | self.sieve.place(x=20,y=50) 51 | self.search.place(x=20,y=90) 52 | self.lb2.place(x=20,y=120) 53 | self.b2.place(x=0,y=120,height=EDGE*5-120) 54 | self.stop.place(x=60,y=10) 55 | self.text_low=tk.StringVar() 56 | self.text_low.set("10000") 57 | self.low=tk.Entry(self,textvariable=self.text_low) 58 | self.text_high=tk.StringVar() 59 | self.text_high.set("30000") 60 | self.high=tk.Entry(self,textvariable=self.text_high) 61 | self.low.place(x=60,y=90,width=50) 62 | self.high.place(x=120,y=90,width=50) 63 | 64 | def Run(root): 65 | while True: 66 | if root.lb.curselection()!=(): 67 | choice=root.lb.curselection()[0] 68 | print(choice) 69 | webopen(urls[choice]) 70 | root.lb.select_clear(0,tk.END) 71 | time.sleep(0.2) 72 | 73 | def Refresh(root): 74 | if not os.path.exists('web_list.txt'): 75 | return 76 | with open('web_list.txt','r',encoding='utf-8') as f: 77 | root.lb.delete(0,tk.END) 78 | lines=f.readlines() 79 | for i,line in enumerate(lines): 80 | root.lb.insert(i,line) 81 | urls[i]=line 82 | n=len(lines) 83 | if nmaxtot: 56 | continue 57 | # print(i) 58 | url="https://{0}.gradio.app/".format(i) 59 | if url in lines: 60 | continue 61 | _thread.start_new_thread(Bing,(lsbox,url,f)) 62 | time.sleep(0.005) 63 | time.sleep(0.5) 64 | while tot>0: 65 | continue 66 | f.close() 67 | if lsbox!=None: 68 | lsbox.insert(tk.END,"Searching Over") -------------------------------------------------------------------------------- /sieve.py: -------------------------------------------------------------------------------- 1 | import _thread 2 | from urllib import request 3 | import time 4 | import tkinter as tk 5 | 6 | ban=['Bad Gateway','Internal Server Error','No interface is running right now','"auth_required": true'] 7 | requires=['txt2img'] 8 | tot=0 9 | def Bing(lsbox,url,f): 10 | global tot 11 | global timeset 12 | # print(id) 13 | if url in urls: 14 | return 15 | tot+=1 16 | try: 17 | rq=request.Request(url) 18 | rp=request.urlopen(rq) 19 | rep=rp.read().decode('utf-8') 20 | # print(rep) 21 | for ele in ban: 22 | if ele in rep: 23 | if lsbox!=None: 24 | lsbox.insert(tk.END,"Delete "+url) 25 | # print("del "+url) 26 | tot-=1 27 | return 28 | for ele in requires: 29 | if ele not in rep: 30 | if lsbox!=None: 31 | lsbox.insert(tk.END,"Delete "+url) 32 | tot-=1 33 | return 34 | if lsbox!=None: 35 | lsbox.insert(tk.END,"Remain "+url) 36 | f.write(url+'\n') 37 | f.flush() 38 | urls.append(url) 39 | tot-=1 40 | return 41 | except: 42 | tot-=1 43 | return 44 | 45 | def Sieve(flag,lsbox=None,maxtot=1000): 46 | global timeset 47 | global urls 48 | timeset=0 49 | if lsbox!=None: 50 | lsbox.insert(tk.END,"Sieving the urls...") 51 | try: 52 | f=open("web_list.txt",'r',encoding='utf-8') 53 | lines=f.readlines() 54 | f.close() 55 | except: 56 | lines=[] 57 | f=open("web_list.txt",'w',encoding='utf-8') 58 | urls=[] 59 | for line in lines: 60 | if(flag[0]): 61 | break 62 | # print(line) 63 | while tot>maxtot: 64 | continue 65 | url=line.strip('\n') 66 | _thread.start_new_thread(Bing,(lsbox,url,f)) 67 | time.sleep(0.5) 68 | while tot>0: 69 | continue 70 | f.close() 71 | if lsbox!=None: 72 | lsbox.insert(tk.END,"Sieving Over") -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | import _thread 2 | import time 3 | import random 4 | a=list(range(1,11)) 5 | random.shuffle(a) 6 | print(a) -------------------------------------------------------------------------------- /web_list copy.txt: -------------------------------------------------------------------------------- 1 | https://10018.gradio.app/ 2 | https://10043.gradio.app/ 3 | https://10048.gradio.app/ 4 | https://10022.gradio.app/ 5 | https://10035.gradio.app/ 6 | https://10121.gradio.app/ 7 | https://10173.gradio.app/ 8 | https://10181.gradio.app/ 9 | https://10222.gradio.app/ 10 | https://10218.gradio.app/ 11 | https://10146.gradio.app/ 12 | https://10272.gradio.app/ 13 | https://10257.gradio.app/ 14 | https://10269.gradio.app/ 15 | https://10290.gradio.app/ 16 | https://10302.gradio.app/ 17 | https://10368.gradio.app/ 18 | https://10383.gradio.app/ 19 | https://10392.gradio.app/ 20 | https://10438.gradio.app/ 21 | https://10440.gradio.app/ 22 | https://10449.gradio.app/ 23 | https://10444.gradio.app/ 24 | https://10456.gradio.app/ 25 | https://10509.gradio.app/ 26 | https://10476.gradio.app/ 27 | https://10467.gradio.app/ 28 | https://10548.gradio.app/ 29 | https://10537.gradio.app/ 30 | https://10472.gradio.app/ 31 | https://10591.gradio.app/ 32 | https://10651.gradio.app/ 33 | https://10673.gradio.app/ 34 | https://10711.gradio.app/ 35 | https://10738.gradio.app/ 36 | https://10742.gradio.app/ 37 | https://10731.gradio.app/ 38 | https://10740.gradio.app/ 39 | https://10758.gradio.app/ 40 | https://10765.gradio.app/ 41 | https://10756.gradio.app/ 42 | https://10757.gradio.app/ 43 | https://10828.gradio.app/ 44 | https://10832.gradio.app/ 45 | https://10829.gradio.app/ 46 | https://10805.gradio.app/ 47 | https://10868.gradio.app/ 48 | https://10849.gradio.app/ 49 | https://10859.gradio.app/ 50 | https://10862.gradio.app/ 51 | https://10888.gradio.app/ 52 | https://10864.gradio.app/ 53 | https://10926.gradio.app/ 54 | https://10966.gradio.app/ 55 | https://10934.gradio.app/ 56 | https://11001.gradio.app/ 57 | https://11028.gradio.app/ 58 | https://11004.gradio.app/ 59 | https://11068.gradio.app/ 60 | https://11041.gradio.app/ 61 | https://11089.gradio.app/ 62 | https://11107.gradio.app/ 63 | https://11081.gradio.app/ 64 | https://11142.gradio.app/ 65 | https://11152.gradio.app/ 66 | https://11151.gradio.app/ 67 | https://11091.gradio.app/ 68 | https://11154.gradio.app/ 69 | https://11212.gradio.app/ 70 | https://11281.gradio.app/ 71 | https://11299.gradio.app/ 72 | https://11346.gradio.app/ 73 | https://11345.gradio.app/ 74 | https://11367.gradio.app/ 75 | https://11349.gradio.app/ 76 | https://11376.gradio.app/ 77 | https://11386.gradio.app/ 78 | https://11404.gradio.app/ 79 | https://11418.gradio.app/ 80 | https://11432.gradio.app/ 81 | https://11450.gradio.app/ 82 | https://11483.gradio.app/ 83 | https://11510.gradio.app/ 84 | https://11536.gradio.app/ 85 | https://11561.gradio.app/ 86 | https://11557.gradio.app/ 87 | https://11620.gradio.app/ 88 | https://11625.gradio.app/ 89 | https://11641.gradio.app/ 90 | https://11648.gradio.app/ 91 | https://11623.gradio.app/ 92 | https://11650.gradio.app/ 93 | https://11652.gradio.app/ 94 | https://11697.gradio.app/ 95 | https://11740.gradio.app/ 96 | https://11748.gradio.app/ 97 | https://11775.gradio.app/ 98 | https://11766.gradio.app/ 99 | https://11749.gradio.app/ 100 | https://11721.gradio.app/ 101 | https://11813.gradio.app/ 102 | https://11819.gradio.app/ 103 | https://11885.gradio.app/ 104 | https://11951.gradio.app/ 105 | https://11962.gradio.app/ 106 | https://11980.gradio.app/ 107 | https://11992.gradio.app/ 108 | https://11955.gradio.app/ 109 | https://12000.gradio.app/ 110 | https://12066.gradio.app/ -------------------------------------------------------------------------------- /web_list.txt: -------------------------------------------------------------------------------- 1 | https://11346.gradio.app/ 2 | https://11345.gradio.app/ 3 | https://11625.gradio.app/ 4 | https://11107.gradio.app/ 5 | https://11107.gradio.app/ 6 | https://10438.gradio.app/ 7 | https://11652.gradio.app/ 8 | https://10368.gradio.app/ 9 | https://10731.gradio.app/ 10 | https://11641.gradio.app/ 11 | https://11081.gradio.app/ 12 | https://12066.gradio.app/ 13 | https://11813.gradio.app/ 14 | https://10272.gradio.app/ 15 | https://11623.gradio.app/ 16 | --------------------------------------------------------------------------------