├── Automated Amazon Price Tracker └── main.py ├── Cookie Clicker └── main.py ├── Github Bot 3.0 └── main.py ├── Github Follow-Unfollow Bot └── main.py ├── Internet Speed Twitter Bot └── main.py ├── London App Brewery Lab Report Signup Bot └── main.py ├── Stock Trading News Alert System └── main.py ├── Tinder Like-Reject Bot └── main.py └── github_bot_personal ├── following.json └── main.py /Automated Amazon Price Tracker/main.py: -------------------------------------------------------------------------------- 1 | # Automated Amazon Price Tracker 2 | 3 | 4 | import time,lxml,json 5 | from selenium import webdriver 6 | from bs4 import BeautifulSoup 7 | from tkinter import * 8 | from tkinter import messagebox 9 | 10 | class AmazonPriceTracker: 11 | def __init__(self): 12 | self.headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"} 13 | self.start_json() 14 | self.start_driver() 15 | self.graphics() 16 | 17 | #The following method will initiate the json files 18 | def start_json(self): 19 | try: 20 | with open("data.json","r") as f: 21 | self.link_data = json.load(f) 22 | except FileNotFoundError: 23 | with open("data.json","w") as f: 24 | self.link_data = {} 25 | json.dump({},f) 26 | 27 | # This method will initiate the Selenium webdriver 28 | def start_driver(self): 29 | chrome_options = webdriver.ChromeOptions() 30 | chrome_options.add_experimental_option("detach", True) 31 | 32 | self.google_driver = webdriver.Chrome(options=chrome_options) 33 | self.google_driver.get(url="https://www.amazon.com") 34 | 35 | 36 | # The following method will start the graphics 37 | def graphics(self): 38 | self.root = Tk() 39 | self.root.minsize(width=500,height=300) 40 | self.root.maxsize(width=500,height=300) 41 | self.root.title("Automated Amazon Price Tracker") 42 | 43 | self.link_label = Label(self.root,text="Amazon Link:") 44 | self.link_label.place(x=75,y=100) 45 | self.link_label.focus() 46 | 47 | self.link_entry = Entry(self.root,width=27) 48 | self.link_entry.place(x=200,y=100) 49 | 50 | self.price_label = Label(self.root,text="Expected Price:") 51 | self.price_label.place(x=75,y=150) 52 | 53 | self.price_entry = Entry(self.root,width=27) 54 | self.price_entry.place(x=200,y=150) 55 | 56 | 57 | self.enter_button = Button(self.root,text="Enter",command=self.find_price) 58 | self.enter_button.place(x=200,y=200) 59 | 60 | self.root.mainloop() 61 | 62 | # This method will find the price of the amazon product 63 | def find_price(self): 64 | product = self.link_entry.get() 65 | expected_price_entry = self.price_entry.get() 66 | expected_price = float(expected_price_entry) 67 | 68 | 69 | if len(product) == 0 or len(expected_price_entry) == 0: 70 | messagebox.showerror(message="Something is missing") 71 | else: 72 | if product in self.link_data: 73 | messagebox.showinfo(message=f"The product was previously searched for.\nThe price was ${self.link_data[product]}") 74 | time.sleep(5) 75 | price = self.return_product_price(amazon_link=product) 76 | change = ((expected_price - price) / (price)) * 100 77 | 78 | if price < expected_price: 79 | messagebox.showinfo( 80 | message=f"The price is ${price}.\nIt is below the expected the price of ${expected_price}.\nPrice change:{change:.2f}%") 81 | elif price > expected_price: 82 | messagebox.showinfo( 83 | message=f"The price is ${price}.\nIt is above the expected the price of ${expected_price}.\nPrice change:{change:.2f}%") 84 | else: 85 | messagebox.showinfo(message="The price has not changed") 86 | 87 | 88 | new_data = {product: price} 89 | self.link_data.update(new_data) 90 | with open("data.json", "w") as f: 91 | json.dump(self.link_data, f) 92 | 93 | self.link_entry.delete(0,END) 94 | self.price_entry.delete(0,END) 95 | self.google_driver.get(url="https://www.amazon.com") 96 | 97 | 98 | #This method will go to amazon and retrieve the product's price as a float 99 | def return_product_price(self,amazon_link:str)->float: 100 | self.google_driver.get(url=amazon_link) 101 | 102 | soup = BeautifulSoup(self.google_driver.page_source,"lxml") 103 | 104 | price = soup.find("span",class_="a-offscreen") 105 | 106 | price = price.text.strip("$") 107 | 108 | price = float(price) 109 | 110 | return price 111 | 112 | 113 | 114 | if __name__ == "__main__": 115 | apt = AmazonPriceTracker() 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /Cookie Clicker/main.py: -------------------------------------------------------------------------------- 1 | import time 2 | import selenium.common.exceptions 3 | from selenium import webdriver 4 | from selenium.webdriver.common.by import By 5 | from selenium.webdriver.common.keys import Keys 6 | from selenium.common.exceptions import StaleElementReferenceException 7 | from selenium.common.exceptions import ElementClickInterceptedException 8 | from selenium.common.exceptions import ElementNotInteractableException 9 | 10 | 11 | class CookieClicker: 12 | def __init__(self): 13 | chrome_options = webdriver.ChromeOptions() 14 | chrome_options.add_experimental_option("detach", True) 15 | 16 | self.google_driver = webdriver.Chrome(options=chrome_options) 17 | self.google_driver.get(url="https://orteil.dashnet.org/cookieclicker/") 18 | 19 | cookie_button = self.google_driver.find_element(By.ID, "bigCookie") 20 | # Time to wait for the website to load 21 | time.sleep(7) 22 | 23 | # Clicks on the English Language as the language option 24 | english = self.google_driver.find_element(By.ID, "langSelect-EN") 25 | english.click() 26 | 27 | # Enters the site 28 | time.sleep(4) 29 | store_text = self.google_driver.find_element(By.ID, 'storeTitle') 30 | store_text.click() 31 | body = self.google_driver.find_element(By.CSS_SELECTOR, "body") 32 | for i in range(14): 33 | body.send_keys(Keys.ARROW_DOWN) 34 | self.length = 2 35 | 36 | def convert_cookies(self, text): 37 | if "million" in text: 38 | return float(text.split("\n")[0]) * pow(10, 6) 39 | elif "billion" in text: 40 | return float(text.split("\n")[0]) * pow(10, 9) 41 | elif "trillion" in text: 42 | return float(text.split("\n")[0]) * pow(10, 12) 43 | elif "quadrillion" in text: 44 | return float(text.split("\n")[0]) * pow(10, 15) 45 | elif "quintillion" in text: 46 | return float(text.split("\n")[0]) * pow(10, 18) 47 | elif "sextillion" in text: 48 | return float(text.split("\n")[0]) * pow(10, 21) 49 | elif "septillion" in text: 50 | return float(text.split("\n")[0]) * pow(10, 24) 51 | elif "octillion" in text: 52 | return float(text.split("\n")[0]) * pow(10, 27) 53 | elif "nonillion" in text: 54 | return float(text.split("\n")[0]) * pow(10, 30) 55 | elif "decillion" in text: 56 | return float(text.split("\n")[0]) * pow(10, 33) 57 | elif "undecillion" in text: 58 | return float(text.split("\n")[0]) * pow(10, 36) 59 | elif "duodecillion" in text: 60 | return float(text.split("\n")[0]) * pow(10, 39) 61 | elif "tredecillion" in text: 62 | return float(text.split("\n")[0]) * pow(10, 42) 63 | elif "quattuordecillion" in text: 64 | return float(text.split("\n")[0]) * pow(10, 45) 65 | elif "quindecillion" in text: 66 | return float(text.split("\n")[0]) * pow(10, 48) 67 | elif "sexdecillion" in text: 68 | return float(text.split("\n")[0]) * pow(10, 51) 69 | elif "septendecillion" in text: 70 | return float(text.split("\n")[0]) * pow(10, 54) 71 | elif "octodecillion" in text: 72 | return float(text.split("\n")[0]) * pow(10, 57) 73 | elif "novemdecillion" in text: 74 | return float(text.split("\n")[0]) * pow(10, 60) 75 | elif "vigintillion" in text: 76 | return float(text.split("\n")[0]) * pow(10, 63) 77 | elif "unvigintillion" in text: 78 | return float(text.split("\n")[0]) * pow(10, 66) 79 | elif "duovigintillion" in text: 80 | return float(text.split("\n")[0]) * pow(10, 69) 81 | elif "trevigintillion" in text: 82 | return float(text.split("\n")[0]) * pow(10, 72) 83 | elif "quattuorvigintillion" in text: 84 | return float(text.split("\n")[0]) * pow(10, 75) 85 | elif "quinvigintillion" in text: 86 | return float(text.split("\n")[0]) * pow(10, 78) 87 | elif "sexvigintillion" in text: 88 | return float(text.split("\n")[0]) * pow(10, 81) 89 | elif "septenvigintillion" in text: 90 | return float(text.split("\n")[0]) * pow(10, 84) 91 | elif "octovigintillion" in text: 92 | return float(text.split("\n")[0]) * pow(10, 87) 93 | elif "novemvigintillion" in text: 94 | return float(text.split("\n")[0]) * pow(10, 90) 95 | elif "trigintillion" in text: 96 | return float(text.split("\n")[0]) * pow(10, 93) 97 | elif "untrigintillion" in text: 98 | return float(text.split("\n")[0]) * pow(10, 96) 99 | elif "duotrigintillion" in text: 100 | return float(text.split("\n")[0]) * pow(10, 99) 101 | elif "tretrigintillion" in text: 102 | return float(text.split("\n")[0]) * pow(10, 102) 103 | elif "quattuortrigintillion" in text: 104 | return float(text.split("\n")[0]) * pow(10, 105) 105 | elif "quintrigintillion" in text: 106 | return float(text.split("\n")[0]) * pow(10, 108) 107 | elif "sextrigintillion" in text: 108 | return float(text.split("\n")[0]) * pow(10, 111) 109 | elif "septentrigintillion" in text: 110 | return float(text.split("\n")[0]) * pow(10, 114) 111 | elif "octotrigintillion" in text: 112 | return float(text.split("\n")[0]) * pow(10, 117) 113 | elif "novemtrigintillion" in text: 114 | return float(text.split("\n")[0]) * pow(10, 120) 115 | elif "quadragintillion" in text: 116 | return float(text.split("\n")[0]) * pow(10, 123) 117 | elif "unquadragintillion" in text: 118 | return float(text.split("\n")[0]) * pow(10, 126) 119 | elif "duoquadragintillion" in text: 120 | return float(text.split("\n")[0]) * pow(10, 129) 121 | elif "trequadragintillion" in text: 122 | return float(text.split("\n")[0]) * pow(10, 132) 123 | elif "quattuorquadragintillion" in text: 124 | return float(text.split("\n")[0]) * pow(10, 135) 125 | elif "quinquadragintillion" in text: 126 | return float(text.split("\n")[0]) * pow(10, 138) 127 | elif "sexquadragintillion" in text: 128 | return float(text.split("\n")[0]) * pow(10, 141) 129 | elif "septenquadragintillion" in text: 130 | return float(text.split("\n")[0]) * pow(10, 144) 131 | elif "octoquadragintillion" in text: 132 | return float(text.split("\n")[0]) * pow(10, 147) 133 | elif "novemquadragintillion" in text: 134 | return float(text.split("\n")[0]) * pow(10, 150) 135 | elif "quinquagintillion" in text: 136 | return float(text.split("\n")[0]) * pow(10, 153) 137 | elif "unquinquagintillion" in text: 138 | return float(text.split("\n")[0]) * pow(10, 156) 139 | elif "duoquinquagintillion" in text: 140 | return float(text.split("\n")[0]) * pow(10, 159) 141 | elif "trequinquagintillion" in text: 142 | return float(text.split("\n")[0]) * pow(10, 162) 143 | elif "quattuorquinquagintillion" in text: 144 | return float(text.split("\n")[0]) * pow(10, 165) 145 | elif "quinquinquagintillion" in text: 146 | return float(text.split("\n")[0]) * pow(10, 168) 147 | elif "sexquinquagintillion" in text: 148 | return float(text.split("\n")[0]) * pow(10, 171) 149 | elif "septenquinquagintillion" in text: 150 | return float(text.split("\n")[0]) * pow(10, 174) 151 | elif "octoquinquagintillion" in text: 152 | return float(text.split("\n")[0]) * pow(10, 177) 153 | elif "novemquinquagintillion" in text: 154 | return float(text.split("\n")[0]) * pow(10, 180) 155 | elif "sexagintillion" in text: 156 | return float(text.split("\n")[0]) * pow(10, 183) 157 | elif "unsexagintillion" in text: 158 | return float(text.split("\n")[0]) * pow(10, 186) 159 | elif "duosexagintillion" in text: 160 | return float(text.split("\n")[0]) * pow(10, 189) 161 | elif "tresexagintillion" in text: 162 | return float(text.split("\n")[0]) * pow(10, 192) 163 | elif "quattuorsexagintillion" in text: 164 | return float(text.split("\n")[0]) * pow(10, 195) 165 | elif "quinsexagintillion" in text: 166 | return float(text.split("\n")[0]) * pow(10, 198) 167 | elif "sexsexagintillion" in text: 168 | return float(text.split("\n")[0]) * pow(10, 201) 169 | elif "septensexagintillion" in text: 170 | return float(text.split("\n")[0]) * pow(10, 204) 171 | elif "octosexagintillion" in text: 172 | return float(text.split("\n")[0]) * pow(10, 207) 173 | elif "novemsexagintillion" in text: 174 | return float(text.split("\n")[0]) * pow(10, 210) 175 | elif "septuagintillion" in text: 176 | return float(text.split("\n")[0]) * pow(10, 213) 177 | elif "unseptuagintillion" in text: 178 | return float(text.split("\n")[0]) * pow(10, 216) 179 | elif "duoseptuagintillion" in text: 180 | return float(text.split("\n")[0]) * pow(10, 219) 181 | elif "treseptuagintillion" in text: 182 | return float(text.split("\n")[0]) * pow(10, 222) 183 | elif "quattuorseptuagintillion" in text: 184 | return float(text.split("\n")[0]) * pow(10, 225) 185 | elif "quinseptuagintillion" in text: 186 | return float(text.split("\n")[0]) * pow(10, 228) 187 | elif "sexseptuagintillion" in text: 188 | return float(text.split("\n")[0]) * pow(10, 231) 189 | elif "septenseptuagintillion" in text: 190 | return float(text.split("\n")[0]) * pow(10, 234) 191 | elif "octoseptuagintillion" in text: 192 | return float(text.split("\n")[0]) * pow(10, 237) 193 | elif "novemseptuagintillion" in text: 194 | return float(text.split("\n")[0]) * pow(10, 240) 195 | elif "octogintillion" in text: 196 | return float(text.split("\n")[0]) * pow(10, 243) 197 | elif "unoctogintillion" in text: 198 | return float(text.split("\n")[0]) * pow(10, 246) 199 | elif "duooctogintillion" in text: 200 | return float(text.split("\n")[0]) * pow(10, 249) 201 | elif "treoctogintillion" in text: 202 | return float(text.split("\n")[0]) * pow(10, 252) 203 | elif "quattuoroctogintillion" in text: 204 | return float(text.split("\n")[0]) * pow(10, 255) 205 | elif "quinoctogintillion" in text: 206 | return float(text.split("\n")[0]) * pow(10, 258) 207 | elif "sexoctogintillion" in text: 208 | return float(text.split("\n")[0]) * pow(10, 261) 209 | elif "septenoctogintillion" in text: 210 | return float(text.split("\n")[0]) * pow(10, 264) 211 | elif "octooctogintillion" in text: 212 | return float(text.split("\n")[0]) * pow(10, 267) 213 | elif "novemoctogintillion" in text: 214 | return float(text.split("\n")[0]) * pow(10, 270) 215 | elif "nonagintillion" in text: 216 | return float(text.split("\n")[0]) * pow(10, 273) 217 | elif "unnonagintillion" in text: 218 | return float(text.split("\n")[0]) * pow(10, 276) 219 | elif "duononagintillion" in text: 220 | return float(text.split("\n")[0]) * pow(10, 279) 221 | elif "trenonagintillion" in text: 222 | return float(text.split("\n")[0]) * pow(10, 282) 223 | elif "quattuornonagintillion" in text: 224 | return float(text.split("\n")[0]) * pow(10, 285) 225 | elif "quinnonagintillion" in text: 226 | return float(text.split("\n")[0]) * pow(10, 288) 227 | elif "sexnonagintillion" in text: 228 | return float(text.split("\n")[0]) * pow(10, 291) 229 | elif "septennonagintillion" in text: 230 | return float(text.split("\n")[0]) * pow(10, 294) 231 | elif "octononagintillion" in text: 232 | return float(text.split("\n")[0]) * pow(10, 297) 233 | elif "novemnonagintillion" in text: 234 | return float(text.split("\n")[0]) * pow(10, 300) 235 | elif "centillion" in text: 236 | return float(text.split("\n")[0]) * pow(10, 303) 237 | else: 238 | return int(text.split("\n")[0].replace(",", "").replace(" cookies",'')) 239 | 240 | def convert_large_numbers(self,text): 241 | if "million" in text: 242 | return float(text.split(" ")[0]) * pow(10, 6) 243 | elif "billion" in text: 244 | return float(text.split(" ")[0]) * pow(10, 9) 245 | elif "trillion" in text: 246 | return float(text.split(" ")[0]) * pow(10, 12) 247 | elif "quadrillion" in text: 248 | return float(text.split(" ")[0]) * pow(10, 15) 249 | elif "quintillion" in text: 250 | return float(text.split(" ")[0]) * pow(10, 18) 251 | elif "sextillion" in text: 252 | return float(text.split(" ")[0]) * pow(10, 21) 253 | elif "septillion" in text: 254 | return float(text.split(" ")[0]) * pow(10, 24) 255 | elif "octillion" in text: 256 | return float(text.split(" ")[0]) * pow(10, 27) 257 | elif "nonillion" in text: 258 | return float(text.split(" ")[0]) * pow(10, 30) 259 | elif "decillion" in text: 260 | return float(text.split(" ")[0]) * pow(10, 33) 261 | elif "undecillion" in text: 262 | return float(text.split(" ")[0]) * pow(10, 36) 263 | elif "duodecillion" in text: 264 | return float(text.split(" ")[0]) * pow(10, 39) 265 | elif "tredecillion" in text: 266 | return float(text.split(" ")[0]) * pow(10, 42) 267 | elif "quattuordecillion" in text: 268 | return float(text.split(" ")[0]) * pow(10, 45) 269 | elif "quindecillion" in text: 270 | return float(text.split(" ")[0]) * pow(10, 48) 271 | elif "sexdecillion" in text: 272 | return float(text.split(" ")[0]) * pow(10, 51) 273 | elif "septendecillion" in text: 274 | return float(text.split(" ")[0]) * pow(10, 54) 275 | elif "octodecillion" in text: 276 | return float(text.split(" ")[0]) * pow(10, 57) 277 | elif "novemdecillion" in text: 278 | return float(text.split(" ")[0]) * pow(10, 60) 279 | elif "vigintillion" in text: 280 | return float(text.split(" ")[0]) * pow(10, 63) 281 | elif "unvigintillion" in text: 282 | return float(text.split(" ")[0]) * pow(10, 66) 283 | elif "duovigintillion" in text: 284 | return float(text.split(" ")[0]) * pow(10, 69) 285 | elif "trevigintillion" in text: 286 | return float(text.split(" ")[0]) * pow(10, 72) 287 | elif "quattuorvigintillion" in text: 288 | return float(text.split(" ")[0]) * pow(10, 75) 289 | elif "quinvigintillion" in text: 290 | return float(text.split(" ")[0]) * pow(10, 78) 291 | elif "sexvigintillion" in text: 292 | return float(text.split(" ")[0]) * pow(10, 81) 293 | elif "septenvigintillion" in text: 294 | return float(text.split(" ")[0]) * pow(10, 84) 295 | elif "octovigintillion" in text: 296 | return float(text.split(" ")[0]) * pow(10, 87) 297 | elif "novemvigintillion" in text: 298 | return float(text.split(" ")[0]) * pow(10, 90) 299 | elif "trigintillion" in text: 300 | return float(text.split(" ")[0]) * pow(10, 93) 301 | elif "untrigintillion" in text: 302 | return float(text.split(" ")[0]) * pow(10, 96) 303 | elif "duotrigintillion" in text: 304 | return float(text.split(" ")[0]) * pow(10, 99) 305 | elif "tretrigintillion" in text: 306 | return float(text.split(" ")[0]) * pow(10, 102) 307 | elif "quattuortrigintillion" in text: 308 | return float(text.split(" ")[0]) * pow(10, 105) 309 | elif "quintrigintillion" in text: 310 | return float(text.split(" ")[0]) * pow(10, 108) 311 | elif "sextrigintillion" in text: 312 | return float(text.split(" ")[0]) * pow(10, 111) 313 | elif "septentrigintillion" in text: 314 | return float(text.split(" ")[0]) * pow(10, 114) 315 | elif "octotrigintillion" in text: 316 | return float(text.split(" ")[0]) * pow(10, 117) 317 | elif "novemtrigintillion" in text: 318 | return float(text.split(" ")[0]) * pow(10, 120) 319 | elif "quadragintillion" in text: 320 | return float(text.split(" ")[0]) * pow(10, 123) 321 | elif "unquadragintillion" in text: 322 | return float(text.split(" ")[0]) * pow(10, 126) 323 | elif "duoquadragintillion" in text: 324 | return float(text.split(" ")[0]) * pow(10, 129) 325 | elif "trequadragintillion" in text: 326 | return float(text.split(" ")[0]) * pow(10, 132) 327 | elif "quattuorquadragintillion" in text: 328 | return float(text.split(" ")[0]) * pow(10, 135) 329 | elif "quinquadragintillion" in text: 330 | return float(text.split(" ")[0]) * pow(10, 138) 331 | elif "sexquadragintillion" in text: 332 | return float(text.split(" ")[0]) * pow(10, 141) 333 | elif "septenquadragintillion" in text: 334 | return float(text.split(" ")[0]) * pow(10, 144) 335 | elif "octoquadragintillion" in text: 336 | return float(text.split(" ")[0]) * pow(10, 147) 337 | elif "novemquadragintillion" in text: 338 | return float(text.split(" ")[0]) * pow(10, 150) 339 | elif "quinquagintillion" in text: 340 | return float(text.split(" ")[0]) * pow(10, 153) 341 | elif "unquinquagintillion" in text: 342 | return float(text.split(" ")[0]) * pow(10, 156) 343 | elif "duoquinquagintillion" in text: 344 | return float(text.split(" ")[0]) * pow(10, 159) 345 | elif "trequinquagintillion" in text: 346 | return float(text.split(" ")[0]) * pow(10, 162) 347 | elif "quattuorquinquagintillion" in text: 348 | return float(text.split(" ")[0]) * pow(10, 165) 349 | elif "quinquinquagintillion" in text: 350 | return float(text.split(" ")[0]) * pow(10, 168) 351 | elif "sexquinquagintillion" in text: 352 | return float(text.split(" ")[0]) * pow(10, 171) 353 | elif "septenquinquagintillion" in text: 354 | return float(text.split(" ")[0]) * pow(10, 174) 355 | elif "octoquinquagintillion" in text: 356 | return float(text.split(" ")[0]) * pow(10, 177) 357 | elif "novemquinquagintillion" in text: 358 | return float(text.split(" ")[0]) * pow(10, 180) 359 | elif "sexagintillion" in text: 360 | return float(text.split(" ")[0]) * pow(10, 183) 361 | elif "unsexagintillion" in text: 362 | return float(text.split(" ")[0]) * pow(10, 186) 363 | elif "duosexagintillion" in text: 364 | return float(text.split(" ")[0]) * pow(10, 189) 365 | elif "tresexagintillion" in text: 366 | return float(text.split(" ")[0]) * pow(10, 192) 367 | elif "quattuorsexagintillion" in text: 368 | return float(text.split(" ")[0]) * pow(10, 195) 369 | elif "quinsexagintillion" in text: 370 | return float(text.split(" ")[0]) * pow(10, 198) 371 | elif "sexsexagintillion" in text: 372 | return float(text.split(" ")[0]) * pow(10, 201) 373 | elif "septensexagintillion" in text: 374 | return float(text.split(" ")[0]) * pow(10, 204) 375 | elif "octosexagintillion" in text: 376 | return float(text.split(" ")[0]) * pow(10, 207) 377 | elif "novemsexagintillion" in text: 378 | return float(text.split(" ")[0]) * pow(10, 210) 379 | elif "septuagintillion" in text: 380 | return float(text.split(" ")[0]) * pow(10, 213) 381 | elif "unseptuagintillion" in text: 382 | return float(text.split(" ")[0]) * pow(10, 216) 383 | elif "duoseptuagintillion" in text: 384 | return float(text.split(" ")[0]) * pow(10, 219) 385 | elif "treseptuagintillion" in text: 386 | return float(text.split(" ")[0]) * pow(10, 222) 387 | elif "quattuorseptuagintillion" in text: 388 | return float(text.split(" ")[0]) * pow(10, 225) 389 | elif "quinseptuagintillion" in text: 390 | return float(text.split(" ")[0]) * pow(10, 228) 391 | elif "sexseptuagintillion" in text: 392 | return float(text.split(" ")[0]) * pow(10, 231) 393 | elif "septenseptuagintillion" in text: 394 | return float(text.split(" ")[0]) * pow(10, 234) 395 | elif "octoseptuagintillion" in text: 396 | return float(text.split(" ")[0]) * pow(10, 237) 397 | elif "novemseptuagintillion" in text: 398 | return float(text.split(" ")[0]) * pow(10, 240) 399 | elif "octogintillion" in text: 400 | return float(text.split(" ")[0]) * pow(10, 243) 401 | elif "unoctogintillion" in text: 402 | return float(text.split(" ")[0]) * pow(10, 246) 403 | elif "duooctogintillion" in text: 404 | return float(text.split(" ")[0]) * pow(10, 249) 405 | elif "treoctogintillion" in text: 406 | return float(text.split(" ")[0]) * pow(10, 252) 407 | elif "quattuoroctogintillion" in text: 408 | return float(text.split(" ")[0]) * pow(10, 255) 409 | elif "quinoctogintillion" in text: 410 | return float(text.split(" ")[0]) * pow(10, 258) 411 | elif "sexoctogintillion" in text: 412 | return float(text.split(" ")[0]) * pow(10, 261) 413 | elif "septenoctogintillion" in text: 414 | return float(text.split(" ")[0]) * pow(10, 264) 415 | elif "octooctogintillion" in text: 416 | return float(text.split(" ")[0]) * pow(10, 267) 417 | elif "novemoctogintillion" in text: 418 | return float(text.split(" ")[0]) * pow(10, 270) 419 | elif "nonagintillion" in text: 420 | return float(text.split(" ")[0]) * pow(10, 273) 421 | elif "unnonagintillion" in text: 422 | return float(text.split(" ")[0]) * pow(10, 276) 423 | elif "duononagintillion" in text: 424 | return float(text.split(" ")[0]) * pow(10, 279) 425 | elif "trenonagintillion" in text: 426 | return float(text.split(" ")[0]) * pow(10, 282) 427 | elif "quattuornonagintillion" in text: 428 | return float(text.split(" ")[0]) * pow(10, 285) 429 | elif "quinnonagintillion" in text: 430 | return float(text.split(" ")[0]) * pow(10, 288) 431 | elif "sexnonagintillion" in text: 432 | return float(text.split(" ")[0]) * pow(10, 291) 433 | elif "septennonagintillion" in text: 434 | return float(text.split(" ")[0]) * pow(10, 294) 435 | elif "octononagintillion" in text: 436 | return float(text.split(" ")[0]) * pow(10, 297) 437 | elif "novemnonagintillion" in text: 438 | return float(text.split(" ")[0]) * pow(10, 300) 439 | elif "centillion" in text: 440 | return float(text.split(" ")[0]) * pow(10, 303) 441 | else: 442 | return int(text.split("\n")[0].replace(",", "").replace(" cookies",'')) 443 | 444 | # enter a time interval. 445 | # suggested 45 446 | def play(self): 447 | time_interval = 5 448 | while True: 449 | print(time_interval) 450 | try: 451 | t1 = time.time() 452 | time_passed = False 453 | while time_passed == False: 454 | cookie_button = self.google_driver.find_element(By.ID, "bigCookie") 455 | cookie_button.click() 456 | t2 = time.time() - t1 457 | if t2 > time_interval: 458 | time_passed = True 459 | number_of_cookies = self.google_driver.find_element(By.TAG_NAME, "title").text 460 | products = self.google_driver.find_elements(By.CLASS_NAME, "price") 461 | if len(products) != self.length: 462 | body = self.google_driver.find_element(By.CSS_SELECTOR, "body") 463 | amount = len(products) - self.length 464 | for i in range(amount * 3): 465 | body.send_keys(Keys.ARROW_DOWN) 466 | self.length += len(products) - self.length 467 | products = [product.text.replace(",", "") for product in products if product != " "] 468 | products = [product for product in products if product != ""] 469 | prices = [] 470 | for product in products: 471 | price = self.convert_large_numbers(product) 472 | prices.append(price) 473 | cookies = self.google_driver.find_element(By.CSS_SELECTOR, "#cookies").text 474 | cookies = self.convert_cookies(cookies) 475 | # print(cookies) 476 | # print(products) 477 | # print(prices) 478 | while cookies > min(prices): 479 | for i in range(len(prices) - 1, -1, -1): 480 | if cookies > prices[i]: 481 | cookies -= prices[i] 482 | link = self.google_driver.find_element(By.ID, f"product{i}") 483 | link.click() 484 | except (selenium.common.exceptions.StaleElementReferenceException,selenium.common.exceptions.ElementClickInterceptedException,selenium.common.exceptions.ElementNotInteractableException) as e: 485 | continue 486 | finally: 487 | time_interval += 1 488 | 489 | if __name__ == "__main__": 490 | cc = CookieClicker() 491 | cc.play() 492 | -------------------------------------------------------------------------------- /Github Bot 3.0/main.py: -------------------------------------------------------------------------------- 1 | # GitHub Bot 3.0 2 | # Getting ready for prediction model by gathering data on the users 3 | import os,requests,time,datetime,json,random 4 | 5 | class GithubBot: 6 | def __init__(self): 7 | self.token = os.environ.get('token') 8 | self.special = ['GhostOf0days','YangletLiu','Allan-Feng','aalyaz','cshao23','philiplpaterson','connorhakan8','nepthius','enisaras','Hamid-Mofidi','Jshot117','emirkaanozdemr','Chriun','blitzionic','PouyaBaniadam'] 9 | self.headers = {"Authorization": f"Bearer {self.token}","X-GitHub-Api-Version": "2022-11-28"} 10 | self.blacklist = {} 11 | self.check_blacklist() 12 | self.followers = [] 13 | self.following = [] 14 | self.find_followers() 15 | self.find_following() 16 | self.automate() 17 | 18 | # I created a blacklist and these users will not be followed again 19 | def check_blacklist(self): 20 | try: 21 | with open('blacklist.json','r') as f: 22 | self.blacklist:dict = json.load(f) 23 | except FileNotFoundError: 24 | pass 25 | 26 | # This method finds all the followers that i follow 27 | def find_followers(self): 28 | url = 'https://api.github.com/users/meliksahyorulmazlar/followers' 29 | page = 1 30 | 31 | self.followers = [] 32 | loop = True 33 | while loop: 34 | furl = f"{url}?page={page}&per_page=100" 35 | response = requests.get(furl,headers=self.headers) 36 | 37 | if response.status_code == 200: 38 | if response.json() == []: 39 | loop = False 40 | else: 41 | print(response.status_code) 42 | for item in response.json(): 43 | self.followers.append(item['login']) 44 | print(item['login'],len(self.followers),page) 45 | page += 1 46 | else: 47 | print(response.status_code) 48 | print(response.json()) 49 | print('Time to give a break') 50 | for i in range(5): 51 | print(f"{i} seconds, {5-i} seconds left to restart") 52 | time.sleep(1) 53 | print(self.followers) 54 | print(len(self.followers)) 55 | 56 | # This method finds all the people I follow 57 | def find_following(self): 58 | url = 'https://api.github.com/users/meliksahyorulmazlar/following' 59 | page = 1 60 | 61 | self.following = [] 62 | loop = True 63 | while loop: 64 | furl = f"{url}?page={page}&per_page=100" 65 | response = requests.get(furl,headers=self.headers) 66 | 67 | if response.status_code == 200: 68 | if response.json() == []: 69 | loop = False 70 | else: 71 | print(response.status_code) 72 | for item in response.json(): 73 | self.following.append(item['login']) 74 | print(item['login'],len(self.following),page) 75 | page += 1 76 | else: 77 | print(response.status_code) 78 | print(response.json()) 79 | print('Time to give a break') 80 | for i in range(5): 81 | print(f"{i} seconds, {5-i} seconds left to restart") 82 | time.sleep(1) 83 | 84 | # The following method follows one specific GitHub account 85 | def follow_one_account(self,account:str): 86 | url = f"https://api.github.com/user/following/{account}" 87 | response = requests.put(url, headers=self.headers) 88 | if response.status_code == 204: 89 | if self.check_your_following(account): 90 | day = datetime.datetime.now().day 91 | month = datetime.datetime.now().month 92 | year = datetime.datetime.now().year 93 | date_string = f"{day}-{month}-{year}" 94 | try: 95 | with open('following.json','r') as f: 96 | following = json.load(f) 97 | following[account] = date_string 98 | with open('following.json', 'w') as f: 99 | json.dump(following,f,indent=4) 100 | except FileNotFoundError: 101 | with open('following.json','w') as f: 102 | following = {} 103 | following[account] = date_string 104 | with open('following.json', 'w') as f: 105 | json.dump(following, f, indent=4) 106 | print(f"Successfully followed {account}!") 107 | else: 108 | print(f"Error: {response.status_code}") 109 | print('Time to give a break') 110 | for i in range(5): 111 | print(f"{i} seconds.{5-i} seconds to restart") 112 | time.sleep(1) 113 | self.follow_one_account(account) 114 | 115 | # The following method checks if they are following you or not 116 | def check_following(self,account:str)->bool: 117 | url = f"https://api.github.com/users/{account}/following/meliksahyorulmazlar" 118 | 119 | response = requests.get(url, headers=self.headers) 120 | 121 | if response.status_code == 204: 122 | return True 123 | elif response.status_code == 404: 124 | return False 125 | else: 126 | print(f"Error: {response.status_code}") 127 | print('Time to give a break') 128 | for i in range(5): 129 | print(f"{i} seconds.{5 - i} seconds to restart") 130 | time.sleep(1) 131 | self.check_following(account) 132 | 133 | # This method checks if you are actually following the account 134 | # I added this method because there are accounts that the API says that you followed but in reality you did not end up following them 135 | def check_your_following(self,account:str)->bool: 136 | url = f"https://api.github.com/users/meliksahyorulmazlar/following/{account}" 137 | 138 | response = requests.get(url, headers=self.headers) 139 | 140 | if response.status_code == 204: 141 | return True 142 | elif response.status_code == 404: 143 | return False 144 | else: 145 | print(f"Error: {response.status_code}") 146 | print('Time to give a break') 147 | for i in range(5): 148 | print(f"{i} seconds.{5 - i} seconds to restart") 149 | time.sleep(1) 150 | self.check_following(account) 151 | 152 | 153 | # The following method unfollows one specific GitHub account 154 | def unfollow_one_account(self,account:str): 155 | url = f"https://api.github.com/user/following/{account}" 156 | 157 | response = requests.delete(url, headers=self.headers) 158 | if response.status_code == 204: 159 | with open('following.json','r') as f: 160 | following:dict = json.load(f) 161 | date:str = following[account].split("-") 162 | following.pop(account) 163 | with open('following.json','w') as f: 164 | json.dump(following,f,indent=4) 165 | 166 | today = datetime.datetime.now() 167 | d1_day = int(date[0]) 168 | d1_month = int(date[1]) 169 | d1_year = int(date[2]) 170 | d1 = datetime.datetime(day=d1_day,month=d1_month,year=d1_year) 171 | d2 = datetime.datetime.now() 172 | days = (d2-d1).days 173 | data_dictionary = self.gather_account_data(account) 174 | 175 | if self.check_following(account): 176 | data_dictionary['result'] = True 177 | data_dictionary['days_to_follow'] = days 178 | else: 179 | data_dictionary['result'] = True 180 | data_dictionary['days_to_follow'] = -1 181 | 182 | try: 183 | with open('results.json','r') as f: 184 | dictionary = json.load(f) 185 | with open('results.json','w') as f: 186 | dictionary[account] = data_dictionary 187 | json.dump(dictionary,f,indent=4) 188 | except FileNotFoundError: 189 | with open('results.json','w') as f: 190 | json.dump({account:data_dictionary},f,indent=4) 191 | 192 | print(f"Successfully unfollowed {account}!") 193 | else: 194 | print(f"Error: {response.status_code}") 195 | print('Time to give a break') 196 | for i in range(5): 197 | print(f"{i} seconds.{5 - i} seconds to restart") 198 | time.sleep(1) 199 | self.unfollow_one_account(account) 200 | 201 | # This method unfollows accounts that have followed us back or accounts that have not followed us back for 7 days and puts them in a blacklist 202 | def unfollow_accounts(self): 203 | self.find_followers() 204 | with open('following.json','r') as f: 205 | following:dict = json.load(f) 206 | 207 | for account in following: 208 | if account not in self.special: 209 | if account in self.followers: 210 | time.sleep(1) 211 | self.unfollow_one_account(account) 212 | else: 213 | date_string = following[account].split("-") 214 | d1_day = int(date_string[0]) 215 | d1_month = int(date_string[1]) 216 | d1_year = int(date_string[2]) 217 | d1 = datetime.datetime(day=d1_day,month=d1_month,year=d1_year) 218 | d2 = datetime.datetime.now() 219 | days = (d2-d1).days 220 | if days >= 7: 221 | time.sleep(1) 222 | self.unfollow_one_account(account) 223 | d2_day = d2.day 224 | d2_month = d2.month 225 | d2_year = d2.year 226 | today_string = f"{d2_day}-{d2_month}-{d2_year}" 227 | try: 228 | with open('blacklist.json','r') as f: 229 | blacklist = json.load(f) 230 | blacklist[account] = today_string 231 | with open('blacklist.json','w') as f: 232 | json.dump(blacklist,f,indent=4) 233 | except FileNotFoundError: 234 | with open('blacklist.json','w') as f: 235 | json.dump({account:today_string},f,indent=4) 236 | 237 | # Gathers data on the user 238 | def gather_account_data(self,account:str) -> dict: 239 | url = f"https://api.github.com/users/{account}" 240 | response = requests.get(url, headers=self.headers) 241 | 242 | if response.status_code == 200: 243 | data = response.json() 244 | dictionary = {} 245 | dictionary['name'] = account 246 | dictionary['creation_date'] = data['created_at'].split("T")[0] 247 | dictionary['update_date'] = data['updated_at'].split("T")[0] 248 | dictionary['followers'] = data['followers'] 249 | dictionary['following'] = data['following'] 250 | ratio = None 251 | if data['following'] == 0: 252 | ratio = data['followers']/1 253 | else: 254 | ratio = data['followers']/data['following'] 255 | dictionary['ratio'] = ratio 256 | dictionary['repo_count'] = data['public_repos'] 257 | 258 | if data['twitter_username'] is None: 259 | dictionary['twitter'] = False 260 | else: 261 | dictionary['twitter'] = True 262 | 263 | if data['bio'] is None: 264 | dictionary['bio'] = False 265 | else: 266 | dictionary['bio'] = True 267 | 268 | if data['email'] is None: 269 | dictionary['email'] = False 270 | else: 271 | dictionary['email'] = True 272 | 273 | if data['location'] is None: 274 | dictionary['location'] = False 275 | else: 276 | dictionary['location'] = True 277 | print(dictionary) 278 | return dictionary 279 | else: 280 | time.sleep(5) 281 | print(f"Error: {response.status_code}") 282 | print('Time to give a break') 283 | for i in range(5): 284 | print(f"{i} seconds.{5 - i} seconds to restart") 285 | time.sleep(1) 286 | self.gather_account_data(account) 287 | 288 | # The following method follows accounts 289 | def follow_accounts(self): 290 | choices= ["IDouble","gamemann",'JohnMwendwa','BEPb','cumsoft','esin','kenjinote','peter-kimanzi','eust-w','OracleBrain','angusshire','Charles-Chrismann','jrohitofficial','george0st','mustafacagri','samarjitsahoo','alineai18','AbdeenM','cusspvz','aplus-developer','ip681','Shehab-Hegab','V1nni00','dalindev','JCSIVO','ethanflower1903',"Nakshatra05",'warmice71','mxmnk','otaviossousa','seniorvuejsdeveloper','mstraughan86','vivekweb2013','Magicianred','JubayerRiyad','MichalPaszkiewicz','mahseema','KevinHock','ValentineFernandes','jeffersonsimaogoncalves','AppServiceProvider','Rodrigo-Cn','jdevfullstack','kulikov-dev','xopaz','dirambora','deepsea514','nikitavoloboev','Gizachew29','AlianeAmaral','decoderwhoami','milsaware','somekindofwallflower'] 291 | 292 | account_chosen = random.choice(choices) 293 | print(account_chosen) 294 | accounts = [] 295 | url = f'https://api.github.com/users/{account_chosen}/followers' 296 | page = 1 297 | 298 | loop = True 299 | while loop: 300 | furl = f"{url}?page={page}&per_page=100" 301 | response = requests.get(furl, headers=self.headers) 302 | 303 | if response.status_code == 200: 304 | if response.json() == []: 305 | loop = False 306 | else: 307 | print(response.status_code) 308 | for item in response.json(): 309 | accounts.append(item['login']) 310 | print(item['login'], len(accounts), page) 311 | page += 1 312 | else: 313 | print(response.status_code) 314 | print(response.json()) 315 | print('Time to give a break') 316 | for i in range(5): 317 | print(f"{i} seconds, {5 - i} seconds left to restart") 318 | time.sleep(1) 319 | 320 | count = 0 321 | for account in accounts: 322 | if account not in self.blacklist: 323 | if account not in self.special: 324 | if account not in self.following: 325 | if account not in self.followers: 326 | if count != 500: 327 | time.sleep(1) 328 | self.follow_one_account(account) 329 | if self.check_your_following(account): 330 | count += 1 331 | 332 | 333 | # This method automates the entire process on repeat 334 | def automate(self): 335 | while True: 336 | t1 = time.time() 337 | self.follow_accounts() 338 | self.unfollow_accounts() 339 | 340 | loop = True 341 | while loop: 342 | 343 | t2 = time.time() 344 | if t2 - t1 >3600: 345 | loop = False 346 | else: 347 | print(f"{t2-t1} seconds have gone by. {3600-(t2-t1)} seconds left.") 348 | time.sleep(2) 349 | 350 | if __name__ == "__main__": 351 | bot = GithubBot() 352 | 353 | 354 | -------------------------------------------------------------------------------- /Github Follow-Unfollow Bot/main.py: -------------------------------------------------------------------------------- 1 | import random 2 | import time, os 3 | 4 | from selenium import webdriver 5 | from selenium.webdriver.common.by import By 6 | from selenium.webdriver.common.keys import Keys 7 | from bs4 import BeautifulSoup 8 | 9 | 10 | class GitHubBot: 11 | def __init__(self): 12 | self.start_driver() 13 | time.sleep(3) 14 | self.login() 15 | self.followers = [] 16 | self.following = [] 17 | 18 | 19 | def start_driver(self): 20 | chrome_options = webdriver.ChromeOptions() 21 | chrome_options.add_experimental_option("detach", True) 22 | self.driver = webdriver.Chrome(options=chrome_options) 23 | self.driver.get(url="https://github.com/login") 24 | 25 | # The following method will log in to GitHub 26 | def login(self): 27 | email = os.environ.get("email") 28 | password = os.environ.get("password") 29 | email_input = self.driver.find_element(By.NAME, "login") 30 | password_input = self.driver.find_element(By.NAME, "password") 31 | email_input.send_keys(os.environ.get("email")) 32 | time.sleep(1) 33 | password_input.send_keys(os.environ.get("password"), Keys.ENTER) 34 | time.sleep(10) 35 | 36 | # The following bot unfollows accounts for the person's own given page 37 | # replace meliksahyorulmazlar with the name of your account 38 | def unfollow(self, number: int): 39 | page = f"https://github.com/meliksahyorulmazlar?page={number}&tab=following" 40 | self.driver.get(page) 41 | 42 | paths = [] 43 | path = "#user-profile-frame > div > div:nth-child(1) > div.d-table-cell.col-2.v-align-top.text-right > span > form:nth-child(2) > input.btn.btn-sm" 44 | for i in range(1, 51): 45 | replaced = f"div:nth-child({i})" 46 | new_path = path.replace("div:nth-child(1)", replaced) 47 | paths.append(new_path) 48 | 49 | for path in paths: 50 | x = self.driver.find_element(By.CSS_SELECTOR, path) 51 | x.click() 52 | time.sleep(0.5) 53 | time.sleep(5) 54 | 55 | # The following method follows an account when given it's url, and it's page number 56 | def follow(self, page: str, number: int): 57 | website = f"{page}?page={number}&tab=followers" 58 | self.driver.get(website) 59 | paths = [] 60 | path1 = "#user-profile-frame > div > div:nth-child(1) > div.d-table-cell.col-2.v-align-top.text-right > span > form:nth-child(1) > input.btn.btn-sm" 61 | path2 = "#user-profile-frame > div > div:nth-child(1) > div.d-table-cell.col-2.v-align-top.text-right > span > form:nth-child(2) > input.btn.btn-sm" 62 | for i in range(1, 51): 63 | replaced = f"div:nth-child({i})" 64 | new_path1 = path1.replace("div:nth-child(1)", replaced) 65 | new_path2 = path2.replace("div:nth-child(1)", replaced) 66 | tpl = new_path1, new_path2 67 | paths.append(tpl) 68 | 69 | for path in paths: 70 | a = self.driver.find_element(By.CSS_SELECTOR, path[0]) 71 | b = self.driver.find_element(By.CSS_SELECTOR, path[1]) 72 | if a.is_enabled() and a.is_displayed(): 73 | a.click() 74 | elif b.is_enabled() and b.is_displayed(): 75 | b.click() 76 | number = random.randint(1,10000) 77 | t = number/10000 78 | time.sleep(t) 79 | time.sleep(2) 80 | 81 | def find_followers(self): 82 | website = f"https://github.com/meliksahyorulmazlar" 83 | self.driver.get(website) 84 | html_content = self.driver.page_source 85 | soup = BeautifulSoup(html_content, 'lxml') 86 | links = soup.find_all("a", href=True) 87 | link = [link.text for link in links if "followers" in link['href']] 88 | link = link[0] 89 | link = float(link.split("k")[0].strip()) * 1000 90 | page_count = int((link // 50) + 1) 91 | possible = f"https://github.com/meliksahyorulmazlar?page={page_count}&tab=followers" 92 | self.driver.get(possible) 93 | soup = BeautifulSoup(self.driver.page_source, 'lxml') 94 | p_tag = soup.find("p", class_="mt-4") 95 | if p_tag is not None: 96 | page_count -= 1 97 | number = page_count 98 | print(number) 99 | for number in range(1,number+1): 100 | page = f"https://github.com/meliksahyorulmazlar?page={number}&tab=followers" 101 | self.driver.get(page) 102 | html_content = self.driver.page_source 103 | soup = BeautifulSoup(html_content,'lxml') 104 | users = [span.text for span in soup.find_all('span',class_='Link--secondary')] 105 | self.followers += users 106 | 107 | def find_following(self): 108 | number = 30 109 | website = f"https://github.com/meliksahyorulmazlar" 110 | self.driver.get(website) 111 | html_content = self.driver.page_source 112 | soup = BeautifulSoup(html_content, 'lxml') 113 | links = soup.find_all("a", href=True) 114 | link = [link.text for link in links if "following" in link['href']] 115 | link = link[0] 116 | link = float(link.split("k")[0].strip()) * 1000 117 | page_count = int((link // 50) + 1) 118 | possible = f"https://github.com/meliksahyorulmazlar?page={page_count}&tab=following" 119 | self.driver.get(possible) 120 | soup = BeautifulSoup(self.driver.page_source, 'lxml') 121 | p_tag = soup.find("p", class_="mt-4") 122 | if p_tag is not None: 123 | page_count -= 1 124 | number = page_count 125 | print(number) 126 | for number in range(1, number + 1): 127 | page = f"https://github.com/meliksahyorulmazlar?page={number}&tab=following" 128 | self.driver.get(page) 129 | html_content = self.driver.page_source 130 | soup = BeautifulSoup(html_content, 'lxml') 131 | users = [span.text for span in soup.find_all('span', class_='Link--secondary')] 132 | self.following += users 133 | 134 | def check_accounts(self): 135 | self.find_followers() 136 | self.find_following() 137 | print(self.followers) 138 | print(len(self.followers)) 139 | print(self.following) 140 | print(len(self.following)) 141 | accounts = ["IDouble","gamemann",'JohnMwendwa','BEPb','cumsoft','esin','kenjinote','peter-kimanzi','eust-w','OracleBrain','angusshire','Charles-Chrismann','jrohitofficial','george0st','mustafacagri','samarjitsahoo','alineai18','AbdeenM','cusspvz','aplus-developer','ip681','Shehab-Hegab','V1nni00','dalindev','JCSIVO','ethanflower1903',"Nakshatra05",'warmice71','mxmnk','otaviossousa','seniorvuejsdeveloper','mstraughan86','vivekweb2013','Magicianred','JubayerRiyad','MichalPaszkiewicz','mahseema','KevinHock','ValentineFernandes','jeffersonsimaogoncalves','AppServiceProvider','Rodrigo-Cn','jdevfullstack','kulikov-dev','xopaz','dirambora','deepsea514','nikitavoloboev','Gizachew29','AlianeAmaral','decoderwhoami','milsaware','somekindofwallflower'] 142 | 143 | random.shuffle(accounts) 144 | accounts_to_follow = [] 145 | if len(accounts_to_follow) < 500: 146 | for account in accounts: 147 | if len(accounts_to_follow) <500: 148 | website = f"https://github.com/{account}" 149 | self.driver.get(website) 150 | html_content = self.driver.page_source 151 | soup = BeautifulSoup(html_content, 'lxml') 152 | links = soup.find_all("a", href=True) 153 | link = [link.text for link in links if "followers" in link['href']] 154 | link = link[0] 155 | link = float(link.split("k")[0].strip()) * 1000 156 | page_count = int((link // 50) + 1) 157 | possible = f"https://github.com/{account}?page={page_count}&tab=followers" 158 | self.driver.get(possible) 159 | soup = BeautifulSoup(self.driver.page_source, 'lxml') 160 | p_tag = soup.find("p", class_="mt-4") 161 | if p_tag is not None: 162 | page_count -= 1 163 | number = page_count 164 | for number in range(1, number + 1): 165 | if len(accounts_to_follow) < 500: 166 | page = f"https://github.com/{account}?page={number}&tab=followers" 167 | self.driver.get(page) 168 | html_content = self.driver.page_source 169 | soup = BeautifulSoup(html_content, 'lxml') 170 | users = [span.text for span in soup.find_all('span', class_='Link--secondary')] 171 | if len(accounts_to_follow) < 500: 172 | for user in users: 173 | if len(accounts_to_follow) < 500: 174 | if user not in self.followers and user not in self.following: 175 | accounts_to_follow.append(user) 176 | print(user, len(accounts_to_follow)) 177 | for account in accounts_to_follow: 178 | if account not in self.following and not account in self.followers: 179 | user_page = f"https://github.com/{account}" 180 | self.driver.get(user_page) 181 | inputs = self.driver.find_elements(By.TAG_NAME,'input') 182 | buttons = [inp for inp in inputs if inp.get_attribute('title') == f'Follow {account}'] 183 | if buttons: 184 | button = buttons[0] 185 | button.click() 186 | 187 | def unfollow_account(self,account:str): 188 | user_page = f"https://github.com/{account}" 189 | self.driver.get(user_page) 190 | inputs = self.driver.find_elements(By.TAG_NAME, 'input') 191 | buttons = [inp for inp in inputs if inp.get_attribute('title') == f'Unfollow {account}'] 192 | if buttons: 193 | button = buttons[0] 194 | button.click() 195 | 196 | def unfollow_followed_ones(self): 197 | self.followers = [] 198 | self.following = [] 199 | self.find_followers() 200 | self.find_following() 201 | 202 | accounts = [account for account in self.following if account in self.followers] 203 | special = ["emirkaanozdemr","nepthius"] 204 | for account in accounts: 205 | if account not in special: 206 | self.unfollow_account(account) 207 | 208 | def automate(self): 209 | while True: 210 | t1 = time.time() 211 | self.followers = [] 212 | self.following = [] 213 | self.find_following() 214 | self.find_followers() 215 | self.check_accounts() 216 | checked = False 217 | loop = True 218 | while loop == True: 219 | t2 = time.time() 220 | if t2-t1 > 2700 and checked == False: 221 | self.unfollow_followed_ones() 222 | checked = True 223 | loop = False 224 | 225 | new_loop = True 226 | while new_loop: 227 | t2 = time.time() 228 | if t2-t1 >= 3600: 229 | new_loop = False 230 | 231 | 232 | if __name__ == "__main__": 233 | github_bot = GitHubBot() 234 | github_bot.automate() 235 | 236 | 237 | 238 | 239 | 240 | 241 | -------------------------------------------------------------------------------- /Internet Speed Twitter Bot/main.py: -------------------------------------------------------------------------------- 1 | # Internet Speed Twitter Bot 2 | # This bot will get the person's internet speed etc. and post it on Twitter 3 | 4 | 5 | import time,os 6 | from selenium import webdriver 7 | from selenium.webdriver.common.by import By 8 | from selenium.webdriver.common.keys import Keys 9 | from tkinter import * 10 | from tkinter import messagebox 11 | 12 | 13 | 14 | class InternetTwitterBot: 15 | def __init__(self): 16 | key = os.environ['password'] 17 | print(key) 18 | self.start_chrome() 19 | # This way the graphical user interface only comes up when the internet speed website has loaded up 20 | self.start_graphics() 21 | self.tweet() 22 | 23 | # The following method initiates the selenium webdriver 24 | def start_chrome(self): 25 | chrome_options = webdriver.ChromeOptions() 26 | chrome_options.add_experimental_option('detach',True) 27 | self.chrome = webdriver.Chrome(options=chrome_options) 28 | 29 | # This method initiates the graphics 30 | def start_graphics(self): 31 | self.root = Tk() 32 | self.root.title("Internet Speed Twitter Bot") 33 | self.root.minsize(width=600,height=400) 34 | self.root.maxsize(width=600,height=400) 35 | 36 | self.username_label = Label(self.root,text="Username:") 37 | self.username_label.place(x=75,y=100) 38 | 39 | self.username_entry = Entry(self.root,width=40) 40 | self.username_entry.place(x=150,y=100) 41 | 42 | self.username_entry.focus() 43 | 44 | self.username_tip = Label(self.root,text="For the username, enter your phone number, username or your email") 45 | self.username_tip.place(x=75,y=130) 46 | 47 | self.password_label = Label(self.root,text="Password:") 48 | self.password_label.place(x=75,y=180) 49 | 50 | self.password_entry = Entry(self.root, width=40) 51 | self.password_entry.place(x=150, y=180) 52 | 53 | self.password_tip = Label(self.root,text="For the password, enter your password") 54 | self.password_tip.place(x=75,y=210) 55 | 56 | self.enter_button = Button(self.root,text="Enter",width=40,command=self.process) 57 | self.enter_button.place(x=100,y=270) 58 | 59 | self.root.mainloop() 60 | 61 | # This method will check if both a username and a password has been entered to initiate the process of tweeting the internet speed 62 | def process(self): 63 | username = self.username_entry.get() 64 | password = self.password_entry.get() 65 | 66 | if len(username) == 0 or len(password) == 0: 67 | messagebox.showerror(message="Something is missing") 68 | else: 69 | self.username = username 70 | self.password = password 71 | self.username_entry.delete(0, END) 72 | self.password_entry.delete(0, END) 73 | 74 | self.username_entry.update_idletasks() 75 | self.password_entry.update_idletasks() 76 | 77 | self.root.after(100, self.get_internet_speed) 78 | self.root.after(200, self.tweet) 79 | 80 | # The following method will retrieve the download speed in mbps, the upload speed in mbps and the ping in ms 81 | def get_internet_speed(self): 82 | self.chrome.get(url="https://www.speedtest.net") 83 | go = self.chrome.find_element(By.XPATH,'//*[@id="container"]/div/div[3]/div/div/div/div[2]/div[3]/div[1]/a/span[4]') 84 | go.click() 85 | 86 | time.sleep(60) 87 | 88 | upload = self.chrome.find_element(By.XPATH,'//*[@id="container"]/div/div[3]/div/div/div/div[2]/div[3]/div[3]/div/div[3]/div/div/div[2]/div[1]/div[2]/div/div[2]/span') 89 | 90 | download = self.chrome.find_element(By.XPATH,'//*[@id="container"]/div/div[3]/div/div/div/div[2]/div[3]/div[3]/div/div[3]/div/div/div[2]/div[1]/div[1]/div/div[2]/span') 91 | 92 | 93 | ping = self.chrome.find_element(By.XPATH,'//*[@id="container"]/div/div[3]/div/div/div/div[2]/div[3]/div[3]/div/div[3]/div/div/div[2]/div[2]/div/span[2]/span') 94 | 95 | self.upload_speed = float(upload.text) 96 | 97 | self.download_speed = float(download.text) 98 | 99 | self.ping = int(ping.text) 100 | 101 | # The following method will tweet the following: 102 | # The download speed,the upload speed and the ping 103 | def tweet(self): 104 | 105 | self.chrome.get(url="https://x.com/i/flow/login") 106 | 107 | time.sleep(5) 108 | username_entry = self.chrome.find_element(By.NAME,'text') 109 | username_entry.send_keys(self.username,Keys.ENTER) 110 | 111 | time.sleep(1) 112 | password_entry = self.chrome.find_element(By.NAME,'password') 113 | password_entry.send_keys(self.password,Keys.ENTER) 114 | time.sleep(2) 115 | print(self.chrome.current_url) 116 | if self.chrome.current_url == "https://x.com/i/flow/login?redirect_after_login=%2Fcompose%2Fpost": 117 | time.sleep(5) 118 | username_entry = self.chrome.find_element(By.NAME, 'text') 119 | username_entry.send_keys(self.username, Keys.ENTER) 120 | 121 | time.sleep(1) 122 | password_entry = self.chrome.find_element(By.NAME, 'password') 123 | password_entry.send_keys(self.password, Keys.ENTER) 124 | 125 | self.chrome.get(url="https://x.com/compose/post") 126 | 127 | time.sleep(1) 128 | tweet = self.chrome.find_element(By.CSS_SELECTOR,'div[contenteditable="true"]') 129 | 130 | message = f"The Download speed is {self.download_speed} mbps.The Upload speed is {self.upload_speed} mbps.The Ping is {self.ping} ms" 131 | tweet.send_keys(message) 132 | 133 | spans = self.chrome.find_elements(By.TAG_NAME,"span") 134 | 135 | span_element = None 136 | clickable = [span for span in spans if span.text == "Post"] 137 | print(clickable) 138 | for span in clickable: 139 | span.click() 140 | 141 | 142 | if __name__ == "__main__": 143 | twitter = InternetTwitterBot() 144 | -------------------------------------------------------------------------------- /London App Brewery Lab Report Signup Bot/main.py: -------------------------------------------------------------------------------- 1 | # London App brewery Lab Report signup 2 | 3 | #This code will sign you up for the lab report 4 | 5 | from selenium import webdriver 6 | from selenium.webdriver.common.by import By 7 | from selenium.webdriver.common.keys import Keys 8 | class LabReport: 9 | def __init__(self,name:str,surname:str,email:str): 10 | self.start_driver() 11 | name_entry = self.chrome.find_element(By.NAME,"fName") 12 | name_entry.send_keys(name) 13 | surname_entry = self.chrome.find_element(By.NAME, "lName") 14 | surname_entry.send_keys(surname) 15 | email_entry = self.chrome.find_element(By.NAME, "email") 16 | email_entry.send_keys(email) 17 | 18 | button = self.chrome.find_element(By.XPATH,'/html/body/form/button') 19 | button.click() 20 | 21 | def start_driver(self): 22 | chrome_options = webdriver.ChromeOptions() 23 | chrome_options.add_experimental_option("detach",True) 24 | 25 | self.chrome = webdriver.Chrome(options=chrome_options) 26 | self.chrome.get(url="http://secure-retreat-92358.herokuapp.com") 27 | 28 | 29 | 30 | if __name__ == "__main__": 31 | name = "Meliksah" 32 | surname = "Yorulmazlar" 33 | email = "yorulk@rpi.edu" 34 | labreport = LabReport(name=name,surname=surname,email=email) -------------------------------------------------------------------------------- /Stock Trading News Alert System/main.py: -------------------------------------------------------------------------------- 1 | #A system that monitors stock prices and identifies significant fluctuations. Upon detecting a notable change(at least 5%), the system automatically retrieves andsends relevant news articles to the user. 2 | #For the stock price change I used Alphavantage (50$ a month but can easily cancel membership) 3 | #For retrieving the news about the stock I used newsapi.org (free) 4 | import requests,datetime,os,smtplib 5 | from email.message import EmailMessage 6 | 7 | class StockTradingNews: 8 | def __init__(self): 9 | self.tech_companies = [("AAPL", "Apple"), ("MSFT", "Microsoft"), ("AMZN", "Amazon"), ("GOOGL", "Alphabet (Google)"), ("META", "META"), ("NVDA", "NVIDIA"), ("INTC", "Intel"), ("CSCO", "Cisco Systems"), ("ADBE", "Adobe"), ("NFLX", "Netflix"),("TSLA","Tesla"),("ORCL","Oracle")] 10 | self.financial_companies = [("BRK-A","Berkshire Hathaway"),("JPM", "JPMorgan Chase"), ("BAC", "Bank of America"), ("WFC", "Wells Fargo"),("MS", "Morgan Stanley"), ("GS", "Goldman Sachs"), ("SCHW", "Charles Schwab"),("AXP", "American Express"), ("PNC", "PNC Financial Services"), ("BLK", "BlackRock")] 11 | self.healthcare_companies = [("JNJ", "Johnson & Johnson"), ("UNH", "UnitedHealth Group"), ("PFE", "Pfizer"),("MRK", "Merck"), ("ABT", "Abbott Laboratories"), ("LLY", "Eli Lilly"),("MDT", "Medtronic"), ("GILD", "Gilead Sciences"), ("ISRG", "Intuitive Surgical"),("CVS", "CVS Health")] 12 | self.consumer_goods_companies = [("PG", "Procter & Gamble"), ("KO", "Coca-Cola"), ("PEP", "PepsiCo"),("WMT", "Walmart"), ("NKE", "Nike"), ("MCD", "McDonald's"), ("COST", "Costco"),("SBUX", "Starbucks"), ("MO", "Altria"), ("CL", "Colgate-Palmolive")] 13 | self.energy_companies = [("XOM", "ExxonMobil"), ("CVX", "Chevron"), ("NEE", "NextEra Energy"),("D", "Dominion Energy"), ("DUK", "Duke Energy"), ("SO", "Southern Company"),("PPL", "PPL Corporation"), ("AEP", "American Electric Power"), ("SRE", "Sempra Energy"),("ED", "Consolidated Edison")] 14 | self.industrial_companies = [("HON", "Honeywell"), ("UNP", "Union Pacific"), ("CAT", "Caterpillar"),("LMT", "Lockheed Martin"), ("UPS", "United Parcel Service"), ("BA", "Boeing"),("RTX", "Raytheon Technologies"), ("DE", "Deere & Company"), ("MMM", "3M"),("GE", "General Electric")] 15 | self.companies = self.tech_companies + self.financial_companies + self.healthcare_companies + self.consumer_goods_companies + self.energy_companies + self.industrial_companies 16 | self.dictionary = {"Tech":self.tech_companies,"Finance":self.financial_companies,"Healthcare":self.healthcare_companies,"Consumer Goods":self.consumer_goods_companies,"Industrial":self.industrial_companies} 17 | 18 | #This will show all the categories 19 | def show_categories(self): 20 | categories = [key for key in self.dictionary] 21 | print(categories) 22 | 23 | #This will check a specific category ranging from tech to finance 24 | def check_industry(self,category:str): 25 | if category.title() in self.dictionary: 26 | companies = self.dictionary[category.title()] 27 | for company in companies: 28 | self.check_change(company) 29 | 30 | #This will check how much the stock has changed since the previous day 31 | #If the change is at least 5 percent positive or negative 32 | #It will find the latest news on the stock and email the user to update the user on the change 33 | def check_change(self,company:tuple): 34 | apistockkey = os.environ["apistockkey"] 35 | symbol = company[0] 36 | name = company[1] 37 | 38 | url = f'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol={symbol}&apikey={apistockkey}' 39 | 40 | response = requests.get(url=url) 41 | 42 | prices = response.json()['Time Series (Daily)'] 43 | price_list = [(price, prices[price]['4. close']) for price in prices] 44 | today_price = float(price_list[0][1]) 45 | yesterday_price = float(price_list[1][1]) 46 | print(today_price, yesterday_price, company) 47 | change = ((today_price - yesterday_price) / yesterday_price) * 100 48 | if abs(change) >= 5: 49 | if change >0: 50 | result = f"{symbol}: 🔺{change:.2f}%" 51 | else: 52 | result = f"{symbol}: 🔻{change:.2f}%" 53 | apinewskey = os.environ["apinewskey"] 54 | today = datetime.datetime.today() 55 | one_day = datetime.timedelta(days=1) 56 | yesterday = today - one_day 57 | today = today.date() 58 | yesterday = yesterday.date() 59 | 60 | news = f"https://newsapi.org/v2/everything?q={name}&from={yesterday}&to={yesterday}&sortBy=popularity&apiKey={apinewskey}" 61 | news_response = requests.get(url=news).json() 62 | results = news_response["articles"][:3] 63 | with smtplib.SMTP("smtp.gmail.com", 587) as connection: 64 | message = EmailMessage() 65 | message["From"] = "user@gmail.com" 66 | message["To"] = "receiver@email.com" 67 | message["Subject"] = result 68 | html_message = f""" 69 | 70 | 71 | 72 |

