https://github.com/ghazayel/x-ray
extract info from twitter
https://github.com/ghazayel/x-ray
chrome scraper twitter x
Last synced: about 2 months ago
JSON representation
extract info from twitter
- Host: GitHub
- URL: https://github.com/ghazayel/x-ray
- Owner: ghazayel
- License: mit
- Created: 2025-04-12T17:51:14.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-14T08:19:33.000Z (about 1 year ago)
- Last Synced: 2025-04-27T00:56:41.956Z (about 1 year ago)
- Topics: chrome, scraper, twitter, x
- Language: Python
- Homepage: https://ghazayel.com
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ฆ X-Ray: Data Extraction Tool
### Built by [@ghazayel](https://x.com/ghazayel) | Powered by Selenium
---
### โจ Overview
Welcome to the **X-Ray Scraping Tool** โ your trusty sidekick for journalistic investigations, data analysis, or tracking public conversations across **X (formerly Twitter)**. This tool automates the scraping of live tweets within a custom date range, capturing tweet content, timestamps, usernames, retweets, likes, and replies โ and outputs everything into a clean `.csv` file ๐.
> ๐ฐ Whether you're chasing a breaking story or analyzing social sentiment, this script does the heavy lifting for you.
---
### ๐ Features
- ๐ **Search by keyword/hashtag**
- ๐๏ธ **Custom date ranges**
- ๐ **Auto-export to CSV**
- ๐ค **Uses real browser session (Chrome) for better authenticity**
- ๐ **Preserves login/session with your own Chrome profile**
- ๐ **Retweet, like, and reply counts included**
- ๐จ **Beautiful colored CLI interface**
- ๐ง **Smart scroll & duplicate handling**
---
### ๐ธ Preview
```
WELCOME TO TWITTER SCRAPING TOOL!
Created by Mahmoud Ghazayel - @ghazayel
Initializing...
Ready to go!
Enter the search term: gaza
Enter start date (YYYY-MM-DD): 2025-01-01
Enter end date (YYYY-MM-DD): 2025-01-05
Enter number of tweets to collect: 100
Scraping complete. Total tweets collected: 100
โ
Scraping done successfully! Press Enter to exit.
```
---
### ๐ ๏ธ Requirements
Ensure the following Python packages are installed:
```bash
pip install selenium webdriver-manager colorama
```
And of course, have **Google Chrome** installed. The script uses your own Chrome user session for authentication.
---
### โ๏ธ Setup & Usage
1. **Clone the repository:**
```bash
git clone https://github.com/ghazayel/X-Ray-scraper.git
cd X-Ray-scraper
```
2. **Customize your Chrome path:**
Make sure this line reflects your system profile path:
```python
options.add_argument("--user-data-dir=C:\Users\User\AppData\Local\Google\Chrome\User Data")
```
3. **Run the script:**
```bash
python X-Ray_scraper.py
```
4. **Input your query:**
You'll be prompted to enter:
- A keyword or hashtag (no `#` needed)
- Start date (`YYYY-MM-DD`)
- End date (`YYYY-MM-DD`)
- Number of tweets to collect
5. **Output:**
Your tweets will be saved in a file like `twitter_data.csv`.
---
### ๐ง How It Works
This scraper mimics human browsing:
- Opens a browser window with your Chrome session
- Navigates to X (Twitter) search
- Scrolls dynamically to load tweets
- Extracts data using Selenium
- Handles duplicates & errors gracefully
- Outputs a well-structured CSV
---
### ๐ Notes
- This tool **does not use Twitter/X API**, which makes it ideal for scraping without needing developer credentials.
- This tool might **NOT** work correctly if the Elon Musk decided to change the UI of X or how the LazyLoading works on the site.
- Always respect the [terms of service](https://x.com/en/tos) of any platform you interact with.
- Ideal for **journalists, researchers, analysts**, and OSINT professionals.
---
### ๐ Output Sample (CSV)
| text | timestamp | username | retweets | likes | replies |
|------|-----------|----------|----------|-------|---------|
| Breaking: UN warns of... | 2025-01-01T12:00:00Z | @UN_News | 145 | 500 | 30 |
---
### ๐โโ๏ธ Author
**Mahmoud Ghazayel**
๐ธ Journalist & OSINT Specialist
๐ [@ghazayel](https://x.com/ghazayel)
๐ [ghazayel.com](https://ghazayel.com)
๐ฌ Feel free to open an issue or suggest improvements!
---
### ๐งช Final Word
If this project helped your reporting or research, give it a โญ on GitHub.
It keeps this tool alive, accurate, and evolving.
```
๐ต๏ธ Stay curious. Stay informed. Stay independent.
```