DEV Community

Ichi
Ichi

Posted on

"Twitter for xxx" disappeared, so I created Check Tool

Hi dev.
Recently, Twitter's tweet page no longer shows the origin of tweets such as "Twitter for Android," "Twitter for iOS," and "Twitter Web App," which previously existed.

Image description

But if you use Twitter API, you can get it. So I created a mini-tool to make that available to everyone.

▼You can try it now :D
https://tools.ic731.net/twitter/for/en

Image description

(note) It seems that some environments can see it and some can't.

About API

In this case, I used Twitter API v2 with PHP, which extract tweet ID from URL and throw a GET request to /2/tweets.

For API operations, I used well-known library abraham/twitteroauth.
So, please note that setApiVersion("2") is required to use v2.

$connection = new TwitterOAuth($ck, $cs, null, $brarer);
$connection->setApiVersion("2");
$id = '123456789';
$params = [
  "ids" => $id,
  "tweet.fields" => "source"
];
// GET
$tweets = $connection->get("tweets", $params);
Enter fullscreen mode Exit fullscreen mode

And "Twitter for xxx", which is the key this time, is stored in $tweets->data[0]->source. That's all for this simple application. Please try it!

Top comments (1)

Collapse
 
mb_hasan_7a57f34b923da1b3 profile image
Mb Hasan

123456789