Skip to content

How can I generate a query for retreiving text of liked tweets of a list of users? #689

Answered by igorbrigadir
camillaancona asked this question in Q&A
Discussion options

You must be logged in to vote

Unfortunately the command line doesn't have an already working command to do this in bulk, but you can script it in bash

For example, if you have an input.txt with 1 user per line like this (it should work with either usernames or user IDs):

user1
user2
user3

This should get likes of each of them:

while read line; do twarc2 liked-tweets "$line" "likes_of_$line.jsonl" && echo $line; done < input.txt

This will create likes_of_user1.jsonl, likes_of_user2.jsonl, likes_of_user3.jsonl.

Alternatively, using https://twarc-project.readthedocs.io/en/latest/api/client2/#twarc.client2.Twarc2.liked_tweets is the function to call, but this way you'll have to manage your own way of writing output - the…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@camillaancona
Comment options

@igorbrigadir
Comment options

@camillaancona
Comment options

@igorbrigadir
Comment options

Answer selected by igorbrigadir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants