Skip to content

Instantly share code, notes, and snippets.

/**
* ③最新のツイートをリツイートする
*/
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,
/**
* ③最新のツイートをリツイートする
*/
function retweetLatest () {
// 最新のツイートのツイートIDを取得する(バージョン25以前)
// ※ 26以降は https://gist.github.com/belltreeSzk/3c183b88e7e99d634c5e3ac1ed7fc9b5 のコードを使ってください
const accountName = 'belltreeszk' // 対象のアカウントの @~~~~ の部分を記入
const includeRT = false // RTを含むか(他のユーザーのツイートのRTも再度RTします)
const retweetCount = 3 // 直近何件のツイートをRTするか
const tweetIds = client.pickupTweetsLatest(accountName, includeRT, retweetCount);
/**
* ③最新のツイートをリツイートする 動くには動くけど非推奨
*/
function retweetLatest () {
// 1人目
// 最新のツイートのツイートIDを取得する
const accountName = 'belltreeszk' // 対象のアカウントの @~~~~ の部分を記入
const includeRT = false // RTを含むか(他のユーザーのツイートのRTも再度RTします)
const retweetCount = 5 // 直近何件のツイートをRTするか
const tweetIds = client.pickupTweetsLatest(accountName, includeRT, retweetCount);
/**
* ③最新のツイートをリツイートする
*/
function retweetLatest () {
// 最新のツイートのツイートIDを取得する
const accountNames = ['belltreeszk', 'belltreeszk2'] // 対象のアカウントの @~~~~ の部分を記入
for (let i in accountNames) {
const accountName = accountNames[i];
const includeRT = false // RTを含むか(他のユーザーのツイートのRTも再度RTします)
/**
* シートに記載された人をアンフォロー
*/
function unFollowFromSheet () {
const ignoreUserIds = [];
const whiteUserIds = TwitterClient.getUserIdsFromSheet('ホワイトリスト');
for (let i in whiteUserIds) {
// [[123456],[234567],…] という形式で入っているのでIDだけ取り出して ignoreUserIds に入れる
ignoreUserIds.push(whiteUserIds[i][0].toString());
/**
* シートに記載された人をアンフォロー
*/
function unFollowFromSheet () {
const ignoreUserIds = ['123456789','987654321'];
// 1列目に書かれたIDからユーザー情報を取得する
const userIds = TwitterClient.getUserIdsFromSheet('シート1');
// indexOf()とspliceを使う方法
function searchAndFavorite () {
// client.findRecentTweet('検索したいワード'); で検索のデータを取得できます。
const result = client.findRecentTweet('コロナ');
// Logger.log(result); 等で {statuses=[{truncated=false, .... というTweetデータが取れます。
// 長すぎてよくわからないと思うのですが、公式ページに見やすくまとまっています
// https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets
// result という変数の 'statuses' というデータの中に入っている [] は配列です
//
<template>
<div class="container">
<!--Add buttons to initiate auth sequence and sign out-->
<button id="authorize_button">Authorize</button>
<button id="signout_button">Sign Out</button>
<pre id="content" style="white-space: pre-wrap;"></pre>
</div>
</template>
<script>
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
window.Vue = require('vue');
@extends('layouts.app')
@section('content')
<div class="container">
<!-- Google Auth Component を表示 -->
<google-auth-component></google-auth-component>
</div>
@endsection