├── README.md └── autoclicker.py /README.md: -------------------------------------------------------------------------------- 1 | AutoClicker 2 | =========== 3 | 4 | AutoClicker is a bot for URL Shortening PTC webstites like *shorte.st*, *linkbucks*, *admy.link*, etc. that automatically skips Ads 5 | 6 | Auto clickers can be as simple as a program that simulates mouse clicking. This type of auto-clicker is fairly generic and will often work alongside any other computer program running at the time and acting as though a physical mouse button is pressed. 7 | 8 | More complex auto clickers can similarly be as general, but often are custom-made for use with one particular program and involve memory reading. Such auto clickers may allow the user to automate most or all mouse functions, as well as simulate a full set of keyboard inputs. Custom-made auto clickers may have a narrower scope than a generic auto clicker 9 | 10 | ---------- 11 | 12 | 13 | Requirements: 14 | ------------- 15 | 16 | - Python 2.7 17 | - Selenium 18 | - sudo pip install selenium 19 | - X virtual framebuffer (xvfb) 20 | - sudo apt-get install xvfb 21 | - Google Spreadsheets Python API (gspread) 22 | - sudo pip install gspread 23 | - oauth2client 24 | - sudo pip install oauth2client 25 | - [Close Proxy Authentication](https://addons.mozilla.org/en-US/firefox/addon/close-proxy-authentication/) Firefox extension 26 | 27 | 28 | 29 | > **Note:** 30 | 31 | > - To use [gpread](https://github.com/burnash/gspread) you have to [obtain OAuth2 credentials from Google Developers Console](http://gspread.readthedocs.org/en/latest/oauth2.html) 32 | > - **gpread** is used to keep track of the proxies used for a specific URL 33 | > - **xvfb** is optional if you want to run in a VPS (Headless browser) 34 | > - [Close Proxy Authentication](https://addons.mozilla.org/en-US/firefox/addon/close-proxy-authentication/) Firefox extension is used for proxies that needs authentication 35 | 36 | ---------- 37 | 38 | How to use: 39 | ------------------- 40 | 41 | 1. [Create new Firefox Profile](https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles) and install [Close Proxy Authentication](https://addons.mozilla.org/en-US/firefox/addon/close-proxy-authentication/) Firefox extension in it. 42 | 2. Copy **geckodriver** file to */usr/local/bin* 43 | 3. Run the script 44 | - Without **xvfb**: 45 | `python autoclicker.py --website ADMYLINK --profile MUD --random` 46 | 47 | - Using **xvfb**: 48 | `xvfb-run -a python autoclicker.py --website ADMYLINK --profile MUD --random` 49 | 50 | > **Note:** `--link 2` can be used instead of `--random` if you want to use a specific link 51 | -------------------------------------------------------------------------------- /autoclicker.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.common.proxy import * 3 | from oauth2client.service_account import ServiceAccountCredentials 4 | from datetime import datetime 5 | import time 6 | import random 7 | import os 8 | import re 9 | import argparse 10 | import gspread 11 | 12 | GOOGLE_CREDENTIAL = "Auto Clicker-2717f5630d01.json" 13 | HOME = os.environ['HOME'] 14 | 15 | FIREFOX_PROFILE = { 16 | "PS": "x73fnv5a.ps", 17 | "MUD": "79vlchet.mud" 18 | } 19 | 20 | WEBSITE_XPATH = { 21 | "SHORTE_ST": ".//*[@id='skip_button']", 22 | "LINKSHRINK": ".//*[@id='skip']/div/a", 23 | "P_PW": './/*[contains(text(), "Skip Ad")]', 24 | "LINKBUCKS": ".//*[@id='skiplink']", 25 | "ADMYLINK": ".//*[@id='btnContinue']", 26 | "ITY_IM": "html/body/header/div/div[3]/a/img", 27 | "YSEARCH": ".//*[@id='NextVideo']" 28 | } 29 | 30 | 31 | WEBSITE_LINKS = { 32 | "SHORTE_ST": ["http://viid.me/qqRiyw", 33 | "http://viid.me/qw9fyo" 34 | ], 35 | 36 | "ADMYLINK": ["http://admy.link/d6d24e", 37 | "http://admy.link/87c452", 38 | "http://admy.link/8524d9", 39 | "http://admy.link/170efb", 40 | "http://admy.link/ee3299", 41 | "http://admy.link/1705a2", 42 | "http://admy.link/1b158a", 43 | "http://admy.link/dd287d", 44 | "http://admy.link/2cb85a", 45 | "http://admy.link/bfbaf8", 46 | "http://admy.link/1dad19", # 10 47 | "http://admy.link/898768", 48 | "http://admy.link/962e7e", 49 | "http://admy.link/37be1f", 50 | "http://admy.link/f31c5a" 51 | ], 52 | 53 | "YSEARCH": ["http://ysear.ch/a39ddv", 54 | "http://ysear.ch/i656hq", 55 | "http://ysear.ch/dvmmch", 56 | "http://ysear.ch/ogapoj", 57 | "http://ysear.ch/s8oon5", 58 | "http://ysear.ch/shugxe", 59 | "http://ysear.ch/7kwiis", 60 | "http://ysear.ch/tzzoba", # 7 61 | "http://ysear.ch/8d1pvy", 62 | "http://ysear.ch/kwkdon", 63 | "http://ysear.ch/ngt1gm" 64 | ] 65 | } 66 | 67 | WEBSITE_TEXT = { 68 | "ADHYPE": "Skip" 69 | } 70 | 71 | PROXY_PROFILE = { 72 | "PS": "proxy_list_ps.txt", 73 | "MUD": "proxy_list_mud.txt" 74 | } 75 | 76 | 77 | class Auto_Clicker: 78 | def __init__(self): 79 | self.args_setup() 80 | 81 | def args_setup(self): 82 | parser = argparse.ArgumentParser() 83 | parser.add_argument('--website', type=str, help='Specify which Website', required=True) 84 | parser.add_argument('--profile', type=str, help='Specify which Profile', required=True) 85 | 86 | group = parser.add_mutually_exclusive_group(required=True) 87 | group.add_argument('--random', help='Specify if random', action='store_true') 88 | group.add_argument('--link', type=int, help='Specify link index to hit') 89 | 90 | self.args = parser.parse_args() 91 | 92 | def change_proxy(self, proxy_host, proxy_port): 93 | profile = webdriver.FirefoxProfile(HOME + "/.mozilla/firefox/" + FIREFOX_PROFILE[self.args.profile]) 94 | profile.set_preference("network.proxy.type", 1) 95 | # HTTP 96 | profile.set_preference("network.proxy.http", proxy_host) 97 | profile.set_preference("network.proxy.http_port", int(proxy_port)) 98 | # SOCKS 99 | profile.set_preference("network.proxy.socks", proxy_host) 100 | profile.set_preference("network.proxy.socks_port", int(proxy_port)) 101 | profile.set_preference("network.proxy.socks_version", 5) 102 | # SSL 103 | profile.set_preference("network.proxy.ssl", proxy_host) 104 | profile.set_preference("network.proxy.ssl_port", int(proxy_port)) 105 | # FTP 106 | profile.set_preference("network.proxy.ftp", proxy_host) 107 | profile.set_preference("network.proxy.ftp_port", int(proxy_port)) 108 | profile.update_preferences() 109 | return webdriver.Firefox(firefox_profile=profile) 110 | 111 | def click_element_by_xpath(self, element_xpath, chosen_url): 112 | while True: 113 | time.sleep(5) 114 | try: 115 | is_element = self.driver.find_element_by_xpath(element_xpath) 116 | if is_element.is_displayed(): 117 | is_element.click() 118 | except: 119 | if self.driver.current_url != chosen_url: 120 | break 121 | 122 | def click_element_by_link_text(self, element_text): 123 | while True: 124 | time.sleep(5) 125 | try: 126 | is_element = self.driver.find_element_by_link_text(element_text) 127 | if is_element.is_displayed(): 128 | is_element.click() 129 | except: 130 | if self.driver.current_url != chosen_url: 131 | break 132 | 133 | def get_google_sheet(self, sheet_name): 134 | scope = ['https://spreadsheets.google.com/feeds', # Used to Open Spreadsheets 135 | 'https://www.googleapis.com/auth/drive' # Used to Create Spreadsheets 136 | ] 137 | credentials = ServiceAccountCredentials.from_json_keyfile_name(GOOGLE_CREDENTIAL, scope) 138 | google_cred = gspread.authorize(credentials) 139 | try: 140 | spreadsheet = google_cred.open(sheet_name).sheet1 141 | except: 142 | spreadsheet = google_cred.create(sheet_name) 143 | spreadsheet.share('roshinrulz28@gmail.com', perm_type='user', role='writer') 144 | spreadsheet = google_cred.open(sheet_name).sheet1 145 | return spreadsheet 146 | 147 | def get_used_proxy_list_and_count(self, chosen_url): 148 | index_of_link = WEBSITE_LINKS[self.args.website].index(chosen_url) 149 | used_proxy_list = self.worksheet.col_values(index_of_link + 1) 150 | # filter is used because the list obtained will have empty strings 151 | # Eg: ['IP:PORT', 'IP:PORT', '', '', ''] 152 | # This count is used to continue appending the proxy list to the column 153 | # and prevent from overwriting. 154 | count = len(filter(None, used_proxy_list)) + 1 155 | return (index_of_link, used_proxy_list, count) 156 | 157 | def truncate_sheet(self): 158 | date_sheet = self.get_google_sheet("DATE") 159 | old_date = date_sheet.cell(1, 1).value 160 | current_date = datetime.now().strftime("%d-%m-%Y") 161 | if old_date != current_date: 162 | # Truncate sheet if next day 163 | date_sheet.update_cell(1, 1, current_date) 164 | cell_list = self.worksheet.findall(re.compile(r':')) 165 | for cell in cell_list: 166 | cell.value = '' 167 | self.worksheet.update_cells(cell_list) 168 | 169 | def start(self): 170 | with open(PROXY_PROFILE[self.args.profile], 'r') as f: 171 | proxy_list = f.read().splitlines() 172 | 173 | random.shuffle(proxy_list) 174 | 175 | self.worksheet = self.get_google_sheet('USED_PROXY_LIST_FOR_' + self.args.website) 176 | self.truncate_sheet() 177 | 178 | if not self.args.random: 179 | chosen_url = WEBSITE_LINKS[self.args.website][self.args.link] 180 | (index_of_link, used_proxy_list, count) = self.get_used_proxy_list_and_count(chosen_url) 181 | 182 | for proxy in proxy_list: 183 | if proxy in used_proxy_list: 184 | continue 185 | 186 | if self.args.random: 187 | chosen_url = random.choice(WEBSITE_LINKS[self.args.website]) 188 | (index_of_link, used_proxy_list, count) = self.get_used_proxy_list_and_count(chosen_url) 189 | 190 | line = proxy.split(":") 191 | proxy_host = line[0] 192 | proxy_port = line[1] 193 | self.driver = self.change_proxy(proxy_host, proxy_port) 194 | 195 | try: 196 | self.driver.set_page_load_timeout(180) 197 | self.driver.get(chosen_url) 198 | self.click_element_by_xpath(WEBSITE_XPATH[self.args.website], chosen_url) 199 | # Updates the cell based on cordinates. (1, 3), (2, 3).. 200 | self.worksheet.update_cell(count, index_of_link + 1, proxy) 201 | print "Clicked: ", count 202 | time.sleep(15) 203 | except: 204 | print "Proxy took too long to load. Skipping it." 205 | try: 206 | self.worksheet.update_cell(count, index_of_link + 1, proxy) 207 | except: 208 | # Time out 209 | self.worksheet = self.get_google_sheet('USED_PROXY_LIST_FOR_' + self.args.website) 210 | self.worksheet.update_cell(count, index_of_link + 1, proxy) 211 | count += 1 212 | self.driver.quit() 213 | 214 | 215 | def main(): 216 | clicker = Auto_Clicker() 217 | clicker.start() 218 | 219 | 220 | if __name__ == "__main__": 221 | main() 222 | sys.exit(0) 223 | --------------------------------------------------------------------------------