|
#1
|
||||
|
||||
Twitter auto upload bot
First a quick test script to grab something to upload to twitter
Obviously this can be anything u want PHP Code:
You will need to install selenium and mariadb using pip3 and geckodriver web drivers Code:
# Module Imports import mariadb import sys import os from datetime import datetime from time import sleep from tqdm import tqdm TWIT_PASS = pasw TWIT_USER = user def prog(SL, TX): for i in tqdm(range(4)): sleep(SL) else: print("\n") print(TX) # Connect to MariaDB Platform try: conn = mariadb.connect( user="root", password="", host="localhost", port=3306, database="news2" ) except mariadb.Error as e: print(f"Error connecting to MariaDB Platform: {e}") sys.exit(1) # Get Cursor cur = conn.cursor() def sel(FUNC_LINK, FUNC_GUID): from selenium.webdriver.firefox.options import Options as FirefoxOptions from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait options = FirefoxOptions() options.add_argument("--headless") sleep(3) driver = webdriver.Firefox(options=options) driver.get("https://twitter.com/login") sleep(5) driver.find_element_by_name("session[username_or_email]").send_keys(TWIT_USER) sleep(4) driver.find_element_by_name("session[password]").send_keys(TWIT_PASS) sleep(4) driver.find_element_by_xpath( '//*[@id="react-root"]/div/div/div[2]/main/div/div/div[2]/form/div/div[3]/div/div/span/span' ).click() sleep(3) driver.get("https://twitter.com/compose/tweet") sleep(5) driver.find_element_by_xpath( '//*[@id="layers"]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div[1]/div/div/div/div/div/div/div/div/div/div[1]/div/div/div/div[2]/div' ).send_keys(FUNC_LINK) # driver.find_element_by_xpath('//*[@id="layers"]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div[1]/div/div/div/div/div/div/div/div/div/div[1]/div/div/div/div[2]/div').send_keys(FUNC_LINK) sleep(3) driver.find_element_by_xpath( '//*[@id="layers"]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div[4]/div/div/div[2]/div/div/span/span' ).click() sleep(3) # self.driver = webdriver.Firefox(firefox_profile=profile, log_path='./home/firefly/Documents/geckodriver.log') driver.get("https://twitter.com/logout") sleep(3) driver.find_element_by_xpath( '//*[@id="layers"]/div[2]/div/div/div/div/div/div[2]/div[2]/div[3]/div[2]/div/span/span' ).click() sleep(3) cur.execute( "INSERT INTO checkdupe (guid,added) VALUES (?, ?)", (FUNC_GUID, datetime.now()) ) conn.commit() prog(3, "Logging out from Twitter") driver.stop_client() driver.close() os.system("pkill -f firefox") driver.quit() cur.execute("SELECT guid FROM feed ORDER BY id DESC LIMIT 1") last_id1 = cur.fetchone() for lastID1 in last_id1: # print(lastID1) VAR1 = lastID1 cur.execute("SELECT guid FROM checkdupe ORDER BY id DESC LIMIT 1") last_id2 = cur.fetchone() for lastID2 in last_id2: # print(lastID2) VAR2 = lastID2 if VAR1 != VAR2: cur.execute("SELECT id,name,link,guid FROM feed ORDER BY id DESC LIMIT 1") # Print Result-set for (id, name, link, guid) in cur: VAR_ID = id VAR_NAME = name VAR_LINK = link VAR_GUID = guid prog(3, "Posting {VAR_NAME} to twitter.") sel(VAR_LINK, VAR_GUID) elif VAR1 == VAR2: print("Dupe entry: Halt!")
__________________
Please Support Majority Report You can contact me on Skype live:phesadent.elect but please let me know first. If you are ever need me desperately then please email me at dan.oak44@gmail.com and I will contact u within a week. Due to free time I'm able to help interested member's with their tracker. Please Note! Depending on your requests I will charge you for my assistance for Tracker installs and mods. All my mods are custom and prices will very depending on the request. I'm able to install any tracker and mods including themes. Please PM me |
|
|