tchan - Telegram Channel scraper
Python library and command-line interface to scrape Telegram public channels. Since this scraper uses Telegram Channel Web preview, it won't work for:
- Public channels with "Restrict saving content" option enabled
- Private channels
- Public Groups
- Private Groups
It's also not possible to retrieve comments, since they're made on a group.
Installing
pip install tchan # Python library only
pip install tchan[cli] # Library + CLI
Using as a libray
from tchan import ChannelScraper
scraper = ChannelScraper()
for message in scraper.messages("tchantest"):
print(f"New message ({message.type}) from {message.channel}:")
print(f" id={message.id}")
print(f" created_at={message.created_at.isoformat()}")
print(f" text={message.text}")
# TODO: add more parameters
Using as a command-line tool
Scrape one or many channels and save all messages to messages.csv:
tchan messages.csv channel1 [channel2 ... channelN]
Tests
To run all tests, execute:
make test # or just `pytest`
Make sure to install development requirements.
Tests were made on a channel created for this task: tchantest.
Metadata
Release files for tchan 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tchan-0.1.4.tar.gz | 8.8 kB | Without provenance | Details for tchan-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tchan-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for tchan-0.1.4-py3-none-any.whl |
Total release size: 17.9 kB
Release files / tchan-0.1.4.tar.gz
| Download URL | tchan-0.1.4.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3c382fca3fa1898ae78b025b8aa6dfea81a75df71d394d9ae1655baf535e321
|
|
BLAKE2b-256 checksum How to use checksums |
5d53ceda0c6b07080029ca3cc8b2bc15b1e9ceef7654789e6b2c610013edbc64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / tchan-0.1.4-py3-none-any.whl
| Download URL | tchan-0.1.4-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20d267056e7b820c8a7b070ea25dd5dee3255d9512c0e646e69f6d93d8f9e7c8
|
|
BLAKE2b-256 checksum How to use checksums |
f7608ead009daa258388e92ac3276095ef33073a3dc36c7a414afecc35c5b464
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for tchan 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.