
Best Twitter Scraper
- zhangzhenhu/best-twitter-scraper
- Modified
- Users 66
- Runs 210
- Created by
zhang zhenhu
Twitter scraper that scrapes the latest Twitter content of any user. Since you need to be logged in to Twitter to crawl, you need to provide a Twitter account. Twitter 抓取器,可以抓取任意用户最新的Twitter内容。 因为需要先登录 Twitter 才能抓取,所以需要提供一个 Twitter 的账号。
To run the code examples, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token. For a more detailed explanation, please read about running Actors via the API in Apify Docs.
import { ApifyClient } from 'apify-client';
// Initialize the ApifyClient with API token
const client = new ApifyClient({
token: '<YOUR_API_TOKEN>',
});
// Prepare Actor input
const input = {
"login_user": "HuZhang18851",
"login_password": "r7pkkp22",
"names": [
"elonmusk"
],
"tweet_urls": [],
"search_urls": []
};
(async () => {
// Run the Actor and wait for it to finish
const run = await client.actor("zhangzhenhu/best-twitter-scraper").call(input);
// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
console.dir(item);
});
})();