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

Unable to get a user replies #41

Open
louisgrasset opened this issue Aug 12, 2023 · 5 comments
Open

Unable to get a user replies #41

louisgrasset opened this issue Aug 12, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@louisgrasset
Copy link
Contributor

louisgrasset commented Aug 12, 2023

I'm trying to get the lastest 50 tweets (expecting tweets and replies) but it sounds like I'm only able to get:

  • tweets
  • retweets.

I'm leveraging getTweets('userHandle', 50) to do so, no auth required.
Am I missing something? Is this a bug or an expected behavior?

From what I see, Twitter isn't allowing non-authenticated webapp to access replies, may this be the reason?

Twitter Webapp not returning replies
@karashiiro karashiiro added the bug Something isn't working label Aug 12, 2023
@karashiiro
Copy link
Collaborator

I believe that's probably what's happening — I'll have to check if we get more data when authenticated via the API method that uses.

@karashiiro
Copy link
Collaborator

I'd consider this a bug for now, but given that we're at the whims of the company formerly known as Twitter, this might have to become the new expected behavior, at least while unauthenticated.

@whynotmarc
Copy link

whynotmarc commented Aug 12, 2023

I'd consider this a bug for now, but given that we're at the whims of the company formerly known as Twitter, this might have to become the new expected behavior, at least while unauthenticated.

It seems like even while authenticated replies don't show when using getTweets

@louisgrasset
Copy link
Contributor Author

louisgrasset commented Aug 13, 2023

You may be totally true, when I discovered that issue, I moved my code to use the following:
searchTweets(`from:@${handle}`, 50, SearchMode.Latest)

@whynotmarc
Copy link

whynotmarc commented Aug 13, 2023

With authentication you can use fetchSearchTweets.
Something along the lines of this:

  const tweets = []
  const maxTweets = 50
  const query = `(from:${userHandle}) filter:replies`
  
  let cursor
  let nTweets = 0
  while (nTweets < maxTweets) {
    const res = await scraper.fetchSearchTweets(
      query,
      maxTweets,
      SearchMode.Latest,
      cursor
    )

    if (res.tweets.length === 0) break

    nTweets += res.tweets.length
    cursor = res.next
    tweets.push(...res.tweets)
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants