Created
February 12, 2022 22:33
-
-
Save ssharker21/7d0c2bf6a75b3011818c199b046d703a to your computer and use it in GitHub Desktop.
Reddit Username Scraper
This file contains hidden or 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 asyncio | |
import aiohttp | |
# This program was created by jpark. It scrapes reddit for valid accounts if one already knows the username besides numbers at the end. | |
# Swap the characters inside the quotation marks for the variable s. | |
# Inside the quotation marks, type the part of the username that you already know (letters only). For the value of the number inside the string (i + _), | |
# Set the starting number for this scraper. | |
async def main(): | |
async with aiohttp.ClientSession() as session: | |
for i in range(1000): | |
s = "account" + str(i + 100) | |
if i % 100 == 0: | |
print("On", i) | |
async with session.get("https://old.reddit.com/u/" + s) as resp: | |
if resp.status != 404: | |
print(s) | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment