Commit 4c991d13 authored by Alexandra's avatar Alexandra

sitemap test results

parent b0c24209
file name,items,items in index,title found,content complete
./files/SITEMAP/sitemap_control.xml,100,100,true,true
./files/SITEMAP/bad_formatting.xml,bad formatting,1,true,true
./files/SITEMAP/list.xml,11,10,true,true
./files/SITEMAP/sitemap_control.xml,10,10,true,true
./files/SITEMAP/unrecognized.xml,bad formatting,Error : no links found
......@@ -49,13 +49,20 @@ function run(script, files, stream, callback){
fs.readFile(to_run, (err, data) => {
if (to_run.includes("rss") || to_run.includes("atom")){
rss_parser.parseString(data, (err, result) => {
if(err) stream.write(to_run + "," + "bad formatting" + "," + mes);
if(err) stream.write(to_run + "," + "bad formatting" + "," + mes + "\n");
else stream.write(to_run +","+ result.items.length +","+ mes + "\n");
});
} else {
xml_parser(data, (err, result) => {
if(err) stream.write(to_run + "," + "bad formatting" + "," + mes);
else stream.write(to_run +","+ result.urlset.url.length.toString() +","+ mes + "\n");
if(err){
var data_lines = data.toString().split("\n");
if (data_lines[0].includes("https://") || data_lines[0].includes("http://"))
stream.write(to_run + "," + data_lines.length + "," + mes + "\n")
else stream.write(to_run + "," + "bad formatting" + "," + mes + "\n");
} else {
if (result.urlset) stream.write(to_run +","+ result.urlset.url.length.toString() +","+ mes + "\n");
else stream.write(to_run + "," + "bad formatting" + "," + mes + "\n");
}
});
}
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment