agent-twitter-client:无需Twitter API密钥,发送、转发推文

최신 AI 도구4개월 전 업데이트 Sharenet.ai
846 0
吐司AI

일반 소개

agent-twitter-client是一个无需Twitter API密钥即可使用的Twitter客户端。该项目基于@the-convocation/twitter-scraper进行了修改,增加了发送推文和转推的功能。它可以在浏览器和服务器上运行,适用于需要自动化Twitter操作的用户。通过配置环境变量进行身份验证,用户可以轻松地发送推文、获取推文和进行其他Twitter操作。

agent-twitter-client:无需Twitter API密钥,发送、转发推文

 

기능 목록

  • 发送推文和转推
  • 获取特定用户的推文
  • 获取推文及其回复
  • 获取最新推文
  • 使用Twitter API v2进行推文和投票功能
  • 支持代理请求
  • 获取Twitter Cookies以避免频繁登录

 

도움말 사용

설치 프로세스

  1. 프로젝트 웨어하우스 복제:
   git clone https://github.com/elizaOS/agent-twitter-client.git
  1. 프로젝트 카탈로그로 이동합니다:
   cd agent-twitter-client
  1. 종속성을 설치합니다:
   npm install

환경 변수 구성

프로젝트 루트 디렉터리에서.env文件,并添加以下内容:

TWITTER_USERNAME=你的Twitter用户名
TWITTER_PASSWORD=你的Twitter密码
TWITTER_EMAIL=你的Twitter邮箱
PROXY_URL=你的代理URL(如果需要)
TWITTER_API_KEY=你的Twitter API密钥
TWITTER_API_SECRET_KEY=你的Twitter API密钥
TWITTER_ACCESS_TOKEN=你的Twitter访问令牌
TWITTER_ACCESS_TOKEN_SECRET=你的Twitter访问令牌密钥

사용 예

获取推文

const { Scraper } = require('agent-twitter-client');
const scraper = new Scraper();
(async () => {
await scraper.login('你的用户名', '你的密码');
const tweets = await scraper.getTweets('elonmusk', 10);
console.log(tweets);
})();

发送推文

const { Scraper } = require('agent-twitter-client');
const scraper = new Scraper();
(async () => {
await scraper.login('你的用户名', '你的密码');
await scraper.sendTweet('Hello world!');
})();

获取最新推文

const { Scraper } = require('agent-twitter-client');
const scraper = new Scraper();
(async () => {
await scraper.login('你的用户名', '你的密码');
const latestTweet = await scraper.getLatestTweet('elonmusk');
console.log(latestTweet);
})();

세부 기능

  1. 发送推文和转推:用户可以通过配置环境变量进行身份验证,然后使用sendTweet方法发送推文,或使用sendRetweet方法进行转推。
  2. 获取推文사용getTweets方法可以获取特定用户的推文,getTweetsAndReplies方法可以获取推文及其回复。
  3. 获取最新推文사용getLatestTweet方法可以获取特定用户的最新推文。
  4. 使用Twitter API v2:通过配置Twitter API v2的密钥和令牌,用户可以使用sendTweetV2方法发送带有投票功能的推文。
  5. 代理请求:支持通过配置PROXY_URL环境变量来使用代理进行请求。
  6. 获取Twitter Cookies사용getCookies方法获取Twitter Cookies,以避免频繁登录。
© 저작권 정책
AiPPT

관련 문서

댓글 없음

없음
댓글 없음...