<!DOCTYPE html>
<html>
<head>
<title>JS Scrape Example</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$.get('https://cors-anywhere.herokuapp.com/http://www.whoishostingthis.com/?q=mybb.com', function(response) {
var selector = '#site > div > div > div.pure-u-1.pure-u-lg-1-3.cloudflare > div > div:nth-child(3) > ul > li:nth-child(1) > a';
var info = $(selector).first();
console.log(info);
});
</script>
</body>
</html>
I’m working on the above code. The goal being to scrape the webhost (in this case Cloudflare). I have the selector found through Chrome’s developer console. However I cannot use javascript’s built in querySelector on the value of a variable (Even though it’s HMTL). What is the best way to go about continuing to scrape this information?