cjbarrie / academictwitteR

Repo for academictwitteR package to query the Twitter Academic Research Product Track v2 API endpoint.
Other
272 stars 59 forks source link

get_retweeted_by #214

Closed justinchuntingho closed 3 years ago

justinchuntingho commented 3 years ago

Note that Twitter API doesn't return all the retweets, only around 50 will be returned

chainsawriot commented 3 years ago

The function fails, when get_tweets receives zero rows (i.e. no one retweets that tweet)

chainsawriot commented 3 years ago

@justinchuntingho Please clarify the behaviors of export_query, file, and bind_tweets. I have a feeling that they are not required for this function.

justinchuntingho commented 3 years ago

Fixed the errors, forgot it is wrapped in a loop. It would be great to have similar functionalities as file and export_query, but it is a bit tricky to implement.

chainsawriot commented 3 years ago

@justinchuntingho I reverted the hard-coded TRUE for bind_tweets in count_all_tweets. I don't know how it matters to get_retweeted_by. For the sake of preventing sneaky changes and enabling pinpointing where the problem is in the future (a.k.a. git blame): if it is needed (which might be the case), it would be better to submit another pull request.

carlaLanyon commented 2 years ago

Hi all. Thanks so much for this great package!!

I had a similar issue, probably a very basic mistake since I'm new. I'm trying to use the function get_retweeted by, but it doesn't work.

In the first place, I downloaded all the tweets from one place and I had the public metrics that show if the tweets is reply, liked, or retweet, however, I need the id users of these metrics.

So I have tried to use the function get_linking_users, which worked very well. But the function get_retweeted by, it runs, but it doesn't deliver any information. Despite the df (get-all tweets) said that that tweet has a 2 retweet count. This situation happened will all the id of the tweet. code:

retweet<-get_retweeted_by("849811116083605504", data_path = "carla8/", verbose=TRUE)

Processing 881731453901561856 Total pages queried: 1 (tweets captured this page: 1). Error in make_query(url = endpoint_url, params = params, bearer_token = bearer_token, : something went wrong. Status code: 400

I have already set _bearer, reinitiate and everything, is the only functions that doesn't work

Any recommendation will be very helpful!

cjbarrie commented 2 years ago

This function was updated recently. See: https://github.com/cjbarrie/academictwitteR/pull/289. See #288

I have tested the above with different tweet IDs and it works fine with the latest development version. Install this with:

devtools::install_github("cjbarrie/academictwitteR", build_vignettes = TRUE)

The tweet ID you provided did not return data but that may be because accounts are protected or retweets have since been deleted.

carlaLanyon commented 2 years ago

Thanks so much. it worked !!!