Python Client to scrape messages, save to MySQL DB and serve to get requests.
- Python (3.10)
- Pip install
telethon==1.28.5,mysql-connector-python==8.0.33andFlask==1.0.2(All written in therequirement.txtfile)
- Pip install
- You'll need MySQL Server
- Get the username, password, hostname and port to the
database_settings.jsonfile
- Get the username, password, hostname and port to the
- Activated Telegram account
- After activation go to https://my.telegram.org/ and menage apps
- Put your phone number, api id and api hash in the
credentials.jsonfile
Example for
credentials.jsonfile:
{
"clients": [
{
"phone_number": "+972 123 456 789",
"api_id": 12345678,
"api_hash": "1234567890abcdef1234567890abcdef"
}
]
}
- You'll need to run the telegram scraper every once in a while
- Run the server
- Example request:
http://localhost:5000/data?from_date=2023-06-20&to_date=2023-06-30&chat_name=cool chat
- Example request: