Automatically login to twitter with this python command

--

In this article, we will see how to login to twitter without writing selenium code. We will use bot-studio. We can use either credentials or cookies to login. Following are the steps to move with this:-

  1. Install bot-studio
pip install bot-studio

2. Import bot-studio

from bot_studio import *

3. Create twitter object, which will open automated chrome browser for twitter.

twitter=bot_studio.twitter()

4. Login to twitter through credentials

5. Login to twitter through cookies. You can get cookies from Edit this Cookie Chrome Extension in simple steps:-

>Add this extension to chrome.

>Open twitter and log in.

>Click on extension icon, then click on export cookies.

>Now cookies will be copied to clipboard , replace list of cookies in above code with these copied cookies.

--

--