crocone/php-telegram-channel-scraper

1.0.1 2020-06-10 23:16 UTC

This package is auto-updated.

Last update: 2024-09-11 14:48:32 UTC


README

一个不登录即可使用的纯PHP Telegram频道爬虫库!!

安装

composer require faryar76/php-telegram-scrapper

使用

从主类创建实例
require __DIR__."/vendor/autoload.php";
use Faryar76\TlgScrapper;

$tlg=new TlgScrapper();
$tlg->load('a-telegram-channel-username');

频道信息

$tlg->getName();          // channel name 
$tlg->getDescription();   // channel description  
$tlg->getimage();         // channel image  
$tlg->getMemmbercount();  // channel Memmbers count
$tlg->getLinkcount();     // channel links count
$tlg->getVideocount();    // channel videos count
$tlg->getPhotocount();    // channel photos count

获取最后20条帖子

$tlg->getMessages();

通过post_id获取帖子

$tlg->getMessages(25);

获取帖子数据

$tlg->getMessages()->first()->date;   //posts created at

$tlg->getMessages()->first()->views;  //posts view count

$tlg->getMessages()->first()->text;   //posts content as text