Skip to main content

A Python package for the simple downloading of tweets with geographical information

Project description

GTdownloader

GTdownloader is a geographical tweets downloading tool that leverages the Twitter API

and searchtweets-v2 to retrieve tweets with geographical information and store them in easy access

formats like .csv and .shp.

Installation

pip

Use the package manager pip to install gtdownloader.

pip install gtdownloader

conda

Alternativaly, install gtdownloader from the conda-forge channel by running the following command:

conda install -c conda-forge gtdownloader

Twitter keys

To set up your twitter keys file you need to have a developer account with access to the full-archive

search. If you plan to use this as part of academic research, you can apply for researcher

access to the API at Twitter Academic Research access.

After loging into your developer account, copy the consumer key, the consumer secret and the bearer token into a .yaml

file in the following way:

search_tweets_v2:

  endpoint:  https://api.twitter.com/2/tweets/search/all

  consumer_key: YOUR_CONSUMER_KEY

  consumer_secret: YOUR_CONSUMER_SECRET

  bearer_token:  YOUR_BEARER_TOKEN

Get started

from gtdownloader import TweetDownloader



# create downloader using Twitter API credentials

gtd = TweetDownloader(credentials='twitter_keys.yaml')



# get a batch of 400 tweets in english containing the word "tornado"

# between the dates 07/23/2022 and 07/29/2022

gtd.get_tweets('tornado', 

               lang='en', 

               max_tweets=400,

               start_time='07/23/2022', 

               end_time='07/29/2022'

               )



# accessing tweets data frame

gtd.tweets_df.head()

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gtdownloader-0.1.19.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gtdownloader-0.1.19-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file gtdownloader-0.1.19.tar.gz.

File metadata

  • Download URL: gtdownloader-0.1.19.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for gtdownloader-0.1.19.tar.gz
Algorithm Hash digest
SHA256 a6e470c8addf777eb6cbeb5d0f7828be0fa3ce4ef08d4a3448ad413865c561ca
MD5 3e30b5796f1c56db1abc5e0bae745350
BLAKE2b-256 92d08705462aa854ee2065ed4e8856a67cbbd173e7323294da7c94272dd114e0

See more details on using hashes here.

File details

Details for the file gtdownloader-0.1.19-py3-none-any.whl.

File metadata

  • Download URL: gtdownloader-0.1.19-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for gtdownloader-0.1.19-py3-none-any.whl
Algorithm Hash digest
SHA256 0618fbda83b26262d5de8c2bf49c7995e2d343dd4415152c57be2eff3df2c4e5
MD5 f878c75a9c6457da27e5f05af5935bc3
BLAKE2b-256 566a73a66468b08842cfbbb880d7c0e7be631de9be0ff7eae71a88c3d0b7f467

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page