jugacostase / gtdownloader

A Python package for the downloading and geographical analysis of tweets
https://gtdownloader.readthedocs.io
Other
0 stars 0 forks source link

Twitter API query operators #1

Open JGKarlin opened 1 year ago

JGKarlin commented 1 year ago

This is great and has a lot of potential, but I cannot get query operators to work. For example, if I only wanted to search for the tweets of elonmusk, how would I set the query?

gtd.get_tweets(
            query='(from:elonmusk)',
            lang='en',
            start_time='10/26/2022',
            end_time='12/25/2022',
            max_tweets=1000
            )
jugacostase commented 1 year ago

Hello, thanks for taking the time to try the code.

Your code seems correct. I was able to reproduce the error and found out the reason you are not getting a response is that elonmusk as well as other users don't allow their tweets to be georreferenced. If you were to use the exact same code on a user with georreferenced tweets like "mattyglesias", the following should work:

gtd.get_tweets( query='(from:mattyglesias)', lang='en', start_time='10/26/2022', end_time='12/25/2022', max_tweets=1000 )

Since the package is intended to georreferenced tweets, I haven't included support for this sort of queries but this issue indicates me that I should. I will also improve the corresponding error message.

Thanks again for your feedback.