Open iannono opened 6 months ago
https://developer.twitter.com/en/docs/authentication/oauth-2-0/bearer-tokens
curl -u "$API_KEY:$API_SECRET_KEY" \
--data 'grant_type=client_credentials' \
'https://api.twitter.com/oauth2/token'
https://github.com/brtr/twitter-gpt/issues/5#issuecomment-2076261972
import asyncio
import aiofiles
import datetime
from twscrape import API, gather
from twscrape.logger import set_log_level
async def main():
api = API() # or API("path-to.db") - default is `accounts.db`
# ADD ACCOUNTS (for CLI usage see BELOW)
await api.pool.add_account(
"xxxxx@xxx.com", "supersecurepassword", "xxxxx@xxx.com", "mail_pass1"
)
await api.pool.login_all()
# list info
list_id = 1464100857402769409 # https://twitter.com/i/lists/1464100857402769409
# await gather(api.list_timeline(list_id))
current_date = datetime.datetime.now().strftime("%Y-%m-%d")
filename = f"tweets_{list_id}_{current_date}.txt"
async with aiofiles.open(filename, "a") as file:
async for tweet in api.list_timeline(list_id, limit=100):
await file.write(str(tweet.json()) + "\n")
print(tweet.json())
# print(tweet.id, tweet.user.username, tweet.rawContent)
print("=====================================")
if __name__ == "__main__":
asyncio.run(main())
tweets_1464100857402769409_2024-05-03.txt
curl "https://api.socialdata.tools/twitter/lists/show?id=1464100857402769409" \
-H 'Authorization: Bearer API_KEY' \
-H 'Accept: application/json' \
Background
bitcoin 最近怎么样?
(knowledge base)Design
定时下载: https://twitter.com/i/lists/1762857078656532875
ssh deploy@57.180.63.58
新主机
i-0adad346a9973642c, 57.180.63.58, 172.31.23.201
DONE:
请尝试通过 twitter 的 api 实现用户 tweets 的拉取。 如果需要, 可以尝试下面的 key: