一个Python脚本,可让您使用Telethon库自动从电报朋友那里刮擦和下载故事。该剧本继续并从故事中保存了照片和视频以及他们的元数据。
关于故事访问的重要说明️
由于电报API限制,此脚本只能访问:的故事- 您已添加到朋友列表中的用户- 其隐私设置允许您查看其故事的用户
这是电报API的限制,无法绕过。
功能
Automatically scrapes all available stories from your Telegram friends Downloads both photos and videos from stories Stores metadata in SQLite database Exports data to Excel spreadsheet Real-time monitoring with customizable intervals Timestamp is set to (UTC+2) Maintains record of previously downloaded stories Resume capability Automatic retry mechanism
先决条件
Before running the script, you'll need:
python 3.7或更高的电报帐户帐户API凭据来自电报上的电报朋友,您想跟踪
需要Python软件包
pip install -r unigess.txt insupper.txt:
电视
OpenPyXl
附表
获取电报API凭据
访问https://My.telegram.org/auth登录您的电话号码单击“ API开发工具”填写form: App title3:您的应用程序名称harp name sharp name name name name name short short short short short name platflorm:可以将'desktop'spection 3: appi platsion 3: appi prospi'plats : appi trick 3 trick 3创建,即一个数字API_HASH:一字母的字母和数字确保这些凭据安全,您将需要它们运行脚本!
010-110克隆仓库: git克隆3https://github.com/unnohwn/telegram-story-scraper.git.git
cd telegram-story-scraper Install requirements: pip install -r requirements.txt Run the script: python TGSS.py On first run, you'll be prompted to enter: Your API ID Your API Hash Your phone number (with country code) Verification code (sent to your Telegram) Checking interval in seconds (default is 60)
设置和运行
The script: 1. Connects to your电报帐户2。定期检查您的朋友的新故事3。下载任何新故事(照片/视频)4。在SQLITE数据库5中存储元数据。将信息导出到Excel文件6。连续运行直至中断(CTRL+C)
它如何工作
010-110 SQLITE数据库包含: -USER_ID:故事创建者的Telegram用户ID -story_id:独特的故事标识符-TimestAmp: timestamp:故事时(utc+2) - filename 3333333333333333333333333333333333333333333:
数据存储
导出文件包含与数据库相同的信息,有用的:-轻松查看故事元数据- 过滤和排序- 数据分析- 与他人共享数据
数据库结构(Stories.db)
照片保存为AS: {user_id} _ {story_id} .jpg视频。 (违约: 60秒)持续持续到直到手动停止保持状态之间的状态避免下载
CSV和Excel Export(story_export.csv/xlsx)
同时支持照片和视频自动检测媒体类型可在原始质量中生成唯一的fileNames生成唯一的文件名生成唯一的文件名:01010-010-1110脚本包括: - 自动重新误差- 误差- 误差- 误差- 误差- 误差- 借用误差- 中断
媒体存储
受电报的速率限制故事必须目前处于活动状态(未过期)媒体下载尺寸限制根据电报的限制适用
详细功能
捐款!请随时提交拉动请求。
连续监视
此项目是根据MIT许可证获得许可的- 有关详细信息,请参见许可证文件。
媒体处理
此工具仅用于教育目的。确保TO :-尊重Telegram的服务条款- 在刮擦之前获得必要的权限- 使用负责任和道德- 遵守数据保护法规- 尊重用户隐私
Recommended Comments