1const puppeteer = require('puppeteer')
2const $ = require('cheerio')
3
4(async () => {
5 const browser = await puppeteer.launch()
6 const page = await browser.newPage()
7 await page.goto('https://www.imdb.com/title/tt7126948/?ref_=nv_sr_srsg_0', { waitUntil: 'networkidle0' })
8
9 const content = await page.evaluate(() => document.body.innerHTML)
10 const data = $('div[class="title_wrapper"]', content).find('h1').text()
11
12 console.log(data)
13
14 await browser.close()
15})()
1//eventhough deprecated, still able to use
2const request = require('request');
3request('http://www.google.com', function (error, response, body) {
4 console.error('error:', error); // Print the error if one occurred
5 console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
6 console.log('body:', body); // Print the HTML for the Google homepage.
7});