fa0311 / twitter-openapi-typescript

Implementation of Twitter internal API (Twitter graphql API) in TypeScript
https://www.npmjs.com/package/twitter-openapi-typescript
Other
73 stars 11 forks source link

How to quote a tweet? #85

Closed darkmasta closed 1 month ago

darkmasta commented 9 months ago

How can we quote a tweet instead of retweeting? It would be nice if you added this feature too. 🙏🙏

image

darkmasta commented 9 months ago

I figured out how to do it...

fa0311 commented 9 months ago

This is currently not supported But you may be able to do it by using extraParam and specifying attachment_url.

darkmasta commented 9 months ago

This solved my problem. I am able to quote a tweet this way.

const tweetUrl = `https://twitter.com/elonmusk/status/1748595664131363231`;
const status = `HELLO QUOTE TWEET ${tweetUrl}`;

const response = await client.getPostApi().postCreateTweet({
  tweetText: status,
  mediaIds: [],
})
fa0311 commented 9 months ago

This solved my problem. I am able to quote a tweet this way.

The Twitter API v2 implemented quote RT in the same way, but the current GraphQL client seems to implement it differently. I don't know why the v2 way of writing works fine for graphQL endpoints.

darkmasta commented 9 months ago

The Twitter API v2 implemented quote RT in the same way, but the current GraphQL client seems to implement it differently. I don't know why the v2 way of writing works fine for graphQL endpoints.

I am not sure but they extract info from tweet text and update the tweet with that info. You can post an image url from twitter and it becomes tweet media as well. There is a tweet text processing going on.