https://github.com/yash-kavaiya/telegram-url-scraper
You can use this tool to export your Telegram user, group, or chat history in JSON format, extract text messages, and it can help you extract all available URLs in Telegram and generate a CSV file for further analysis.
https://github.com/yash-kavaiya/telegram-url-scraper
json nlp python scrapy telegram
Last synced: over 1 year ago
JSON representation
You can use this tool to export your Telegram user, group, or chat history in JSON format, extract text messages, and it can help you extract all available URLs in Telegram and generate a CSV file for further analysis.
- Host: GitHub
- URL: https://github.com/yash-kavaiya/telegram-url-scraper
- Owner: Yash-Kavaiya
- License: mpl-2.0
- Created: 2023-10-28T06:32:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-30T13:02:03.000Z (over 2 years ago)
- Last Synced: 2025-03-28T07:22:46.851Z (over 1 year ago)
- Topics: json, nlp, python, scrapy, telegram
- Language: Jupyter Notebook
- Homepage: https://telegram-url-extracter-wuv6jff7zq-de.a.run.app/
- Size: 559 KB
- Stars: 10
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ฑ Telegram URL Scraper ๐
[](https://www.python.org/)
[](https://flask.palletsprojects.com/)
[](https://pandas.pydata.org/)
> **Try it online:** [Telegram URL Extractor](https://telegram-url-extracter-wuv6jff7zq-de.a.run.app/)
## ๐ Overview
This repository provides a set of tools to extract URLs from your Telegram chat history. You can use this tool to:
- ๐ค Export your Telegram user, group, or chat history in JSON format
- ๐ Extract text messages from your chat history
- ๐ Extract all available URLs in your Telegram chats
- ๐ Generate a CSV file for further analysis

## ๐ Table of Contents
- [Prerequisites](#prerequisites)
- [Getting Started](#getting-started)
- [Exporting Telegram Data](#exporting-telegram-data)
- [Usage](#usage)
- [Extracting URLs and Creating a CSV](#extracting-urls-and-creating-a-csv)
- [Contributing](#contributing)
- [License](#license)
## ๐ง Prerequisites
Before using this tool, ensure you have the following installed on your system:
| Requirement | Version | Purpose |
|-------------|---------|---------|
| [Telegram Desktop](https://desktop.telegram.org/) | Latest | For exporting chat history |
| [Python](https://www.python.org/) | 3.7+ | Runtime environment |
| pandas | Latest | Data handling and CSV creation |
| Flask | 3.0.0 | Web interface (optional) |
## ๐ Getting Started
### Exporting Telegram Data
```mermaid
graph TD
A[Install Telegram Desktop] --> B[Open Telegram Desktop]
B --> C[Go to target chat]
C --> D[Click profile picture]
D --> E[Click three dots โฎ]
E --> F[Select Export chat history]
F --> G[Choose JSON format]
G --> H[Save .json file]
```
To export your Telegram chat history, follow these steps:
1. **Install Telegram Desktop** on your computer if you haven't already.
2. **Open Telegram Desktop** and log in with your account.
3. **Go to the chat or group** you want to export and click on the profile picture.
4. **In the chat/group profile**, click on the three vertical dots (โฎ) in the top-right corner and select "Export chat history."
5. **Choose the "JSON" format** for exporting the chat history. Save the resulting `.json` file to a location on your computer.
### ๐ Analyzing Telegram Data
Clone this repository to your local machine and navigate to the repository directory.
```bash
git clone https://github.com/Yash-Kavaiya/telegram-url-scraper
cd telegram-url-scraper
```
## ๐ป Usage
### Extracting URLs
To extract URLs from the exported Telegram data and create a CSV file, run the following command:
```bash
python app.py -i result.json
```
Replace `result.json` with the path to your exported Telegram chat history JSON file. This command will:
1. ๐ Load your Telegram chat history
2. ๐ Extract all URLs from messages
3. ๐งน Clean and format the URLs
4. ๐ Generate a CSV file with the results
### ๐ Web Interface
This tool also provides a web interface for easier use:
1. **Start the web server**:
```bash
python app.py
```
2. **Open your browser** and go to `http://localhost:5000`
3. **Upload your JSON file** and follow the on-screen instructions
## ๐ Data Processing Flow
```mermaid
flowchart LR
A[Telegram JSON] --> B[Extract Messages]
B --> C[Filter URLs]
C --> D[Clean Data]
D --> E[Generate CSV]
E --> F[Download Results]
```
## ๐งฉ Key Components
| Component | Description |
|-----------|-------------|
| **JSON Parser** | Processes the exported Telegram JSON file |
| **URL Extractor** | Uses regex patterns to identify and extract URLs |
| **Data Cleaner** | Removes unwanted characters and formats URLs |
| **CSV Generator** | Creates structured output files for analysis |
| **Web Interface** | Provides a user-friendly way to use the tool |
## ๐ค Contributing
If you have improvements or additional features to add to this project, feel free to contribute:
1. **Fork the repository**
2. **Create a feature branch**:
```bash
git checkout -b feature/amazing-feature
```
3. **Commit your changes**:
```bash
git commit -m "Add some amazing feature"
```
4. **Push to the branch**:
```bash
git push origin feature/amazing-feature
```
5. **Open a Pull Request**
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
๐ Telegram URL Scraper - Extract, analyze, and utilize links from your Telegram chats with ease! ๐