Giter Club home page Giter Club logo

twauto's Introduction

twAuto - Twitter Automation Tool v0.3.4 ๐Ÿฆ†

twAuto is a library for "Tweeting", "Retweeting", "Replying", "Tweet Quoting", "Tweet Liking" without any API requirements using Selenium.


Note: While using this library I didnt encounter any problems/bad response from Twitter like banning account etc. but please use at your own risk.

Requirements

Installation

Pip:

pip3 install twAuto

Functions

- Import:

import twAuto

- Configure:

tw = twAuto.twAuto(
  username="Your Twitter Username",
  email="Your Twitter E-Mail",
  password="Your Twitter Password",
  chromeDriverMode="manual" or "auto", #if you use auto twAuto will automatically download the chrome driver for you,
                                       #if you use the manual option, you need to provide the driver path in driverPath parameter.
  driverPath="your drivers path", #use only if you are using the chromeDriverMode in manual mode 
  pathType="testId" or "xPath", #It is xPath by default. I highly recommend you to use testId instead of xPath. If you had any problems with library you can try the xPath mode too.
  headless=True/False, #Headless is true by default.
  debugMode= True/False #Really poorly implemented debug mode, this is for reading occured errors.
                        #It is not reliable right now but you can give it a try if you want to.
)

- Start: Start functions runs the selenium driver.

tw.start()

- Login: Logs in to the Twitter account

tw.login()

- Login Errors: If you encounter any errors in the login process, you can use manualCookieCreation() to get your cookie file manually. Run the function after tw.start() line. Then after the browser window opened, login to account you want to automate, then enter any character in the terminal. This will create a cookie file after this, you can use the library.

Note: Headless must be False to use this function.

tw.manualCookieCreation()

Example:

First run this code to get your cookie file.

tw = twAuto.twAuto(
  username="Your Twitter Username",
  email="Your Twitter E-Mail",
  password="Your Twitter Password",
  chromeDriverMode="auto",
  pathType="xPath",
  headless=False #Headless must be False to use this function.
)

tw.start()
tw.manualCookieCreation()

After doing the steps that is described above, you can run your main code.

tw = twAuto.twAuto(
  username="Your Twitter Username",
  email="Your Twitter E-Mail",
  password="Your Twitter Password",
  chromeDriverMode="auto",
  pathType="xPath"
)

tw.start()
tw.login()
#other functions...

- Like: Likes tweet in the given url
->Returns: True/False as Success/Failed

tw.like(url="")

- Reply: Replies to the tweet in the given url with given text.
->Returns: Reply URL/False

tw.reply(url="", imgpath="", text="")

- Tweet: Tweets the text and image if given.
->Returns: Tweet URL/False

tw.tweet(text="",imgpath="")

- Quote Tweet: Quotes the tweet in the given url with the given text.
->Returns: Quoted Tweet URL/False

tw.quoteTweet(url="", imgpath="" ,text="")

- Retweet: Retweets the tweet in the given url.
->Returns: True/False as Success/Failed

tw.retweet(url="")

- Unretweet: Unretweets the tweet in the given url.
->Returns: True/False as Success/Failed

tw.unretweet(url="")

- Logout: Logs out from current Twitter account and deletes the cookies file.

tw.logout()

- Quit/Close: Ends the session, closes the selenium driver application

tw.close()

Example Code

tw = twAuto.twAuto(
  username="",
  email="",
  password="",
  headless=True,
  chromeDriverMode="auto",
  pathType="testId")

tw.start()
tw.login()

tw.reply(url="",imgpath="", text="")

tw.close()

To Do's ๐Ÿ“ :

  • Send image with Quote, Reply.
  • Send gif with Quote, Reply.
  • Retweet without adding url at the end.
  • Linux integration(not tested yet).

twauto's People

Contributors

ekozkan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.