Skip to content

Commit

Permalink
remove not valid TLD and second level TLD domains
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliytv committed Oct 14, 2019
1 parent c9a9696 commit 6a4940c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 63 deletions.
18 changes: 18 additions & 0 deletions lib/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

var fs = require('fs');
var p = require('path');
var psl = require('psl');

var path = p.resolve(__dirname, '../list.txt');
var rawList = fs.readFileSync(path)
.toString()
.trim()
.split("\n");

var cleanedList = rawList.filter(function(domain){
var parsed = psl.parse(domain);
return parsed.listed;
});

fs.writeFileSync(path, cleanedList.join("\n"))

0 comments on commit 6a4940c

Please sign in to comment.