Giter Club home page Giter Club logo

twauto's People

Contributors

ekozkan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

twauto's Issues

getting errors while tw.login()

twAuto Error: Message: Service /data/user/0/ru.iiec.pydroid3/app_HOME/.wdm/drivers/chromedriver/linux64/114.0.5735.90/chromedriver unexpectedly exited. Status code was: 1

twAuto.driver.get - AttributeError: 'NoneType' object has no attribute 'get'

Hello there,

I've been using twAuto for some months now and It was working perfectly, however I'm bumping my head against a wall since I reainstalled my OS (W10 2H22)
Basically since 3 days ago I'm getting this same error:

C:\Users\TwitterCookies>py cookiecreator.py
Traceback (most recent call last):
File "C:\Users...\cookiecreator.py", line 13, in
tw.manualCookieCreation()
File "C:\Users...\Python311\Lib\site-packages\twAuto\twauto.py", line 145, in manualCookieCreation
twAuto.driver.get("https://twitter.com/login")
^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

I have tried to run it in other devices, same thing,
tried uninstalling and reinstalling several different versions of python, chrome and chromedrivers, same with selenium and the other dependencies. I'm out of ideas, even checked all the posible solutions chatGPT offered and unsurprisingly didn't changed a thing in the end results.

AttributeError: 'NoneType' object has no attribute 'get'
image
my twAuto version is the latest
Chrome is up to date
Version 114.0.5735.134 (Official Build) (64-bit)
Python 3.11 (64-bit)

I'm out of ideas. Tried in Linux Ubuntu 22.04.2 too, same error.
AttributeError: 'NoneType' object has no attribute 'get'

cannot tweet image (linux)

Tried this on linux and can tweet text ok, but if I try to also tweet an image it gives me this error:

twAuto Error:  Message: element click intercepted: Element <div role="button" tabindex="0" class="css-18t94o4 css-1dbjc4n r-l5o3uw r-42olwf r-sdzlij r-1phboty r-rs99b7 r-19u6a5r r-2yi16 r-1qi8awa r-1ny4l3l r-ymttw5 r-o7ynqc r-6416eg r-lrvibr" data-testid="tweetButton">...</div> is not clickable at point (871, 818). Other element would receive the click: <div class="css-1dbjc4n r-1p0dtai r-1d2f490 r-1xcajam r-zchlnj r-ipm5af"></div>
  (Session info: chrome=110.0.5481.177)

When I try with headless = False I can see the image has been uploaded into the page but it seems to fail at the last step of pressing the tweet button. Any idea what could be causing this?

when try tw.start(), errors occured(after try getting cookies manually)

the error :"//*[@id='layers']/div/div/div/div/div/div/div[2]/div[2]/div/div/div[2]/div[2]/div[1]/div/div/div[3]/div/label/div/div[2]/div[1]/input"

is it because the twitter login page changed?

my code below:

tw = twAuto.twAuto(...
chromeDriverMode="auto",
driverPath=...,
pathType="testId",
headless=True,
debugMode= True)

tw.start()

Use @data-testid instead of verbose xPaths

Hey ! Thank you so much for making this client ! This will help me circumvent the Twitter API ban and keep my bot alive :)
I played a bit with it in order to make it work on Linux and tweak it to my needs.

One things noticed is that some selectors are not working properly : unfortunately, Twitter has a habit of breaking their dom structure and class ids. I suggest you use selectors based on the data-testid field, which is pretty reliable in the long term, you should be able to avoid most breaking changes with it. Example :

                body_element = container_element.find_element(XPATH, './/div[3]/div[7]/div/div[2]/div')

became

                body_element = container_element.find_element(XPATH, '//*[@data-testid="retweet"]')

Don't know if this is related to this change, but body_element.click() would not work afterward, so I used twAuto.driver.execute_script("arguments[0].click()", body_element) instead.

Glad I found your project ! Thanks again for your work :)

Can't send text with emojis (ChromeDriver only supports characters in the BMP)

So there's a known issue where the ChromeDriver isn't able to send emojis via keys.

image

The workaround is to either use the Firefox driver instead...

Or better yet, someone came up with a solution to copy the emoji text to the clipboard and then paste it into the field while still using Chrome. Below is the SO link with the sample code. I think it would be really useful to implement into twAuto ๐Ÿ‘Œ

https://stackoverflow.com/a/72473110/617909

Add config to set your own path for the Chromedriver.exe

I always have my chromedriver.exe in a single location on my server for multiple applications to use the same executable. It would be helpful to add an extra config to allow us to specify a path to it instead of forcing to place it in the same dir as the script. ๐Ÿ‘

Contribution

Hello, Is this project open to contributions? If so how would you like this done.

Thank you

Unable to Like,Tweet or Retweet after Logging In

Hello,

First, here is my code:

python
Copier le code
import twAuto

tw = twAuto.twAuto(
username="",
email="",
password="",
chromeDriverMode="manual",
driverPath="chromedriver.exe",
pathType="xPath",
headless=False,
debugMode=True,
createCookies=False
)

tw.start()
tw.login()
print("Logged in")
tw.like(url="https://x.com/elonmusk/status/1809251925306777944")
print("Retweeted")
tw.close()

I can log in successfully using the tw.manualCookieCreation() function. However, when I launch the code with headless=False, I see that it logs in correctly, navigates to the tweet page, and then nothing happens.

Here is the output when I close the window:

less
Copier le code
twAuto started.
Starting twAuto...
Using Chrome Driver from the path: chromedriver.exe
Successfully Logged In
Logged in
twAuto Error: Message: no such window: target window already closed
from unknown error: web view not found
(Session info: chrome=126.0.6478.127)
Stacktrace:
GetHandleVerifier [0x00007FF61B24EEA2+31554]
(No symbol) [0x00007FF61B1C7ED9]
(No symbol) [0x00007FF61B08872A]
(No symbol) [0x00007FF61B05D995]
(No symbol) [0x00007FF61B1044D7]
(No symbol) [0x00007FF61B11C051]
(No symbol) [0x00007FF61B0FCDD3]
(No symbol) [0x00007FF61B0CA33B]
(No symbol) [0x00007FF61B0CAED1]
GetHandleVerifier [0x00007FF61B558B1D+3217341]
GetHandleVerifier [0x00007FF61B5A5AE3+3532675]
GetHandleVerifier [0x00007FF61B59B0E0+3489152]
GetHandleVerifier [0x00007FF61B2FE776+750614]
(No symbol) [0x00007FF61B1D375F]
(No symbol) [0x00007FF61B1CEB14]
(No symbol) [0x00007FF61B1CECA2]
(No symbol) [0x00007FF61B1BE16F]
BaseThreadInitThunk [0x00007FFE0C88257D+29]
RtlUserThreadStart [0x00007FFE0E10AF28+40]

Retweeted

Do you know what could be causing this issue?

Thank you for your help!

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.