Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TwitterBridge] Improve timeline processing for username mode #1946

Merged
merged 6 commits into from
Apr 12, 2021

Conversation

fivefilters
Copy link
Contributor

Currently when returning results for a twitter username ('By username' mode in RSS Bridge), quoted tweets don't appear to be handled very well. Here's an example from Glenn Greenwald's Twitter timeline:

A retweet of a quoted tweet

This appears as two tweets in the RSS Bridge output, which suggests he retweeted the main tweet and the inner quoted tweet separately:

RSS Bridge produces two tweets for the single retweet

The problem is also there in a regular quoted tweet by the same user (the quoted tweet appears as a separate entry in the list of results).

I had a look at Nitter's parser and noticed they use the timeline property of the global data object to pick out tweets, which seems to avoid this problem. So this change does something similar when in username mode.

It might be worth doing the same for the other modes, but I haven't tested in those modes much, so for now it defaults to the previous behaviour if not in 'By username' mode.

@fivefilters
Copy link
Contributor Author

Also noticed that enabling 'no retweets' often produced zero results if the account had retweeted a lot after posting something original. Those original tweets could easily be missed by an RSS reader.

This latest change switces to the search endpoint when 'no retweets' is enabled, resulting in the following query:

from:username exclude:retweets

I also noticed the 'no replies' checkbox has no effect at the moment (it's not referred to again in the code). This change appends 'exclude:replies' if it's enabled, e.g.

from:username exclude:retweets exclude:replies

akirk added a commit to akirk/rss-bridge that referenced this pull request Feb 15, 2021
Copy link
Contributor

@em92 em92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @fivefilters ! Sorry for the long delay.
In general I could not understand the problem that this PR solves.

bridges/TwitterBridge.php Show resolved Hide resolved
@em92
Copy link
Contributor

em92 commented Mar 25, 2021

What I see? Glen retweeted Jake's tweet. Jake's tweet appears in feed, in author Glen was added as a "retweeter". And I don't find anything wrong here.

@fivefilters
Copy link
Contributor Author

Hi @em92, no problem. Will try to explain a little better.

What I see? Glen retweeted Jake's tweet. Jake's tweet appears in feed, in author Glen was added as a "retweeter". And I don't find anything wrong here.

There's nothing wrong there. Glenn did retweet Jake's tweet. But notice that Jake's tweet ends with a link to another tweet, that's the tweet below it in my screenshot (by Acyn Torabi). The problem is that that tweet (by Acyn) was not retweeted by Glenn (RSS Bridge shows it as retweeted: "RT: @ggreenwald"). So that tweet by Acyn Torabi, shouldn't be returned.

It's in the JSON results that Twitter returns becuase Jake's tweet, the one Glenn retweeted, referred to it (Jake's tweet is what Twitter calls a "quote tweet" - a tweet quoting another tweet). But RSS Bridge shouldn't be returning it as something Glenn retweeted. This is handled correctly by Nitter, but not by RSS Bridge.

When I looked into it, I saw that the large JSON object that both RSS Bridge and Nitter use to return tweets, has two tweet sections. The large tweet section that RSS Bridge uses to pull tweets from ($data->globalObjects->tweets) contains not just the desired tweets, but all connected tweets. That's why Acyn's tweet appears here, even though it wasn't retweeted by Glenn.

There's another section in the same JSON object which lists the tweets that should appear for the user ($data->timeline->instructions[0]->addEntries->entries), this is what Nitter uses to determine which tweets to display, and what the modified code I submitted does for RSS-Bridge too.

If you find a Twitter user that has retweeted a quote tweet, I think the problem will be easier to see. If I come across one, I'll post another comment with another example.

@em92 em92 merged commit 76c3833 into RSS-Bridge:master Apr 12, 2021
@em92
Copy link
Contributor

em92 commented Apr 12, 2021

Thanks for explanation @fivefilters!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants