1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Reddit Auto-Subscribe-Subreddit Bot

Discussion in 'Social Networking Sites' started by Buzzika, Jul 9, 2017.

  1. Buzzika

    Buzzika Jr. VIP Jr. VIP

    Joined:
    Jul 8, 2009
    Messages:
    1,161
    Likes Received:
    1,428
    Occupation:
    Hustler
    Location:
    Gurgaon
    Home Page:
    So you have a bunch of reddit accounts that you want to subscribe to a subreddit?

    I couldn't find a tool that does this, so I coded one for myself.

    Code:
    import time
    from selenium import webdriver
    driver = webdriver.Chrome('/usr/local/bin/chromedriver')
    from selenium.webdriver.common.keys import Keys
    
    with open('accs.csv') as f:
        credentials = [x.strip().split(',') for x in f.readlines()]
    
    for username,password in credentials:
        driver.get("https://www.reddit.com/")
        elem = driver.find_element_by_name("user")
        elem.send_keys(username)
        elem = driver.find_element_by_name("passwd")
        elem.send_keys(password)
        elem.send_keys("\n")
        time.sleep(5)
        driver.get("https://www.reddit.com/r/delphinetwork")
        time.sleep(10)
        elem = driver.find_element_by_link_text('subscribe')
        elem.click()
        time.sleep(5)
        driver.delete_all_cookies()
        #driver.close()
    
    
    Things to do before running:
    1. Install Python from https://www.python.org/ and Google Chrome Browser
    2. Install selenium using pip (google it, pretty straightforward)
    3. Download and extract chromedriver for your OS from https://sites.google.com/a/chromium.org/chromedriver/downloads
    4. In the third line [driver = webdriver.Chrome('/usr/local/bin/chromedriver')], you have to change /usr/local/bin/chromedriver to the location wherever you have stored the chromedriver which you downloaded in the last step [like C:\chromedriver\ or whatever depending on your OS, don't forget the quotes]


    How to supply accounts to the bot:
    Save your accounts in in csv file, first column with username, second column with password

    Proxy:
    If enough people need this (most likely won't) I can code the proxy support.

    PS. It is a command line app, I haven't gotten around to learning GUI programming yet.