Skip to content

Instantly share code, notes, and snippets.

@KonradIT
Created October 1, 2020 17:06
Show Gist options
  • Save KonradIT/836393931f1ec0532d59ff696960f21d to your computer and use it in GitHub Desktop.
Save KonradIT/836393931f1ec0532d59ff696960f21d to your computer and use it in GitHub Desktop.
dji you think u're slick eh
import json
import requests
import time
headers = {}
s = requests.Session()
def has_posted_in(user, sub, contains):
posted=False
a = s.get("https://www.reddit.com/user/%s.json" % user)
for i in a.json().get("data").get("children"):
d = i.get("data")
if contains:
posted=sub in str(d.get("subreddit_name_prefixed")).lower()
else:
posted="r/" + sub == str(d.get("subreddit_name_prefixed")).lower()
if posted:
break
return posted
def catch_user(username):
user = s.get("https://www.reddit.com/user/%s.json" % username)
return len(user.json().get("data").get("children")) < 20 and \
(has_posted_in(username, "dji", contains=True) or \
has_posted_in(username,"osmo", contains=True)) and (has_posted_in(username, "aww", contains=False) or \
has_posted_in(username, "eyebleah", contains=False) or \
has_posted_in(username, "rarepuppers", contains=False))
aftertext = ""
while True:
s.headers.update(headers)
l = s.get("https://www.reddit.com/r/gopro.json?sort=new&after=%s" % aftertext)
aftertext=l.json().get("data").get("after")
for i in l.json().get("data").get("children"):
time.sleep(0.5)
p = i.get("data")
try:
r = catch_user(p.get("author"))
if r:
print("IMPOSTOR", p.get("author"))
except: pass
time.sleep(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment