gistlib
index.tsxconst axios = require('axios'); const cheerio = require('cheerio'); const url = 'https://news.ycombinator.com/'; axios.get(url) .then(response => { const html = response.data; const $ = cheerio.load(html); $('.title a').each((index, element) => { console.log($(element).text()); }); }) .catch(error => { console.log(error); }); 367 chars18 lines
const axios = require('axios'); const cheerio = require('cheerio'); const url = 'https://news.ycombinator.com/'; axios.get(url) .then(response => { const html = response.data; const $ = cheerio.load(html); $('.title a').each((index, element) => { console.log($(element).text()); }); }) .catch(error => { console.log(error); });
gistlibby LogSnag