node.js
const needle = require("needle"); const token = process.env.BEARER_TOKEN; // bearer_tokenを環境変数で設定しておく const endpointUrl = "https://api.twitter.com/2/tweets/search/recent"; async function getRequest() { const params = { query: "…
環境設定 You will need to have Node.js installed to run this code. All Node.js examples use needle as the HTTP client, which needs to be npm installed. For OAuth with user context requests, you'll need to install the got and oauth-1.0a pac…
console.time()とconsole.timeEnd()を併用することで、 この2つに挟まれたプログラムの実行時間を計測することができる。 console.time('timer name') //ここの処理をタイマーで測定 let sum = 0; for(let i = 0; i<10000; i++){ sum += Math.random() } //…
twitter.js var Twitter = require('twitter'); var client = new Twitter({ consumer_key: '', consumer_secret: '', access_token_key: '', access_token_secret: '' }); client.get('search/tweets', { q: 'twitterアカウント名' }, function (error, twe…