How to post images with bot, WITHOUT using Twitter API?

INauCkeL

Junior Member
Joined
Jul 24, 2023
Messages
112
Reaction score
30
I'm developing a Twitter bot using Selenium and C# without the Twitter API, aiming to post tweets with text and image URLs.

However, Twitter doesn't display an image preview when I paste the URL directly into the tweet.

My workaround — downloading the image and using the file open dialog — is cumbersome, and I didn't develop it yet.

Is there a more efficient method to ensure Twitter previews the image from the URL, or any alternative approach to automate image posting on Twitter through Selenium and C#?
 
if you want to just use twitterdub. doesn't use the API
 
Yeah, getting a custom bot that does that without APIs is a little tedious compared to just using Twitterdub for it. See if that's a good fit for you.
 
Hi, I use python, hope following code can help, no need to open file with opendialog


bot.get("https://twitter.com/home")

actions = ActionChains(bot)


editor = bot.find_element(By.XPATH,"//div[@role='textbox']") #send_keys(tweetBody)
editor.send_keys(tweetBody)


img_ele = bot.find_elements(By.XPATH,"//input[@class='r-8akbif r-orgf3d r-1udh08x r-u8s1d r-xjis5s r-1wyyakw']")[0]
img_ele.send_keys(video_path)
 
Back
Top