News:{results[0]["title"]}

73 |

{results[0]["url"]}

74 |

News:{results[1]["title"]}

75 |

{results[1]["url"]}

76 |

News:{results[2]["title"]}

77 |

{results[2]["url"]}

78 | 79 | 80 | """ 81 | message.add_alternative(html_message, subtype="html") 82 | connection.starttls() 83 | connection.login(user="user@gmail.com", password=os.environ["email"]) 84 | connection.send_message(message) 85 | print(f"Sent:{result}") 86 | 87 | #This will check all the stocks that I have chosen 88 | def check_all(self): 89 | for company in self.companies: 90 | self.check_change(company) 91 | 92 | 93 | 94 | 95 | if __name__ == "__main__": 96 | stn = StockTradingNews() 97 | 98 | #before this code can work,you need to do some things 99 | #you need to set three environment variables 100 | #One for stock api called apistockkey 101 | #One for the newsapi called apinewskey 102 | #Finally for the password of your email 103 | #you can get app app passwords for gmail from https://myaccount.google.com/apppasswords 104 | #you create an app specific password and it can have any name you want 105 | #then it will give you a 16 character password (The following is an example of how it will look like) 106 | # abcd efgh ijkl mnop 107 | #your email environment variable should then be "abcdefghijklmnop" 108 | #you also need to change who will send the email,and who will receive the email on lines 65,66,83 109 | 110 | #This method will show all the categories/industries to display 111 | #Takes no input 112 | #stn.show_categories() 113 | 114 | #This method will check a specific category 115 | #You can find the categories from stn.show_categories() 116 | #For example for tech stocks you can say: 117 | #stn.check_industry(category="Tech") 118 | #For finance: 119 | #stn.check_industry(category="Finance") 120 | 121 | #This method will check all the stocks 122 | #The method takes no input 123 | #stn.check_all() -------------------------------------------------------------------------------- /Tinder Like-Reject Bot/main.py: -------------------------------------------------------------------------------- 1 | # Tinder like / reject bot 2 | 3 | import time 4 | 5 | from selenium import webdriver 6 | from selenium.webdriver.common.by import By 7 | from selenium.webdriver.common.keys import Keys 8 | 9 | 10 | 11 | class TinderBot: 12 | def __init__(self): 13 | self.start_driver() 14 | # I give the person 90 seconds to login to Tinder 15 | time.sleep(90) 16 | 17 | 18 | # The following method will start the selenium webdriver 19 | def start_driver(self): 20 | chrome_options = webdriver.ChromeOptions() 21 | chrome_options.add_experimental_option("detach",True) 22 | self.driver = webdriver.Chrome(options=chrome_options) 23 | self.driver.get(url='https://tinder.com') 24 | 25 | # The following method will reject the user 26 | def reject(self): 27 | try: 28 | body = self.driver.find_element(By.CSS_SELECTOR,"body") 29 | body.send_keys(Keys.ARROW_LEFT) 30 | time.sleep(1) # Adjust sleep time to control the speed 31 | except Exception as e: 32 | print(f"Error swiping: {e}") 33 | time.sleep(2) 34 | 35 | #The following method will like the user 36 | def like(self): 37 | try: 38 | body = self.driver.find_element(By.CSS_SELECTOR,"body") 39 | body.send_keys(Keys.ARROW_RIGHT) 40 | time.sleep(1) # Adjust sleep time to control the speed 41 | except Exception as e: 42 | print(f"Error swiping: {e}") 43 | time.sleep(2) 44 | 45 | 46 | if __name__ == "__main__": 47 | tb = TinderBot() 48 | #Tinder lets you like 50 people a day 49 | for i in range(50): 50 | tb.like() 51 | -------------------------------------------------------------------------------- /github_bot_personal/following.json: -------------------------------------------------------------------------------- 1 | {"GhostOf0days": {"day": 9, "month": 8, "year": 2023}, "YangletLiu": {"day": 9, "month": 8, "year": 2023}, "Chriun": {"day": 9, "month": 8, "year": 2023}, "Allan-Feng": {"day": 9, "month": 8, "year": 2023}, "aalyaz": {"day": 9, "month": 8, "year": 2023}, "cshao23": {"day": 9, "month": 8, "year": 2023}, "philiplpaterson": {"day": 9, "month": 8, "year": 2023}, "connorhakan8": {"day": 9, "month": 8, "year": 2023}, "nepthius": {"day": 9, "month": 8, "year": 2023}, "enisaras": {"day": 9, "month": 8, "year": 2023}, "Hamid-Mofidi": {"day": 9, "month": 8, "year": 2023}, "Jshot117": {"day": 9, "month": 8, "year": 2023}, "emirkaanozdemr": {"day": 9, "month": 8, "year": 2023}} -------------------------------------------------------------------------------- /github_bot_personal/main.py: -------------------------------------------------------------------------------- 1 | import random,datetime 2 | import time, os,json 3 | 4 | from selenium import webdriver 5 | from selenium.webdriver.common.by import By 6 | from selenium.webdriver.common.keys import Keys 7 | from bs4 import BeautifulSoup 8 | 9 | 10 | class GitHubBot: 11 | def __init__(self): 12 | #self.login() 13 | self.special = {'GhostOf0days': {'day': 9, 'month': 8, 'year': 2023}, 'YangletLiu': {'day': 9, 'month': 8, 'year': 2023}, 'Chriun': {'day': 9, 'month': 8, 'year': 2023}, 'Allan-Feng': {'day': 9, 'month': 8, 'year': 2023}, 'aalyaz': {'day': 9, 'month': 8, 'year': 2023}, 'cshao23': {'day': 9, 'month': 8, 'year': 2023}, 'philiplpaterson': {'day': 9, 'month': 8, 'year': 2023}, 'connorhakan8': {'day': 9, 'month': 8, 'year': 2023}, 'nepthius': {'day': 9, 'month': 8, 'year': 2023}, 'enisaras': {'day': 9, 'month': 8, 'year': 2023}, 'Hamid-Mofidi': {'day': 9, 'month': 8, 'year': 2023}, 'Jshot117': {'day': 9, 'month': 8, 'year': 2023}, 'emirkaanozdemr': {'day': 9, 'month': 8, 'year': 2023}} 14 | self.followers = [] 15 | self.following = {} 16 | self.login() 17 | 18 | 19 | def find_following(self): 20 | with open("following.json",'r') as f: 21 | self.following = json.load(f) 22 | 23 | 24 | def start_driver(self): 25 | chrome_options = webdriver.ChromeOptions() 26 | chrome_options.add_experimental_option("detach", True) 27 | self.driver = webdriver.Chrome(options=chrome_options) 28 | self.driver.get(url="https://github.com/login") 29 | time.sleep(3) 30 | 31 | def login(self): 32 | self.start_driver() 33 | email = os.environ.get("email") 34 | password = os.environ.get("password") 35 | email_input = self.driver.find_element(By.NAME, "login") 36 | password_input = self.driver.find_element(By.NAME, "password") 37 | email_input.send_keys(os.environ.get("email")) 38 | time.sleep(1) 39 | password_input.send_keys(os.environ.get("password"), Keys.ENTER) 40 | time.sleep(10) 41 | 42 | def find_followers(self): 43 | website = f"https://github.com/meliksahyorulmazlar" 44 | self.driver.get(website) 45 | html_content = self.driver.page_source 46 | soup = BeautifulSoup(html_content, 'lxml') 47 | links = soup.find_all("a", href=True) 48 | link = [link.text for link in links if "followers" in link['href']] 49 | link = link[0] 50 | link = float(link.split("k")[0].strip()) * 1000 51 | page_count = int((link // 50) + 1) 52 | possible = f"https://github.com/meliksahyorulmazlar?page={page_count}&tab=followers" 53 | self.driver.get(possible) 54 | soup = BeautifulSoup(self.driver.page_source, 'lxml') 55 | p_tag = soup.find("p", class_="mt-4") 56 | if p_tag is not None: 57 | page_count -= 1 58 | number = page_count 59 | print(number) 60 | for number in range(1, number + 1): 61 | page = f"https://github.com/meliksahyorulmazlar?page={number}&tab=followers" 62 | self.driver.get(page) 63 | html_content = self.driver.page_source 64 | soup = BeautifulSoup(html_content, 'lxml') 65 | users = [span.text for span in soup.find_all('span', class_='Link--secondary')] 66 | self.followers += users 67 | 68 | def check_accounts(self): 69 | self.find_followers() 70 | self.find_following() 71 | accounts = ["IDouble", "gamemann", 'JohnMwendwa', 'BEPb', 'cumsoft', 'esin', 'kenjinote', 'peter-kimanzi','eust-w', 'OracleBrain', 'angusshire', 'Charles-Chrismann', 'jrohitofficial', 'george0st','mustafacagri', 'samarjitsahoo', 'alineai18', 'AbdeenM', 'cusspvz', 'aplus-developer', 'ip681','Shehab-Hegab', 'V1nni00', 'dalindev', 'JCSIVO', 'ethanflower1903', "Nakshatra05", 'warmice71','mxmnk', 'otaviossousa', 'seniorvuejsdeveloper', 'mstraughan86', 'vivekweb2013', 'Magicianred','JubayerRiyad', 'MichalPaszkiewicz', 'mahseema', 'KevinHock', 'ValentineFernandes','jeffersonsimaogoncalves', 'AppServiceProvider', 'Rodrigo-Cn', 'jdevfullstack', 'kulikov-dev','xopaz', 'dirambora', 'deepsea514', 'nikitavoloboev', 'Gizachew29', 'AlianeAmaral', 'decoderwhoami','milsaware', 'somekindofwallflower'] 72 | 73 | random.shuffle(accounts) 74 | accounts_to_follow = [] 75 | if len(accounts_to_follow) < 500: 76 | for account in accounts: 77 | if len(accounts_to_follow) < 500: 78 | website = f"https://github.com/{account}" 79 | self.driver.get(website) 80 | html_content = self.driver.page_source 81 | soup = BeautifulSoup(html_content, 'lxml') 82 | links = soup.find_all("a", href=True) 83 | link = [link.text for link in links if "followers" in link['href']] 84 | link = link[0] 85 | link = float(link.split("k")[0].strip()) * 1000 86 | page_count = int((link // 50) + 1) 87 | possible = f"https://github.com/{account}?page={page_count}&tab=followers" 88 | self.driver.get(possible) 89 | soup = BeautifulSoup(self.driver.page_source, 'lxml') 90 | p_tag = soup.find("p", class_="mt-4") 91 | if p_tag is not None: 92 | page_count -= 1 93 | number = page_count 94 | for number in range(1, number + 1): 95 | if len(accounts_to_follow) < 500: 96 | page = f"https://github.com/{account}?page={number}&tab=followers" 97 | self.driver.get(page) 98 | html_content = self.driver.page_source 99 | soup = BeautifulSoup(html_content, 'lxml') 100 | users = [span.text for span in soup.find_all('span', class_='Link--secondary')] 101 | if len(accounts_to_follow) < 500: 102 | for user in users: 103 | if len(accounts_to_follow) < 500: 104 | if user not in self.followers and user not in self.following: 105 | accounts_to_follow.append(user) 106 | print(user, len(accounts_to_follow)) 107 | for account in accounts_to_follow: 108 | if account not in self.following and not account in self.followers: 109 | user_page = f"https://github.com/{account}" 110 | self.driver.get(user_page) 111 | inputs = self.driver.find_elements(By.TAG_NAME, 'input') 112 | buttons = [inp for inp in inputs if inp.get_attribute('title') == f'Follow {account}'] 113 | if buttons: 114 | button = buttons[0] 115 | button.click() 116 | day = datetime.datetime.now().day 117 | month = datetime.datetime.now().month 118 | year = datetime.datetime.now().year 119 | self.following[account] = {'day': day, 'month': month, 'year': year} 120 | with open("following.json",'w') as f: 121 | json.dump(self.following,f,ensure_ascii=False,indent=4) 122 | 123 | def unfollow_account(self, account: str): 124 | user_page = f"https://github.com/{account}" 125 | self.driver.get(user_page) 126 | inputs = self.driver.find_elements(By.TAG_NAME, 'input') 127 | buttons = [inp for inp in inputs if inp.get_attribute('title') == f'Unfollow {account}'] 128 | if buttons: 129 | button = buttons[0] 130 | button.click() 131 | self.following.pop(account) 132 | with open('following.json', 'w') as f: 133 | json.dump(self.following, f, ensure_ascii=False, indent=4) 134 | 135 | def unfollow_followed_ones(self): 136 | self.followers = [] 137 | self.following = {} 138 | self.find_followers() 139 | self.find_following() 140 | 141 | accounts = [account for account in self.following if account in self.followers] 142 | for account in accounts: 143 | if account not in self.special: 144 | self.unfollow_account(account) 145 | self.following.pop(account) 146 | with open('following.json','w') as f: 147 | json.dump(self.following,f,ensure_ascii=False,indent=4) 148 | 149 | 150 | 151 | def unfollow_following(self): 152 | self.following = {} 153 | self.find_following() 154 | d1 = datetime.datetime.now() 155 | 156 | for account in self.following: 157 | if account not in self.special: 158 | day1 = self.following[account]['day'] 159 | month1 = self.following[account]['month'] 160 | year1 = self.following[account]['year'] 161 | d2 = datetime.datetime(day=day1,month=month1,year=year1) 162 | days = (d1-d2).days 163 | if days >= 3: 164 | self.unfollow_account(account) 165 | 166 | def automate(self): 167 | while True: 168 | t1 = time.time() 169 | self.followers = [] 170 | self.following = {} 171 | self.check_accounts() 172 | self.unfollow_followed_ones() 173 | self.unfollow_following() 174 | 175 | 176 | new_loop = True 177 | while new_loop: 178 | t2 = time.time() 179 | if t2 - t1 >= 3600: 180 | new_loop = False 181 | 182 | if __name__ == "__main__": 183 | github_bot = GitHubBot() 184 | github_bot.automate() 185 | --------------------------------------------------------------------------------