Skip to main content

ScrapeTweets is a Python package that scrapes all the tweets from the Twitter API by using Hashtags. This data can be used for various purposes like Education, Research, News, etc.

Project description

Scrape Twitter Tweets

ScrapeTweets is a Python package that scrapes all the tweets from the Twitter API by using Hashtags. This data can be used for various purposes like Education, Research, News, etc.


Installation

Install directly from my PyPi

pip install ScrapeTweets

Or Clone the Repository and install

python3 setup.py install

Parameters

* Authorization


The Authorization token when you visit Twitter.

* x-guest-token


The x-guest-token when you visit Twitter.

* hashtag


The hashtag to search on Twitter.

* count


The number of tweets to fetch from Twitter.

Attributes

* setAuthorization(authorization_token)


Set the Authorization Token.

* setGuestToken(x-guest-token)


Set the x-guest-token.

* fetchTweetByHashTagandCount(hashtag, count)


Fetch all the tweets using Hashtag and Count.

Documentation

1. Install the package

pip install ScrapeTweets

2. Import the library

from ScrapeTweets import ScrapeTweets

3. Create an object for ScrapeTweets class

st = ScrapeTweets()

4. Set The Authorization Token

st.setAuthorization(authorization_token)

5. Set The x-guest-token

st.setGuestToken(x-guest-token)

5. Predict your Test Set results

all_tweets_fetched = st.fetchTweetByHashTagandCount(hashtag, count)


Example Code

from ScrapeTweets import ScrapeTweets

st = ScrapeTweets()
st.setAuthorization('Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA')
st.setGuestToken('1333095583104462848')
all_tweets_fetched = st.fetchTweetByHashTagandCount('lamborghini', 25)

# print(all_tweets_fetched)

for no, tweet in enumerate(all_tweets_fetched):
    print("Tweet No : ", no+1)
    print("Tweet text : ", all_tweets_fetched[tweet]['full_text'])
    # break


Footnotes

You can find the code at my Github.

Connect with me on Social Media

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

ScrapeTweets-1.0.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

ScrapeTweets-1.0.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file ScrapeTweets-1.0.0.tar.gz.

File metadata

  • Download URL: ScrapeTweets-1.0.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.3

File hashes

Hashes for ScrapeTweets-1.0.0.tar.gz
Algorithm Hash digest
SHA256 030f476b59c3f78520055f77ef0520964955eed538daa81906ffd36ff0df4847
MD5 74d2625e0337df6938376f800fb364d1
BLAKE2b-256 098ba86d646117953a4c5200a2c856f587e084ea4ab8503e63f1dc59b70c8ce5

See more details on using hashes here.

File details

Details for the file ScrapeTweets-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ScrapeTweets-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.3

File hashes

Hashes for ScrapeTweets-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a0b3f38e300b75199e79a5c4ab26256400848e07618b0bee60a47f42bb8cbdd
MD5 54a74d9fb4c14d5769ff85e65f437521
BLAKE2b-256 b7ea5fa57651cc3dbdb47b264642d8dc3c494123f818bfc633b94db61f69eddc

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