Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

cheerio library to parse the meta tags in url



request('https://example.com', function (error, response, html) {
  if (!error && response.statusCode == 200) {
    const $ = cheerio.load(html);
      console.log($("meta[property='og:title']").attr("content"));
      //or 
      console.log($("meta").get(1).attr("content")); // index of the meta tag
  }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery select element inside element 
Javascript :: react native camscanner application mobile code 
Javascript :: check whether array ascending 
Javascript :: pass object in asyncstorage in react native 
Javascript :: reactjs svg SyntaxError: unknown: Namespace tags are not supported by default 
Javascript :: react native communicate with webview 
Javascript :: waypoint 
Javascript :: nodejs mysql error handling with user example 
Javascript :: delete an item from array javascript 
Javascript :: script defer attribute 
Javascript :: rc-notification react 
Javascript :: javascript max date 
Javascript :: express and node pakages 
Javascript :: rating calculator formula javascript 
Javascript :: javascript reduce return array 
Javascript :: promises in es6 
Javascript :: Shallow copy Objects using Object.prototype.assign method 
Javascript :: hook use effect with hooks 
Javascript :: node.js upload files 
Javascript :: react-with-firebase-auth 
Javascript :: how to use jquery plugins in angular 8 
Javascript :: array.splice 
Javascript :: how to disable menu bar in browser using javascript 
Javascript :: useref react class component 
Javascript :: javascript stringify blob 
Javascript :: submit form jquery browser check 
Javascript :: what is vue.js 
Javascript :: perfect scrollbar jquery 
Javascript :: summernote mentions ajax 
Javascript :: how to wait till jquery post request has been made 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =