This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
import time | |
import warnings | |
from pathlib import Path | |
from random import SystemRandom | |
import requests # pip install requests | |
import requests_random_user_agent # noqa: F401 # pip install requests-random-user-agent | |
from urllib3.exceptions import InsecureRequestWarning | |
warnings.filterwarnings("ignore", category=InsecureRequestWarning) | |
BASE_DIR = Path(__file__).resolve(strict=True).parent | |
def justpasteit_sniffer() -> None: | |
length = 5 | |
links = "".join( | |
[ | |
SystemRandom().choice(string.ascii_letters + string.digits) | |
for _ in range(length) | |
] | |
) | |
justpaste_session = requests.Session() | |
url = f"https://justpaste.it/{links}" | |
response = justpaste_session.get(url, verify=False) | |
if response.ok: | |
with open(f"{BASE_DIR}/urls.txt", "a", encoding="utf-8") as valid_links: | |
valid_links.write(f"https://justpaste.it/{links}\n") | |
valid_links.close() | |
else: | |
print("Maybe server is a throttling you, wait 5 minutes and try again.") | |
time.sleep(300) | |
justpasteit_sniffer() | |
justpaste_session.close() | |
for _ in range(100): | |
justpasteit_sniffer() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment