This script helps you search for job postings related to DevOps roles and internships posted on Twitter within a specified time frame (default is the last 24 hours). It uses the Twitter API v2 via the Tweepy library.
- Searches for tweets containing keywords like "DevOps," "Engineer," "Internship," "Junior," "Fresher," "Hiring," and "Entry Level."
- Filters out retweets programmatically to show only original tweets.
- Retrieves tweet details, including the text, author ID, creation time, and a direct URL.
- Handles rate limits and retries automatically.
- Python Environment: Install Python 3.7 or higher.
- Tweepy Library: Install the Tweepy library for interacting with the Twitter API.
- dotenv Library: Install the dotenv library to load environment variables from a
.env
file. - Twitter Developer Account: Obtain a Bearer Token by creating a Twitter developer account and setting up a project in the Twitter Developer Portal.
-
Clone the Repository:
git clone https://github.com/Chirag-S-Kotian/jobify.git cd jobify
-
Create a Virtual Environment:
- On Windows:
python -m venv venv venv\Scripts\activate
- On macOS/Linux:
python3 -m venv venv source venv/bin/activate
- On Windows:
-
Install Dependencies:
pip install tweepy python-dotenv
-
Set Up Environment Variables:
- Create a
.env
file in the project directory. - Add your Twitter Bearer Token to the
.env
file:TWITTER_BEARER_TOKEN=your_twitter_bearer_token
- Create a
-
Run the Script:
python job.py
-
Load Configuration: The script uses the
dotenv
library to load the Twitter Bearer Token from the.env
file. -
Define the Search Query:
- The query is set to search for DevOps-related jobs, internships, and entry-level roles.
- Keywords include:
DevOps
,Engineer
,Internship
,Junior
,Fresher
,Hiring
, andEntry Level
.
-
Call Twitter API v2:
- The
search_recent_tweets
method fetches tweets matching the query within the last 24 hours. - Filters out retweets and non-English tweets programmatically.
- The
-
Handle Rate Limits:
- Automatically waits and retries when rate limits are exceeded.
-
Display Results:
- Outputs relevant job postings in a user-friendly format, including:
- Tweet text
- Author ID
- Timestamp
- Direct tweet URL
- Outputs relevant job postings in a user-friendly format, including:
When run successfully, the script outputs something like this:
Searching Twitter jobs using API v2...
Found 2 relevant tweets:
1. Tweet: "We're hiring a Junior DevOps Engineer! Exciting opportunity for freshers. #DevOps #Hiring"
Author ID: 12345678
Created At: 2025-01-18T15:30:45+00:00
URL: https://twitter.com/user/status/987654321
2. Tweet: "Looking for a DevOps intern to join our team. Apply now! #Internship"
Author ID: 87654321
Created At: 2025-01-18T18:20:30+00:00
URL: https://twitter.com/user/status/123456789
-
Time Frame:
- Adjust the
start_time
in thesearch_twitter_jobs_v2
function to change the time window.start_time = (datetime.now() - timedelta(days=<number_of_days>)).isoformat("T") + "Z"
- Adjust the
-
Query:
- Modify the
query
variable in themain()
function to include additional keywords or phrases.
- Modify the
-
Max Results:
- Adjust the
max_results
parameter in thesearch_recent_tweets
call (default is 20).
- Adjust the
-
Rate Limits:
- If you encounter a rate limit error, the script will automatically wait and retry.
-
Invalid Token:
- Ensure the Bearer Token in your
.env
file is correct and active.
- Ensure the Bearer Token in your
-
Query Errors:
- Ensure your query is supported by the Twitter API v2. Avoid unsupported operators like
-filter:retweets
.
- Ensure your query is supported by the Twitter API v2. Avoid unsupported operators like
This project is open-source and available under the MIT License. Feel free to modify and use it for your own purposes.
Contributions are welcome! If you have suggestions or enhancements, feel free to submit a pull request.
This script is for educational purposes only. Ensure compliance with Twitter's API usage policies when using this script.