const axios = require('axios');
(async () => {
// JavaScript
const tag = 'JavaScript';
const base_url = `https://qiita.com/api/v2/tags/${tag}/items?page=1&per_page=20`;
const res = await axios.get(base_url, {
params: {},
headers: {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36',
},
});
if (res.status !== 200) {
return;
}
res.data.map(m => {
console.log(m.title);
console.log(new Date(m.created_at));
console.log(m.url);
console.log();
});
})();