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

twitter: remove requirement of two internal file and support multiple searches and users #700

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

strifel
Copy link

@strifel strifel commented Jun 10, 2021

This PR removes the necessity to have to internal config files in twitterbot, by using different keys for searches and twitter_names in the same file.
This does also fix #697 in the same way.
See https://chat.zulip.org/#narrow/stream/127-integrations/topic/Twitter/near/1198859 for discussions.

As I do not have access to the Twitter API I could not test this PR.

I could see an possible error at

SINCE_ID_NAME = "since_id_" + opts.search_terms

as search_terms (or twitter_name) contains special characters like , or @

@@ -43,7 +44,7 @@ that will process tweets every 5 minutes is:

== Setting up Twitter authentications ==

Run this on a personal or trusted machine, because your API key is
Run this on a personal or trusted machine, because your APIx key is
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

This is presumably a typo.

Copy link
Author

Choose a reason for hiding this comment

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

Yes it is.
I will remove the x again.

Thanks

elif opts.twitter_name:
client_type = "ZulipTwitter/"
CONFIGFILE_INTERNAL = os.path.expanduser("~/.zulip_twitteruserrc_fetchuser")
SINCE_ID_NAME = "since_id_name_" + opts.twitter_name
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

I was trying to think of a better way to serialize the parameters to a particular instances of the bot, but didn't come up with anything great. One idea would be to have the configuration file support having a block for each search, and use the names defined there. E.g.

[twitter_search_foo]
search_terms = ...

[twitter_search_bar]
twitter_name = ...

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

Successfully merging this pull request may close these issues.

Duplicating same tweets when following more users with Twitter-bot
3 participants