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 retweetLatest () { | |
// 最新のツイートのツイートIDを取得する | |
const accountName = 'belltreeszk' // 対象のアカウントの @~~~~ の部分を記入 | |
const includeRT = false // RTを含むか(他のユーザーのツイートのRTも再度RTします) | |
const retweetCount = 3 // 直近何件のツイートをRTするか | |
const tweetIds = client.pickupTweetsLatest(accountName, includeRT, retweetCount); |
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
// https://gist.github.com/belltreeSzk/b75f6cc57952246a35d6b6c79613ed28#file-gas-5-gs を変える | |
// ② Twitterで検索する | |
var tweetList = findTweets(searchWord, lastTweetId); // ※検索処理は割愛してるので各自作ってください | |
var count = 0 | |
// ③ 複数件ツイートを取得されるので for を使って1つずつツイートを取り出し いいね or RT をする | |
for (var j = 0, jl = tweetList.length; j < jl; j++ ) { | |
var tweet = tweetList[j]; | |
if (tweet.id_str > lastTweetId) { |
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 () { | |
// ブログで紹介しているシートから自動で抽出する方法でもいけるが、、、 | |
// client.postTweetWithMedia() | |
// もっとカスタマイズしやすい形に書き換えると以下のようになる | |
// GoogleドライブのURLに含まれている fileId を入れる | |
const fileIds = ['1IPGGgjshkLFoAfJKVu4DO-cokVkFGL7p']; | |
const mediaIds = []; | |
for (let i in fileIds) { |
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
const CONSUMER_KEY = 'XXXXXXXXXXXXXXXXXXX'; | |
const CONSUMER_SECRET = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; | |
const client = TwitterClient2.getInstance(CONSUMER_KEY, CONSUMER_SECRET) | |
/** | |
* メイン処理 | |
*/ | |
function main() { | |
const data = GasBotKit.pickUpDataInOrder('シート1'); |
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 addFollowUserToList () { | |
// === ここだけ編集してください === | |
// LIST_ID をリストページのURLから取ってくる | |
// 例) https://twitter.com/i/lists/1474779699952119808 ←ここの部分 | |
const LIST_ID = '********'; | |
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
// 'use strict'; | |
const consumerKey = 'CONSUMER_KEY' | |
const consumerSecret = 'CONSUMER_SECRET' | |
const client = TwitterClient.getInstance(consumerKey, consumerSecret) | |
/** | |
* ①Twitterで作ったアプリに登録するための callbackUrl を取得する | |
* 実行後 『表示』→『ログ』でURLを確認してTwitterアプリに登録 |
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
// 'use strict'; | |
const consumerKey = 'CONSUMER_KEY' | |
const consumerSecret = 'CONSUMER_SECRET' | |
const client = TwitterClient.getInstance(consumerKey, consumerSecret) | |
/** | |
* ①Twitterで作ったアプリに登録するための callbackUrl を取得する | |
* 実行後 『表示』→『ログ』でURLを確認してTwitterアプリに登録 |
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
'use strict'; | |
const consumerKey = 'CONSUMER_KEY' | |
const consumerSecret = 'CONSUMER_SECRET' | |
const client = TwitterClient.getInstance(consumerKey, consumerSecret) | |
/** | |
* ①Twitterで作ったアプリに登録するための callbackUrl を取得する | |
* 実行後 『表示』→『ログ』でURLを確認してTwitterアプリに登録 |
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
'use strict'; | |
const consumerKey = 'CONSUMER_KEY' | |
const consumerSecret = 'CONSUMER_SECRET' | |
const client = TwitterClient.getInstance(consumerKey, consumerSecret) | |
/** | |
* ①Twitterで作ったアプリに登録するための callbackUrl を取得する |
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 retweetLatest () { | |
// https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-members | |
// というAPIを使ってリストのメンバー一覧を取得する | |
const listId = '*************' // リストのURLの https://twitter.com/i/lists/******** ←の数字 | |
const listMemberUrl = 'https://api.twitter.com/1.1/lists/members.json'; | |
const listMemberParam = { | |
list_id: listId, |