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

Listen to new tweets using lists #152

Open
bitog opened this issue Jan 22, 2024 · 6 comments
Open

Listen to new tweets using lists #152

bitog opened this issue Jan 22, 2024 · 6 comments

Comments

@bitog
Copy link

bitog commented Jan 22, 2024

Hi,

I have seen here in the issues that if you want to listen to new tweets its best to do that through a list.

I have been doing that, and it works out well, however I am not able to grab replies reliably. Anybody got an idea how to solve that issue?

Thank you.

@mahrtayyab
Copy link
Owner

as far as I know , replies aren't part of list timeline.

@harleyLuke
Copy link

harleyLuke commented Jan 23, 2024

This is my solution, if encountered Conversition in the list, I'll get Twitter Detail , and I add new field 'self_vertical_conversation' in Tweet to get he self reply
harleyLuke@1f7d065

and extra code

def convert_tw_list2dbjson(self,tw_list,list_id,cursor):
for item in tw_list:
if isinstance(item,Tweet):
self._convert_tw2db_json(item,list_id,cursor)
elif isinstance(item,SelfThread):
self._convert_selfthread2db_json(item,list_id,cursor)
else:
print("get insert error")

def _convert_selfthread2db_json(self, tw_thread, list_id, cursor):
tw_detail = self.get_twitter_by_twid(tw_id)
self._convert_tw2db_json(tw_detail, list_id, cursor)
for items in tw_detail.self_vertical_conversation:
for item in items.tweets:
self._convert_tw2db_json(item, list_id, cursor)

@mahrtayyab
Copy link
Owner

This is my solution, if encountered Conversition in the list, I'll get Twitter Detail , and I add new field 'self_vertical_conversation' in Tweet to get he self reply harleyLuke@1f7d065

and extra code

def convert_tw_list2dbjson(self,tw_list,list_id,cursor): for item in tw_list: if isinstance(item,Tweet): self._convert_tw2db_json(item,list_id,cursor) elif isinstance(item,SelfThread): self._convert_selfthread2db_json(item,list_id,cursor) else: print("get insert error")

def _convert_selfthread2db_json(self, tw_thread, list_id, cursor): tw_detail = self.get_twitter_by_twid(tw_id) self._convert_tw2db_json(tw_detail, list_id, cursor) for items in tw_detail.self_vertical_conversation: for item in items.tweets: self._convert_tw2db_json(item, list_id, cursor)

How exactly this solves the OP's issue.

@mahrtayyab
Copy link
Owner

Replies are only become part of list when both users involved in that reply are member of that list
If user2 is replying to user1 , the reply will only appear in list if user2 is also member of that list

@harleyLuke
Copy link

Yes sir, you are right. Only users also in the list will get updates for replies, but not all Threads can be obtained in the List, must call Tweet_detail to get all Threads.

@harleyLuke
Copy link

harleyLuke commented Jan 24, 2024

If want to get all the replies, I think can only use the database to store the tweets in the list, and then monitor the number of his replies. Maybe you can set up to only monitor the List within 10 days,because not fresh

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

No branches or pull requests

3 participants