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] Add support for OAuth authorization. #3628

Merged
merged 13 commits into from
Aug 29, 2023

Conversation

csisoap
Copy link
Contributor

@csisoap csisoap commented Aug 21, 2023

[TwitterClient]

  • Add OAuth authorization header.
  • Add new endpoint for user tweet.
  • Use GraphQL API instead of search for user tweet.
  • User, List Timeline and Search now using OAuth header.

[TwitterBridge]

  • Make some changes.

NOTE: This latest change requires you to get the guest account to generate OAuth headers in order to use the bridge. Detail about how to get it is on zedeus/nitter#issuecomment-1681199357. After that, put it on the TwitterClient file and you will be good to go. Also it's not recommended to use one guest account for larger instance, i saw nitter use a lot of guest accounts over there to handle large requests.

- Add OAuth authorization header.
- Add new endpoint.
- Make some changes to support new endpoint.
@csisoap csisoap marked this pull request as draft August 21, 2023 16:14
@github-actions
Copy link

github-actions bot commented Aug 21, 2023

Pull request artifacts

file last change
TwitterBridge-current-context1 2023-08-22, 15:51:37
TwitterBridge-current-context2 2023-08-22, 15:51:37
TwitterBridge-current-context3 2023-08-22, 15:51:37
TwitterBridge-current-context4 2023-08-22, 15:51:37
TwitterBridge-pr-context1 2023-08-22, 15:51:37
TwitterBridge-pr-context2 2023-08-22, 15:51:37
TwitterBridge-pr-context3 2023-08-22, 15:51:37
TwitterBridge-pr-context4 2023-08-22, 15:51:37

@dvikan
Copy link
Contributor

dvikan commented Aug 22, 2023

as i understand it, just a few days ago the twitter bridge broke? is that correct? pls give summary update

@csisoap
Copy link
Contributor Author

csisoap commented Aug 22, 2023

as i understand it, just a few days ago the twitter bridge broke? is that correct? pls give summary update

yes, it broke again. Some endpoint no longer work or output only most liked tweet when using guest token so I have to find a new way. Luckily, there are people at nitter find out how to get it working with guest account. You can see how to generate it at the link on the top. Also it's not feasible for larger instance to implement this with single guest account, nitter have to use a lot of guest account to make it work for larger userbase.

@dvikan
Copy link
Contributor

dvikan commented Aug 22, 2023

sorry your pr confuses me a bit.

are you trying to preserve the old method? (which is broken)

also please remove all code which is no longer in use

@csisoap
Copy link
Contributor Author

csisoap commented Aug 23, 2023

are you trying to preserve the old method? (which is broken)

What do you mean about old method? Do you refer to guest token or graphql api?

@dvikan
Copy link
Contributor

dvikan commented Aug 23, 2023

think i mean the graphql api urls changing

@csisoap
Copy link
Contributor Author

csisoap commented Aug 23, 2023

think i mean the graphql api urls changing

I change the graphql api for fetchTimeline function to make it work with OAuth authorization. The consumer key i use to make OAuth is from Android and the old graphql api is from the web so it will not work with OAuth i created.

About earlier question - i think yes. I still use graphql api to fetch tweet.

@dvikan dvikan marked this pull request as ready for review August 29, 2023 15:14
@dvikan dvikan merged commit 4d05d0b into RSS-Bridge:master Aug 29, 2023
@dvikan
Copy link
Contributor

dvikan commented Aug 29, 2023

merging without testing this. hope it works

@csisoap csisoap deleted the twitter branch September 6, 2023 03:43
@thomas-333
Copy link
Contributor

I can confirm that this is working.

However is it possible to add the tokens to config.ini.php instead as otherwise if TwitterClient.php if updated things may break.

dvikan pushed a commit to dvikan/rss-bridge that referenced this pull request Sep 13, 2023
* Update TwitterClient.php

- Add OAuth authorization header.
- Add new endpoint.

* Update TwitterBridge.php

- Make some changes to support new endpoint.

* Update TwitterBridge.php

* clean up, fix warning

* fix warning

* fix warning

* remove oauth token

* fix wrong twitter id when encounter reply post.

* Update TwitterClient.php

* fix wrong twitter id cause by previous commit

* clear warning

* attempt to clear warning

* attempt to clear warning
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.

3 participants