alexroan/twitter-scraper

从用户的个人资料中抓取推文

dev-master 2018-06-01 17:12 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:09:13 UTC


README

在不使用API凭证的情况下从用户的公共个人资料中抓取推文

安装

Composer

composer require alexroan/twitter-scraper

使用

//get feed
$feed = Twitter_Scraper::get_feed('alexroan');

//loop through posts
foreach($feed as $tweet){ 

    //tweet id
    $id = $tweet->id;

    //username of tweeter
    $username = $tweet->username;

    //bool whether retweet or not
    $is_retweet = $tweet->is_retweet;

    //body text of tweet
    $text = $tweet->text;

    //time tweeted
    $time = $tweet->time;

    //any media in tweet
    $media = $tweet->media;

    //number of replies
    $reply = $tweet->reply;

    //number of retweets
    $retweet = $tweet->retweet;

    //number of favourites
    $favourite = $tweet->favourite;

}