Created
August 8, 2018 03:20
-
-
Save kayaked/05fa9b76ad6d44c9d26801477c1920e0 to your computer and use it in GitHub Desktop.
yet another kitsunegd variant with no error handling
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 requests | |
from bs4 import BeautifulSoup | |
import random | |
def reddit(): | |
sel = input("u for user, b for batch ") | |
if sel.lower()=="u": | |
user = input("input a username: ") | |
if user.startswith("/u/"): | |
user=user[3:] | |
if user.startswith("u/"): | |
user=user[2:] | |
array = [x for x in user.split(", ")] | |
elif sel.lower()=="b": | |
bb = input("link for batch data: ") | |
data = requests.get(bb).text | |
data = data.splitlines() | |
array = [line for line in data] | |
else: | |
print("invalid option") | |
import os | |
os.system('pause') | |
exit() | |
available = [] | |
unavailable = [] | |
for usid in array: | |
req = requests.get("https://www.reddit.com/u/{}".format(usid), headers={'User-agent':'kitsunereddit'}) | |
if req.status_code == 404: | |
soup = BeautifulSoup(req.text, 'html.parser') | |
deleted = soup.find(text='This user has deleted their account.') | |
if deleted != None: | |
unavailable.append("{} (deleted)".format(usid)) | |
continue | |
available.append(usid) | |
elif req.status_code == 200: | |
unavailable.append(usid) | |
else: | |
pass | |
print("Available: {}".format(", ".join(available))) | |
print("Unavailable: {}".format(", ".join(unavailable))) | |
import os | |
os.system('pause') | |
reddit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment