aboutsummaryrefslogtreecommitdiff
path: root/lib/TwitterClient.php
diff options
context:
space:
mode:
authorGravatar csisoap <33269526+csisoap@users.noreply.github.com> 2023-09-06 21:14:11 +0700
committerGravatar GitHub <noreply@github.com> 2023-09-06 16:14:11 +0200
commitdbe37cc302bec84f622fbd65aa88690b0d946521 (patch)
tree553d03c5cc39e40c75341256b5a18887f7583139 /lib/TwitterClient.php
parent52b90e0873e56e55b39c4379748f54d55e46248e (diff)
downloadrss-bridge-dbe37cc302bec84f622fbd65aa88690b0d946521.tar.gz
rss-bridge-dbe37cc302bec84f622fbd65aa88690b0d946521.tar.zst
rss-bridge-dbe37cc302bec84f622fbd65aa88690b0d946521.zip
[TwitterBridge] Filter out any promoted tweet (#3652)
* Filter out any advertise tweet * Make some filter work, fix bug that may happen with tweet id list. * clear phpcs warning, ignore line length warning
Diffstat (limited to 'lib/TwitterClient.php')
-rw-r--r--lib/TwitterClient.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/TwitterClient.php b/lib/TwitterClient.php
index d2a09fdd..20f21482 100644
--- a/lib/TwitterClient.php
+++ b/lib/TwitterClient.php
@@ -146,9 +146,14 @@ class TwitterClient
}
if (isset($timeline->data->user)) {
- if (!isset($entry->content->itemContent->tweet_results->result->legacy)) {
+ if (!isset($entry->content->itemContent->tweet_results->result)) {
continue;
}
+
+ if (isset($entry->content->itemContent->promotedMetadata)) {
+ continue;
+ }
+
$tweets[] = $entry->content->itemContent->tweet_results->result;
$userIds[] = $entry->content->itemContent->tweet_results->result->core->user_results->result;
@@ -156,6 +161,12 @@ class TwitterClient
if (!isset($entry->content->content->tweetResult->result->legacy)) {
continue;
}
+
+ // Filter out any advertise tweet
+ if (isset($entry->content->content->tweetPromotedMetadata)) {
+ continue;
+ }
+
$tweets[] = $entry->content->content->tweetResult->result;
$userIds[] = $entry->content->content->tweetResult->result->core->user_result->result;