Last active
May 23, 2022 20:36
-
-
Save tajuszk/07486c8ff5ae1dfb0797b97da84b49be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main () { | |
// 最新のツイートのツイートIDを取得する | |
const accountName = '~~~~~~~' // 対象のアカウントの @~~~~ の部分を記入 | |
const params = { | |
includeRT: false, // RTを含むか(他のユーザーのツイートのRTも再度RTします) | |
includeReply: false, // リプライを含むか | |
includeURL: false, // URLを含むか | |
count: 20, // 直近何件のツイートをRTするか | |
} | |
const tweetIds = client.pickupTweetsLatest(accountName, params); | |
// ==== ここからチェック用コード ==== | |
const testParams = []; | |
const tweetShowUrl = 'https://api.twitter.com/1.1/statuses/show.json'; | |
for (let i = tweetIds.length - 1; i >= 0; i--) { | |
const tweetShowParam = { | |
id: tweetIds[i], | |
tweet_mode: 'extended' // URLが省略されていることがあるので | |
} | |
const tweetShowResult = client.getRequest(tweetShowUrl, tweetShowParam); | |
const urls = tweetShowResult.entities.urls; | |
testParams.push({ | |
url: 'https://twitter.com/' + accountName + '/status/' + tweetShowResult.id_str, | |
text: tweetShowResult.full_text, | |
link: urls.length > 0 ? 'リンクあり' : 'リンクなし', | |
media: tweetShowResult.entities.media !== undefined ? '動画あり' : '動画なし', | |
}); | |
} | |
console.log('今回のリツイート対象はこちら↓'); | |
console.log(testParams); | |
// ==== ここまでチェック用コード ==== | |
// 受け取ったツイートIDのツイートをすべてリツイートする | |
// client.retweet(tweetIds) // 使う時はコメント外してください | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment