alexa

Extract src of <img> element (selected by class) from multiple HTML pages in node.js ?

Extract src of <img> element (selected by class) from multiple HTML pages in node.js ?

To Extract src of <img> element (selected by class) from multiple HTML pages in node.js use the following steps:-

  1. Download each page in a loop with AJAX.
  2. Parse the DOM with something like jsdom.
  3. Use a selector with [querySelectorAll()].(https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) to get each image element.
  4. Use a regular expression on the image src-attribute to get the robot name. Like: $img.src.match(/([^\/]+).png$/i)[1].
  5. Download all the robots with AJAX.
  6. Combine robot name and downloaded robot to an object with key value pairs.

Let me know if you need more help or a code example.


195 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online

Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry