DEV Community

Ichi
Ichi

Posted on

3

"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!

Image of Datadog

Learn how to monitor AWS container environments at scale

In this eBook, Datadog and AWS share insights into the changing state of containers in the cloud and explore why orchestration technologies are an essential part of managing ever-changing containerized workloads.

Download the eBook

Top comments (1)

Collapse
 
mb_hasan_7a57f34b923da1b3 profile image
Mb Hasan

123456789

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More