ymsoft/telegram-channel-scrapper
Composer 安装命令:
composer require ymsoft/telegram-channel-scrapper
包简介
Public telegram channel scrapper.
README 文档
README
Public telegram channels scrapper
This package is intended for those who need to efficiently scrape a public telegram channel. This is done quite easily:
use Ymsoft\TelegramChannelScrapper\TelegramCS; $scrapper = new TelegramCS('channel_name'); /** @var \Ymsoft\TelegramChannelScrapper\Entity\Channel $channel */ $channel = $scrapper->getChannel(); /** * By default, you will scrap the latest 20 messages. * @var \Illuminate\Support\Collection<\Ymsoft\TelegramChannelScrapper\Entity\Message\Message> $messages */ $messages = $scrapper->getMessages(); $messages->count(); // will return 20 // In order to download 20 more messages you need $scrapper->loadPrevMessages(); $scrapper->getMessages()->count() // will return 40 // You can download old messages endlessly until you download everything.
Since this package uses illuminate/collections you can use all the methods described here to work with a collection of messages.
/** * @var \Illuminate\Support\Collection<\Ymsoft\TelegramChannelScrapper\Entity\Message\Message> $messages */ $messages = $service->getMessage(); $messages->all(); $messages->count(); $messages->toArray(); $messages->firstWhere('id', 1); $messages->last(); $messages->first(); // and much more https://laravel.com/docs/10.x/collections#available-methods
Channel
View all entity attributes Channel.
Message
View all entity attributes Message.
Installation
You can install the package via composer:
composer require ymsoft/telegram-channel-scrapper
Advanced usage
Scrap special message by concrete id
If you know the message ID you can get it:
use Ymsoft\TelegramChannelScrapper\TelegramCS; $service = new TelegramCS('channel_name'); /** @var \Ymsoft\TelegramChannelScrapper\Entity\Message\Message $message */ $message = $service->getMessageById(1);
Http client (CUSTOM HEADERS & PROXY)
If you want to add your own headers or make requests through a proxy, you can pass your http client instance as the second parameter:
use Ymsoft\TelegramChannelScrapper\TelegramCS; /* * You can provide any http client that implements psr/http-client * Psr\Http\Client */ $client = new \GuzzleHttp\Client([ 'headers' => [ 'Accept-Language' => 'en-US,en;q=0.9', 'Accept' => 'text/html', ], 'proxy' => 'http://localhost:8125', ]); $service = new TelegramCS('channel_name', $client);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Thank you for considering contributing to the TelegramCS Package!
License
The MIT License (MIT). Please see License File for more information.
ymsoft/telegram-channel-scrapper 适用场景与选型建议
ymsoft/telegram-channel-scrapper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 11 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「message」 「scrapper」 「telegram」 「channle」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ymsoft/telegram-channel-scrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ymsoft/telegram-channel-scrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ymsoft/telegram-channel-scrapper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Search engine scrapper
PHP AMQP Binding Library
Laravel 5.6 Monolog custom telegram channel
PHP Wrapper for Telegram Bot API
Message queue statistics for OroPlatform
Behat extention for RabbitMQ
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-16