Rinser/fixer.js

195 lines
5.8 KiB
JavaScript
Raw Normal View History

2017-09-11 10:34:45 +00:00
const querystring = require('querystring');
2017-09-11 11:29:20 +00:00
const url = require('url');
2017-09-11 10:34:45 +00:00
let list = [
2017-10-01 17:25:17 +00:00
2017-12-05 11:54:53 +00:00
{
2017-10-01 17:25:17 +00:00
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobsite.co.uk/cgi-bin/advsearch?rss_feed=1&daysback=1&jbe_id=47820652"
} ,
2017-10-01 17:25:17 +00:00
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobserve.com/MySearch/6DA9769BA89834AA.rss"
} ,
2017-10-01 17:25:17 +00:00
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.JobServe.com/MySearch/EDF47BEA6B31EF.rss"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.JobServe.com/MySearch/3CAD044BEF2BFA.rss"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.JobServe.com/MySearch/C7B25D86D0844A.rss"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.JobServe.com/MySearch/64A3EEF615FA4C.rss"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobsite.co.uk/cgi-bin/advsearch?rss_feed=1&daysback=1&jbe_id=21564698"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobsite.co.uk/cgi-bin/advsearch?rss_feed=1&daysback=1&jbe_id=21564712"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobsite.co.uk/cgi-bin/advsearch?rss_feed=1&daysback=1&jbe_id=21942123"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobsite.co.uk/cgi-bin/advsearch?rss_feed=1&daysback=1&jbe_id=33166238"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobsite.co.uk/cgi-bin/advsearch?rss_feed=1&daysback=1&jbe_id=34888173"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.s1jobs.com/xml/m7dp711z2r.xml"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.s1jobs.com/xml/pfvf7o7z2r.xml"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.s1jobs.com/xml/lluqnt8z2r.xml"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.s1jobs.com/xml/tu33qt8z2r.xml"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.s1jobs.com/xml/u3btnz8z2r.xml"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.purelyit.co.uk/cgi-bin/advsearch?rss_feed=1&daysback=1&jbe_id=33256062"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.purelyit.co.uk/cgi-bin/advsearch?rss_feed=1&daysback=1&jbe_id=33450169"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.purelyit.co.uk/cgi-bin/advsearch?rss_feed=1&daysback=1&jbe_id=34517029"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.purelyit.co.uk/cgi-bin/advsearch?rss_feed=1&daysback=1&jbe_id=34888105"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.technojobs.co.uk/rss.php/glasgow/searchtypeand/locationScotland/sortbyrelevant/jobtypeall"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobserve.com/MySearch/6FC7E9ED5F042ECB.rss"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobsite.co.uk/cgi-bin/advsearch?rss_feed=1&skill_atleast=html,%20asp,%20web,%20sql,%20delphi,%20vb,%20vbscript,%20php,%20ajax,%20mysql,%20sqlserver,%20javascript,%20intranet,%20vmware,%20virtulization&location_include=Abu%20Dhabi&compare_resolved=RE_ABUDHABI_UNITEDARABEMIRATES&compare_search=Abu%20Dhabi&jobtype=X&search_emp_mkt_cd=ALL"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobsite.co.uk/cgi-bin/advsearch?rss_feed=1&skill_atleast=html%20,%20asp%20,%20web%20,%20sql%20,%20delphi%20,%20vb%20,%20vbscript%20,%20php%20,%20ajax%20,%20mysql%20,%20sqlserver%20,%20javascript%20,%20intranet%20,%20vmware%20,%20virtulization&location_include=London&location_within=10&reqd_salary=ANY|&daysback=7&scc=UK&compare_resolved=CO_LONDON&compare_search=London&search_emp_mkt_cd=ALL"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobsite.co.uk/cgi-bin/advsearch?rss_feed=1&skill_atleast=html%20,%20asp%20,%20web%20,%20sql%20,%20delphi%20,%20vb%20,%20vbscript%20,%20php%20,%20ajax%20,%20mysql%20,%20sqlserver%20,%20javascript%20,%20intranet%20,%20vmware%20,%20virtulization&location_include=Glasgow&location_within=10&reqd_salary=ANY|&daysback=7&scc=UK&compare_resolved=TO_G1_GLASGOW&compare_search=Glasgow&search_emp_mkt_cd=ALL"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobsite.co.uk/cgi-bin/advsearch?rss_feed=1&skill_atleast=html%20,%20asp%20,%20web%20,%20sql%20,%20delphi%20,%20vb%20,%20vbscript%20,%20php%20,%20ajax%20,%20mysql%20,%20sqlserver%20,%20javascript%20,%20intranet%20,%20vmware%20,%20virtulization&location_within=10&reqd_salary=ANY|&daysback=7&scc=UK&search_emp_mkt_cd=ALL"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobsite.co.uk/cgi-bin/advsearch?rss_feed=1&skill_atleast=html%20,%20asp%20,%20web%20,%20sql%20,%20delphi%20,%20vb%20,%20vbscript%20,%20php%20,%20ajax%20,%20mysql%20,%20sqlserver%20,%20javascript%20,%20intranet%20,%20vmware%20,%20virtulization&location_include=Germany&location_within=10&reqd_salary=ANY|&daysback=7&scc=UK&compare_resolved=CY_GERMANY&compare_search=Germany&search_emp_mkt_cd=ALL"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.s1jobs.com/xml/b1d7e6c3a9a11964z3r.xml"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.s1jobs.com/xml/b1d7e6c3a9a11964z3r.xml"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.jobserve.com/MySearch/CA49421A86CA3F74.rss"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.s1jobs.com/xml/ddeded091b6f6d33z3r.xml"
2017-10-01 17:25:17 +00:00
},
{
"count": 100,
2017-12-05 11:54:53 +00:00
"feed_url": "http://www.s1jobs.com/xml/3eafc1ea20f1ca02z3r.xml"
2017-10-01 17:25:17 +00:00
}
2017-12-05 11:54:53 +00:00
2017-10-01 17:25:17 +00:00
];
2017-09-11 10:34:45 +00:00
let newArray = list.map((item) => {
2017-09-11 11:29:20 +00:00
let u = url.parse(item.feed_url);
let newUrl = item.feed_url;
2017-09-11 11:31:41 +00:00
if (u.host !== '') {
2017-09-11 11:29:20 +00:00
newUrl = `http://52.211.105.9:6566/${querystring.escape(item.feed_url)}`;
}
2017-09-11 13:55:11 +00:00
return newUrl
2017-09-11 10:34:45 +00:00
});
2017-09-11 13:55:11 +00:00
console.log('New array', newArray.length);
let unique = [];
for (let item of newArray) {
if (unique.indexOf(item) === -1) {
unique.push(item);
}
}
console.log('unique', unique.length);
2017-09-11 10:34:45 +00:00
2017-09-11 13:55:11 +00:00
unique = unique.map((item) => {
return {'count':100, 'feed_url':item};
})
console.log(JSON.stringify(unique));