
Best Twitter Scraper
- zhangzhenhu/best-twitter-scraper
- Modified
- Users 95
- Runs 256
- 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.
from apify_client import ApifyClient
# Initialize the ApifyClient with your API token
client = ApifyClient("<YOUR_API_TOKEN>")
# Prepare the Actor input
run_input = {
"login_user": "HuZhang18851",
"login_password": "r7pkkp22",
"names": ["elonmusk"],
"tweet_urls": [],
"search_urls": [],
}
# Run the Actor and wait for it to finish
run = client.actor("zhangzhenhu/best-twitter-scraper").call(run_input=run_input)
# Fetch and print Actor results from the run's dataset (if there are any)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item)