first version, kinda rough
This commit is contained in:
parent
74213266e9
commit
876abec47f
2 changed files with 49 additions and 0 deletions
12
config.json.sample
Normal file
12
config.json.sample
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"webhook": "",
|
||||
"proxyEnabled": true,
|
||||
"proxy": {
|
||||
"user": "",
|
||||
"pass": "",
|
||||
"host": "",
|
||||
"port": 0000
|
||||
},
|
||||
"wait": 1,
|
||||
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0"
|
||||
}
|
37
scrape.py
37
scrape.py
|
@ -0,0 +1,37 @@
|
|||
import json
|
||||
import requests
|
||||
import random, string, time, datetime
|
||||
from bs4 import BeautifulSoup
|
||||
with open("config.json") as configFile:
|
||||
config = json.load(configFile)
|
||||
|
||||
notfound = "//st.prntscr.com/2023/07/24/0635/img/0_173a7b_211be8ff.png" # yes I am hard-coding this
|
||||
|
||||
headers = {
|
||||
"User-Agent": config["userAgent"]
|
||||
}
|
||||
|
||||
proxies = {
|
||||
"http": f"http://{config['proxy']['user']}:{config['proxy']['pass']}@{config['proxy']['host']}:{config['proxy']['port']}",
|
||||
}
|
||||
|
||||
running = True
|
||||
|
||||
while True:
|
||||
attempt = "".join(random.choices(string.ascii_lowercase + string.digits, k=5))
|
||||
if config['proxyEnabled']:
|
||||
r = requests.get(f"https://prnt.sc/{attempt}", proxies=proxies, headers=headers)
|
||||
else:
|
||||
r = requests.get(f"https://prnt.sc/{attempt}", headers=headers)
|
||||
soup = BeautifulSoup(r.text, 'html.parser')
|
||||
image = soup.find('img', class_='no-click screenshot-image')
|
||||
if image is not None:
|
||||
if image['src'] != notfound:
|
||||
print(f"[{attempt}] Success!")
|
||||
data = {
|
||||
"content" : f"https://prnt.sc/{attempt}"
|
||||
}
|
||||
requests.post(config['webhook'], json=data)
|
||||
with open("log.txt", "a") as log:
|
||||
log.write(f"[{datetime.datetime.now()}] https://prnt.sc/{attempt} \n")
|
||||
time.sleep(config['wait'])
|
Loading…
Add table
Add a link
Reference in a new issue