Socket
Socket
Sign inDemoInstall

twitter-openapi-typescript

Package Overview
Dependencies
1
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    twitter-openapi-typescript

Implementation of Twitter internal API in TypeScript


Version published
Weekly downloads
367
increased by439.71%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

twitter-openapi-typescript

Setup

npm i twitter-openapi-typescript

Usage

import { TwitterOpenApi } from 'twitter-openapi-typescript';

const api = new TwitterOpenApi();
const client = await api.getGuestClient();
const response = await client.getUserApi().getUserByScreenName({ screenName: 'elonmusk' });
console.log(response.data.legacy.screenName);
console.log(`followCount: ${response.data.legacy.friendsCount} followersCount: ${response.data.legacy.followersCount}`);

Login

// ct0 and authToken will also work but it is recommended to set all cookies.
const client = await api.getClientFromCookies({
  ct0: '<csrf_token>',
  auth_token: '<auth_token>',
});

List of APIs

You should read the Test case. aaaaa

https://github.com/fa0311/twitter-openapi-typescript/tree/master/twitter-openapi-typescript/test/api

Customize in detail

Most values exist as static variables. There is no need to change them.

import { TwitterOpenApi } from 'twitter-openapi-typescript';
TwitterOpenApi.url = 'twitter-openapi placeholder json url';
TwitterOpenApi.twitter = 'twitter first access url';
TwitterOpenApi.userAgent = 'user agent';
TwitterOpenApi.bearer = 'bearer token';
TwitterOpenApi.browser_headers = 'browser headers';
TwitterOpenApi.api_key = 'api key';

License

This project is dual licensed. You can choose one of the following licenses:

Keywords

FAQs

Last updated on 28 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc