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

Next_Cursor Doesn’t work with Direct_message #384

Closed
uttamraj9 opened this issue Jan 19, 2020 · 1 comment
Closed

Next_Cursor Doesn’t work with Direct_message #384

uttamraj9 opened this issue Jan 19, 2020 · 1 comment
Labels

Comments

@uttamraj9
Copy link

There is an issue when I fetch direct message from rtweet package.

Problem

I use function direct_messages to get the message, It works fine but only problem is it give same message when I pass next cursor.

Expected behavior

If I pass next_cursor it should return next message and it should not repeat the same message if I pass the next cursor.

library(rtweet)
store api keys (these are fake example values; replace with your own keys)
api_key <- "xxxxxx"
api_secret_key <- "xxxxx"
access_token <- "1xxxxx"
access_token_secret <- "xxxxx"  
## authenticate via web browser
token <- create_token(
  app = "xxxxx",
  consumer_key = api_key,
  consumer_secret = api_secret_key,
  access_token = access_token,
  access_secret = access_token_secret)
dm<-direct_messages(n = 5)
dm1<-direct_messages(n = 5,next_cursor="MTIxODc0Njk2NjU2MzMyODAwMQ")
### rtweet version

``` r
## copy/paste output
dm
$events
            type                  id created_timestamp message_create.recipient_id message_create.sender_id message_create.source_app_id
1 message_create 1218747161178931204     1579406941109                  1280572662                198420730                       258901
                                            message_create.message_data.text message_create.message_data.entities.hashtags
1 Please send xxxxx                                    NULL
  message_create.message_data.entities.symbols message_create.message_data.entities.user_mentions message_create.message_data.entities.urls
1                                         NULL                                               NULL                                      NULL

$apps
$apps$`258901`
$apps$`258901`$id
[1] "258901"

$apps$`258901`$name
[1] "Twitter for Android"

$apps$`258901`$url
[1] "http://twitter.com/download/android"

$next_cursor
[1] "MTIxODc0Njk2NjU2MzMyODAwMQ"

Logically If I pass the next_cursor it should give me new message but its repeat the same message and same cursor:
dm1
$events
            type                  id created_timestamp message_create.recipient_id message_create.sender_id message_create.source_app_id
1 message_create 1218747161178931204     1579406941109                  1280572662                198420730                       258901
                                            message_create.message_data.text message_create.message_data.entities.hashtags
1 Please send xxxxx                                         NULL
  message_create.message_data.entities.symbols message_create.message_data.entities.user_mentions message_create.message_data.entities.urls
1                                         NULL                                               NULL                                      NULL
$apps
$apps$`258901`
$apps$`258901`$id
[1] "258901"
$apps$`258901`$name
[1] "Twitter for Android"
$apps$`258901`$url
[1] "http://twitter.com/download/android"
$next_cursor
[1] "MTIxODc0Njk2NjU2MzMyODAwMQ"
packageVersion("rtweet")

Session info

sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] remotes_2.1.0 jsonlite_1.6 stringr_1.4.0 stringi_1.2.4 base64enc_0.1-3 digest_0.6.23 RCurl_1.95-4.12
[8] bitops_1.0-6 RTwitterAPI_1.0.0 rtweet_0.7.0

loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 rstudioapi_0.9.0 magrittr_1.5 R6_2.4.1 fansi_0.4.1 httr_1.4.1 tools_3.5.2
[8] pkgbuild_1.0.6 cli_2.0.1 withr_2.1.2 askpass_1.1 rprojroot_1.3-2 assertthat_0.2.1 openssl_1.4.1
[15] yaml_2.2.0 crayon_1.3.4 processx_3.4.1 callr_3.3.2 ps_1.3.0 curl_4.3 glue_1.3.1
[22] compiler_3.5.2 backports_1.1.5 prettyunits_1.1.0

Token

copy/paste output

rtweet::get_token()

request: https://api.twitter.com/oauth/request_token authorize: https://api.twitter.com/oauth/authenticate access: https://api.twitter.com/oauth/access_token HCT_UAE key: xxxxxxxx secret: oauth_token, oauth_token_secret ---
@llrs llrs mentioned this issue Feb 15, 2021
@llrs llrs added the bug label Feb 16, 2021
@hadley
Copy link
Member

hadley commented Feb 27, 2021

Now tracking in #510

@hadley hadley closed this as completed Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants