Twitter-Unofficial-API

Twitter Unofficial API

Available Languages: 🇺🇸 🇹🇷

Twitter Unofficial API is a library that can be easily integrated into websites and applications.

The Twitter API allows users to log in quickly and securely with their Twitter account. In just a few simple steps, users can access their accounts.

The Twitter Login API gives the user the opportunity to log in to Twitter. If extra information is requested, the user can also provide it.

For example, they ask users to pass extra security steps called “checkpoints”. The Unofficial Twitter API takes these situations into account and allows users to complete the login process without any problems.

Finally, once a user has successfully logged in, the library retrieves “cookie” data from the logged-in user’s account. This information can be used for the user to take action.

Introduction to Twitter Library

A versatile runtime environment, Node.js gives developers the ability to build scalable and efficient web applications.

By leveraging JavaScript, developers can harness the power of asynchronous programming, making it an ideal choice for managing network requests and API integrations.

Our Twitter API aims to encapsulate the intricacies of interacting with Twitter by providing a simplified interface for developers to seamlessly perform various actions.

Getting Started

To kickstart the development process, ensure you have Node.js installed on your system. You can download it from the official Node.js website or use a package manager like npm (Node Package Manager) to install it.

Installation

$ npm i twitter-unofficial-api
$ bun i twitter-unofficial-api
$ pnpm i twitter-unofficial-api

How to import

const { Twitter } = require('twitter-unofficial-api');
const { HttpsProxyAgent } = require('https-proxy-agent');
const sleep = (t) => new Promise((s) => setTimeout(s, t));

Login with Twitter

async function login() {

    const twitterFlow = new Twitter();

    twitterFlow.tProxy = new HttpsProxyAgent('http://proxy_username:proxy_password@proxy_ip:proxy_port');

    await sleep(10000);

    await twitterFlow.login_flow();

    let loginSuccess = false;

    const username = 'your twitter username';
    const password = 'your twitter password';
    const mail = 'your twitter mail';

    while (loginSuccess == false) {
        console.log(await twitterFlow.get_subtask_ids());

        if (await twitterFlow.get_subtask_ids().includes('LoginJsInstrumentationSubtask')) {
            await twitterFlow.LoginJsInstrumentationSubtask();
        }
        else if (await twitterFlow.get_subtask_ids().includes('LoginEnterUserIdentifierSSO')) {
            await twitterFlow.LoginEnterUserIdentifierSSO(username);
        }
        else if (await twitterFlow.get_subtask_ids().includes('LoginEnterUserIdentifier')) {
            await twitterFlow.LoginEnterUserIdentifier(username);
        }
        else if (await twitterFlow.get_subtask_ids().includes('LoginEnterPassword')) {
            await twitterFlow.LoginEnterPassword(password).catch(async (error) => {
                if (error.response?.data?.errors?.[0]?.message == 'Wrong password!') {
                    console.log('Wrong password');
                    loginSuccess = true;
                }
            })
        }
        else if (await twitterFlow.get_subtask_ids().includes('AccountDuplicationCheck')) {
            await twitterFlow.AccountDuplicationCheck().then((response) => {
                if (response?.content?.subtasks[0].enter_text?.hint_text == 'Verification Code') {
                    console.log('Verification code required!');
                }
            })
        }
        else if (await twitterFlow.get_subtask_ids().includes('LoginEnterAlternateIdentifierSubtask')) {
            {
                await twitterFlow.LoginEnterAlternateIdentifierSubtask(mail).catch(err => {
                    console.log('Alternate login email is incorrect: ' + username, ':', password);
                    console.log('-------------------------------------');
                    loginSuccess = true;
                })

            }
        }

        else if (await twitterFlow.get_subtask_ids().includes('LoginAcid')) {

            await twitterFlow.LoginAcid('YOUR CHECKPOINT CODE HERE').catch(err => {
                console.log('ACCOUNT CHECKPOINT MAIL CONFIRMATION: ' + err.response.data.errors[0].message + ' -> ' + username, ':', password);
                console.log('-------------------------------------');
                loginSuccess = true;
            })

        }
        else if (await twitterFlow.get_subtask_ids().includes('SuccessExit')) {
            await twitterFlow.successExit().then((result) => {
                loginSuccess = true;
                console.log('------------------------------');
                console.log('CT0: ' + twitterFlow.ct0);
                console.log('------------------------------');
                console.log('COOKIE:' + twitterFlow.cookie);
                console.log('------------------------------');
            }).catch((err) => {
                loginSuccess = true;
                console.log(err);
            });
        }
    }
} login()

Keywords

Twitter, Twitter API, Twitter Unofficial API, Unofficial Twitter API, Twitter Login API, X API, X Unofficial API, Unofficial X API, X Login API, twitter api in typescript, twitter api in javascript, twitter api in nodejs, twitter api for students, twitter api client-not-enrolled, twitter api data collection, twitter api authentication, twitter api javascript sdk, twitter api typescript sdk, twitter api nodejs sdk, twitter api enterprise pricing, twitter api bearer token, twitter api get replies, twitter api for academic research, twitter api cost, twitter api help, twitter api client forbidden, twitter api impressions, twitter api get tweets, twitter api delete tweet, twitter api analytics, twitter api javascript authentication, twitter api typescript authentication, twitter api nodejs authentication, twitter api expensive, twitter api block user, twitter api historical data, twitter api fees, twitter api consumer key, twitter api issues, twitter api dashboard, twitter api alternative, twitter api json, twitter api error codes, twitter api basic, twitter api key price, twitter api get tweets by hashtag, twitter api free limits, twitter api bad authentication data, twitter api hashtag count, twitter api in r, twitter api github, twitter api callback url, twitter api documentation javascript, twitter api documentation typescript, twitter api documentation nodejs, twitter api access levels, twitter api javascript example, twitter api typescript example, twitter api nodejs example, twitter api education, twitter api bot, twitter api hashtag, twitter api followers, twitter api client, twitter api integration, twitter api developer account, twitter api access, twitter api endpoints, twitter api oauth, twitter api key and secret, twitter api get following list, twitter api free, twitter api block, twitter api html, twitter api image, twitter api fetch tweets, twitter api create tweet, twitter api down, twitter api access cost, twitter api json example, twitter api enterprise, twitter api basic plan, twitter api get user id from username, twitter api for developers, twitter api http, twitter api developer, twitter api example, twitter api access token, twitter api key, twitter api get user info, twitter api engagement, twitter api bearer token not working, twitter api health, twitter api id, twitter api for posting tweets, twitter api dataset, twitter api academic, twitter api java examples, twitter api explorer, twitter api bookmarks, twitter api golang, twitter api for sentiment analysis, twitter api changes, twitter api hootsuite, twitter api get followers, twitter api documentation, twitter api interface, twitter api dev, twitter api alternative reddit, twitter api get tweets by user, twitter api basic access, twitter api headers, NodeJS Developer, Back-end Developer, Node.JS Developer, Backend Developer

Github Patreon BuyMeaCoffee
Copyright: [email protected]  Other Issues: [email protected]

Social Media

Linkedin Twitter Bluesky Instagram Youtube Telegram Github Npmjs

License

Can Yesilyurt cy4udev