cjbarrie / academictwitteR

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

resume_collection limited to default 100 tweets #182

Closed jcs82 closed 3 years ago

jcs82 commented 3 years ago

'n' set in get_all_tweets, is not carried over the saved query and so when collection is resumed using resume_collection, n is set to default of 100.

To Reproduce bearer_token <- XXXXXXXXXXXXX start_tweets <- "2012-01-01T00:00:00Z" end_tweets <- "2020-01-01T00:00:00Z" query<-"hello" get_all_tweets(query, start_tweets, end_tweets, bearer_token, file = NULL, data_path = path, export_query = TRUE, bind_tweets = FALSE, verbose = TRUE, n = 2000, page_n = 500 )

manually kill process before completion

resume_collection(path,bearer_token,verbose = TRUE)

Expected behavior That 'n' is saved in the query file called by reume_collection

Session Info: session_info() ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── setting value
version R version 4.0.5 (2021-03-31) os macOS Big Sur 10.16
system x86_64, darwin17.0
ui RStudio
language (EN)
collate en_GB.UTF-8
ctype en_GB.UTF-8
tz Europe/London
date 2021-07-05

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── package version date lib source
academictwitteR
0.2.1 2021-07-05 [1] Github (cjbarrie/academictwitteR@49d0c7e) assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.2)
backports 1.2.1 2020-12-09 [1] CRAN (R 4.0.2)
bitops 1.0-7 2021-04-24 [1] CRAN (R 4.0.2)
broom 0.7.7 2021-06-13 [1] CRAN (R 4.0.2)
cachem 1.0.5 2021-05-15 [1] CRAN (R 4.0.2)
callr 3.7.0 2021-04-20 [1] CRAN (R 4.0.2)
cellranger 1.1.0 2016-07-27 [1] CRAN (R 4.0.2)
cli 3.0.0 2021-06-30 [1] CRAN (R 4.0.2)
colorspace 2.0-1 2021-05-04 [1] CRAN (R 4.0.2)
crayon 1.4.1 2021-02-08 [1] CRAN (R 4.0.2)
crosstalk 1.1.1 2021-01-12 [1] CRAN (R 4.0.2)
curl 4.3.2 2021-06-23 [1] CRAN (R 4.0.2)
data.table 1.14.0 2021-02-21 [1] CRAN (R 4.0.2)
DBI 1.1.1 2021-01-15 [1] CRAN (R 4.0.2)
dbplyr 2.1.1 2021-04-06 [1] CRAN (R 4.0.2)
desc 1.3.0 2021-03-05 [1] CRAN (R 4.0.2)
devtools
2.4.2 2021-06-07 [1] CRAN (R 4.0.2)
digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.2)
dplyr 1.0.7 2021-06-18 [1] CRAN (R 4.0.2)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.0.2)
evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.1)
fansi 0.5.0 2021-05-25 [1] CRAN (R 4.0.2)
fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.0.2)
forcats
0.5.1 2021-01-27 [1] CRAN (R 4.0.2)
fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.2)
generics 0.1.0 2020-10-31 [1] CRAN (R 4.0.2)
ggmap 3.0.0 2019-02-05 [1] CRAN (R 4.0.2)
ggplot2
3.3.4 2021-06-16 [1] CRAN (R 4.0.2)
glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2)
gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.2)
haven 2.4.1 2021-04-23 [1] CRAN (R 4.0.2)
hms 1.1.0 2021-05-17 [1] CRAN (R 4.0.2)
htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.0.2)
htmlwidgets 1.5.3 2020-12-10 [1] CRAN (R 4.0.2)
httr 1.4.2 2020-07-20 [1] CRAN (R 4.0.2)
jpeg 0.1-8.1 2019-10-24 [1] CRAN (R 4.0.2)
jsonlite
1.7.2 2020-12-09 [1] CRAN (R 4.0.2)
kableExtra 1.3.4 2021-02-20 [1] CRAN (R 4.0.2)
knitr 1.33 2021-04-24 [1] CRAN (R 4.0.2)
lattice 0.20-41 2020-04-02 [1] CRAN (R 4.0.5)
leaflet
2.0.4.1 2021-01-07 [1] CRAN (R 4.0.2)
leaflet.minicharts 0.6.2 2021-05-11 [1] CRAN (R 4.0.2)
leaflet.providers 1.9.0 2019-11-09 [1] CRAN (R 4.0.2)
lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.0.2)
lubridate 1.7.10 2021-02-26 [1] CRAN (R 4.0.2)
magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.2)
memoise 2.0.0 2021-01-26 [1] CRAN (R 4.0.2)
modelr 0.1.8 2020-05-19 [1] CRAN (R 4.0.2)
munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.2)
pillar 1.6.1 2021-05-16 [1] CRAN (R 4.0.2)
pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 4.0.2)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.2)
pkgload 1.2.1 2021-04-06 [1] CRAN (R 4.0.2)
plyr 1.8.6 2020-03-03 [1] CRAN (R 4.0.2)
png 0.1-7 2013-12-03 [1] CRAN (R 4.0.2)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.2)
processx 3.5.2 2021-04-30 [1] CRAN (R 4.0.2)
ps 1.6.0 2021-02-28 [1] CRAN (R 4.0.2)
purrr
0.3.4 2020-04-17 [1] CRAN (R 4.0.2)
R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.2)
Rcpp 1.0.6 2021-01-15 [1] CRAN (R 4.0.2)
readr 1.4.0 2020-10-05 [1] CRAN (R 4.0.2)
readxl 1.3.1 2019-03-13 [1] CRAN (R 4.0.2)
remotes 2.4.0 2021-06-02 [1] CRAN (R 4.0.2)
reprex 2.0.0 2021-04-02 [1] CRAN (R 4.0.2)
reshape2
1.4.4 2020-04-09 [1] CRAN (R 4.0.2)
RgoogleMaps 1.4.5.3 2020-02-12 [1] CRAN (R 4.0.2)
rjson 0.2.20 2018-06-08 [1] CRAN (R 4.0.2)
rlang 0.4.11 2021-04-30 [1] CRAN (R 4.0.2)
rmarkdown 2.9 2021-06-15 [1] CRAN (R 4.0.2)
rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.0.2)
rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.0.2)
rvest 1.0.0 2021-03-09 [1] CRAN (R 4.0.2)
scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.2)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.2)
sp 1.4-5 2021-01-10 [1] CRAN (R 4.0.2)
stringi 1.6.2 2021-05-17 [1] CRAN (R 4.0.2)
stringr
1.4.0 2019-02-10 [1] CRAN (R 4.0.2)
svglite 2.0.0 2021-02-20 [1] CRAN (R 4.0.2)
systemfonts 1.0.2 2021-05-11 [1] CRAN (R 4.0.2)
testthat 3.0.3 2021-06-16 [1] CRAN (R 4.0.2)
tibble 3.1.2 2021-05-16 [1] CRAN (R 4.0.2)
tidyr
1.1.3 2021-03-03 [1] CRAN (R 4.0.2)
tidyselect 1.1.1 2021-04-30 [1] CRAN (R 4.0.2)
tidyverse 1.3.1 2021-04-15 [1] CRAN (R 4.0.2)
usethis
2.0.1 2021-02-10 [1] CRAN (R 4.0.2)
utf8 * 1.2.1 2021-03-12 [1] CRAN (R 4.0.2)
vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.0.2)
viridisLite 0.4.0 2021-04-13 [1] CRAN (R 4.0.2)
webshot 0.5.2 2019-11-22 [1] CRAN (R 4.0.2)
withr 2.4.2 2021-04-18 [1] CRAN (R 4.0.2)
xfun 0.24 2021-06-15 [1] CRAN (R 4.0.2)
xml2 1.3.2 2020-04-23 [1] CRAN (R 4.0.2)

[1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library

jcs82 commented 3 years ago

ooops! Just realised that arguments get passed to get_all_tweets, so just need to set n and page_n in resume_collection...

shmuhammadd commented 3 years ago

@jcs82 how do you make resume_collection works?

I have resume_collection(data_path = "hausa") and it returns an error Error in make_query(url = endpoint_url, params = params, bearer_token = bearer_token, : something went wrong. Status code: 400

Also run resume_collection(data_path = "hausa", n = Inf, page_n =500) and had the same error.

jcs82 commented 3 years ago

Not sure - but maybe this has to do with the page_n bug? Does it work if you set it to 100?