JSPM

  • Created
  • Published
  • Downloads 2027
  • Score
    100M100P100Q111930F
  • License custom license or AGPL-3.0-or-later

Implementation of Twitter internal API in TypeScript

Package Exports

  • twitter-openapi-typescript
  • twitter-openapi-typescript/dist/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (twitter-openapi-typescript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

twitter-openapi-typescript

Setup

npm i twitter-openapi-typescript

Usage

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

  const api = new TwitterOpenApi();
  const client = await api.getClient();
  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}`);

Node.js

  import fetch from "node-fetch";
  const api = new TwitterOpenApi({ fetchApi: fetch as any });

Login

  const client = await api.getClientFromCookies('<csrf toke here>', '<auth token here>');

List of APIs

You should read the Test case.

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

License

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