Skip to content

Commit 0301391

Browse files
author
code-reaper08
committed
URL checker implemented
1 parent e1d711c commit 0301391

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

scrape.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const request = require('request');
22
const cheerio = require('cheerio');
33

4-
request('https://github.com/code-reaper08/markdownpedia/blob/main/README.md', (error,response,html) =>{
4+
request('https://github.com/code-reaper08/Know-ASCII/blob/main/README.md', (error,response,html) =>{
55
if(!error && response.statusCode == 200) {
66
const $ = cheerio.load(html);
77
const linkObjects = $('#readme > article').children().find('a');
@@ -17,8 +17,16 @@ request('https://github.com/code-reaper08/markdownpedia/blob/main/README.md', (e
1717
// console.log(links);
1818
// var arrayLength = myStringArray.length;
1919
for (let i = 0; i <len ; i++) {
20-
console.log("loop running")
21-
console.log(links[i]);
20+
// console.log("loop running")
21+
const hrefs = links[i].href;
22+
request(hrefs,(error,response,html) => {
23+
if(!error && response.statusCode == 200) {
24+
console.log(hrefs,' Success');
25+
}
26+
else if(!error && response.statusCode != 200) {
27+
console.log(hrefs,' Failure');
28+
}
29+
})
2230
//Do something
2331
}
2432
// console.log(links[8]);

0 commit comments

Comments
 (0)