From c273479c816346c1936d94a582664dd67fa728fa Mon Sep 17 00:00:00 2001 From: Kuucheen <70746714+Kuucheen@users.noreply.github.com> Date: Sun, 14 Aug 2022 23:06:53 +0200 Subject: [PATCH] Add files via upload --- KC-Scraper.py | 106 +++++++++++++++++++++++++++++++--------------- premades/http.txt | 10 ++--- settings.json | 10 +++++ sites.txt | 1 - 4 files changed, 87 insertions(+), 40 deletions(-) create mode 100644 settings.json diff --git a/KC-Scraper.py b/KC-Scraper.py index f6ac06d..412b6c4 100644 --- a/KC-Scraper.py +++ b/KC-Scraper.py @@ -1,18 +1,34 @@ #by github.com/Kuucheen -import re, os, time, threading, httpx, random, ctypes -from pystyle import Colors, Colorate, Center +import re, os, time, threading, random, ctypes, json + +try: + import httpx + from pystyle import Colors, Colorate, Center +except ImportError: + os.system('python -m pip install httpx') + os.system('python -m pip install pystyle') + import httpx + from pystyle import Colors, Colorate, Center proxies = set([]) goodsites = set([]) proxycount = 0 threadcount = 0 -clearing = "n" +clearing = "" white = Colors.light_gray color = Colors.StaticMIX((Colors.purple, Colors.blue)) + def main(): global threadcount, clearing + with open("settings.json") as setting: + settings = json.load(setting) + + premades = settings["premades"] + clearing = settings["removewebsites"] + threads = settings["threads"] + terminal() os.system("cls") @@ -32,31 +48,41 @@ def main(): print(Colorate.Diagonal(Colors.DynamicMIX((Colors.dark_gray, Colors.StaticMIX((Colors.purple, Colors.blue)))), Center.XCenter(logo))) print("\n"*3) - premades = input(f"{white}[{color}^{white}] {color}Use premades [y/n] {white}>> {color}") + if premades == "?": + premades = input(f"{white}[{color}^{white}] {color}Use premades [y/n] {white}>> {color}") + if premades == "yes" or premades == "y": + os.system("cls") + print(Colorate.Diagonal(Colors.DynamicMIX((Colors.dark_gray, Colors.StaticMIX((Colors.purple, Colors.blue)))), Center.XCenter(logo))) + print(Colorate.Diagonal(Colors.DynamicMIX((Colors.dark_gray, Colors.StaticMIX((Colors.purple, Colors.blue)))), Center.XCenter("\n[1] HTTP/S\t[2] SOCKS4\t[3] SOCKS5"))) - if premades == "yes" or premades == "y": - os.system("cls") - print(Colorate.Diagonal(Colors.DynamicMIX((Colors.dark_gray, Colors.StaticMIX((Colors.purple, Colors.blue)))), Center.XCenter(logo))) - print(Colorate.Diagonal(Colors.DynamicMIX((Colors.dark_gray, Colors.StaticMIX((Colors.purple, Colors.blue)))), Center.XCenter("\n[1] HTTP/S\t[2] SOCKS4\t[3] SOCKS5"))) + premades = input(f"\n\n{white}[{color}^{white}] {white}>> {color}") - premades = input(f"\n\n{white}[{color}^{white}] {white}>> {color}") - - if premades == "1": - config = "premades/http.txt" - elif premades == "2": - config = "premades/socks4.txt" - elif premades == "3": - config = "premades/socks5.txt" - else: + elif premades != "no" and premades != "n": print(f"{white}[{color}!{white}] {color}No option was choosen returning to home..") time.sleep(3) main() exit() - elif premades == "no" or premades == "n": - config = "sites.txt" - os.system("cls") - print(Colorate.Diagonal(Colors.DynamicMIX((Colors.dark_gray, Colors.StaticMIX((Colors.purple, Colors.blue)))), Center.XCenter(logo))) + elif premades != "1" and premades != "2" and premades != "3" and premades != "n": + print(f"{white}[{Colors.red}!{white}] {Colors.red}Error{white} in settings.json at premades") + input() + exit() + + config = {"1": "premades/http.txt", "2": "premades/socks4.txt", "3": "premades/socks5.txt", "n": "sites.txt", "no": "sites.txt"} + + try: + config = config[premades] + except KeyError: + print(f"{white}[{color}!{white}] {color}No option was choosen returning to home..") + time.sleep(3) + main() + exit() + + + os.system("cls") + print(Colorate.Diagonal(Colors.DynamicMIX((Colors.dark_gray, Colors.StaticMIX((Colors.purple, Colors.blue)))), Center.XCenter(logo))) + + if clearing == "?": clearing = input(f"\n\n\n{white}[{color}^{white}] {color}Remove not connectable site [y/n] {white}>> {color}") @@ -65,27 +91,38 @@ def main(): time.sleep(3) main() exit() - elif clearing == "y" or clearing == "ye" or clearing == "yes": - clearing = True + elif clearing != "y" and clearing != "ye" and clearing != "yes" and clearing != "n" and clearing != "no": + print(f"{white}[{Colors.red}!{white}] {Colors.red}Error{white} in settings.json at removewebsites") + input() + exit() - else: - print(f"{white}[{color}!{white}] {color}No option was choosen returning to home..") - time.sleep(3) - main() + if clearing == "y" or clearing == "ye" or clearing == "yes": + clearing = True + + + if threads == "?": + threads = input(f"{white}[{color}^{white}] {color}Threads {white}>> {color}") + elif threads.isdigit() == False: + print(f"{white}[{Colors.red}!{white}] {Colors.red}Error{white} in settings.json at threads") + input() exit() - - threads = input(f"{white}[{color}^{white}] {color}Threads {white}>> {color}") - print() - try: threads = int(threads) except ValueError: - print(f"{white}[{color}!{white}] Thread needs a number") + print(f"{white}[{color}!{white}] {color}Thread needs a number") time.sleep(3) + main() + exit() + + if threads < 1: + print(f"{white}[{color}!{white}] {color}Thread needs a number greater than 0") + time.sleep(3) + main() exit() + print() start = time.time() with open(config) as sites: @@ -121,7 +158,7 @@ def main(): print(f"{white}[{color}^{white}] Removing {color}not reachable Websites\n") - with open("sites.txt", "w") as inp: + with open(config, "w") as inp: for site in goodsites: inp.write(site + "\n") @@ -174,10 +211,11 @@ def scrape(site: str): threadcount -= 1 - def terminal(string:str = ""): ctypes.windll.kernel32.SetConsoleTitleW("KC Scraper | github.com/Kuucheen " + string) + + main() \ No newline at end of file diff --git a/premades/http.txt b/premades/http.txt index cc96b76..d3341a0 100644 --- a/premades/http.txt +++ b/premades/http.txt @@ -1,8 +1,8 @@ -https://api.proxyscrape.com/v2/?request=getproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all -https://www.juproxy.com/free_api -http://pubproxy.com/api/proxy https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt +https://api.proxyscrape.com/v2/?request=getproxies&protocol=http&timeout=10000&country=all&ssl=all&anonymity=all +https://openproxy.space/list/http +https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-http.txt https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/http.txt https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/http.txt -https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-http.txt -https://openproxy.space/list/http \ No newline at end of file +http://pubproxy.com/api/proxy +https://www.juproxy.com/free_api diff --git a/settings.json b/settings.json new file mode 100644 index 0000000..19c06a6 --- /dev/null +++ b/settings.json @@ -0,0 +1,10 @@ +{ + + "#": "'?' for asking | 'n' for sites.txt | '1' for http/s | '2' for socks4 | '3' for socks5", + "premades": "?", + "#": "'?' for asking | 'y' or 'n'", + "removewebsites": "?", + "#": "'?' for asking | '[Threadcount]'", + "threads": "?" + +} \ No newline at end of file diff --git a/sites.txt b/sites.txt index 8b13789..e69de29 100644 --- a/sites.txt +++ b/sites.txt @@ -1 +0,0 @@ -