Skip to main content

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

Metadata

Release files for ScrapeTweets 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ScrapeTweets 1.0.0
File Size Uploaded
ScrapeTweets-1.0.0.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ScrapeTweets 1.0.0
File Interpreter ABI Platform
ScrapeTweets-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.5 kB

Release files / ScrapeTweets-1.0.0.tar.gz

Download URL ScrapeTweets-1.0.0.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
030f476b59c3f78520055f77ef0520964955eed538daa81906ffd36ff0df4847
BLAKE2b-256 checksum
How to use checksums
098ba86d646117953a4c5200a2c856f587e084ea4ab8503e63f1dc59b70c8ce5
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / ScrapeTweets-1.0.0-py3-none-any.whl

Download URL ScrapeTweets-1.0.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a0b3f38e300b75199e79a5c4ab26256400848e07618b0bee60a47f42bb8cbdd
BLAKE2b-256 checksum
How to use checksums
b7ea5fa57651cc3dbdb47b264642d8dc3c494123f818bfc633b94db61f69eddc
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page