__urls.csv
Browse files- __urls.csv +3 -0
- split-urls.js +27 -0
__urls.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d0248f5aa146160105fd9ec04b5b12e907742df99d635977f5077b56a4d18f5d
|
| 3 |
+
size 26736882
|
split-urls.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const fs = require('fs');
|
| 2 |
+
const path = require('path');
|
| 3 |
+
const readline = require('readline');
|
| 4 |
+
|
| 5 |
+
async function processUrls() {
|
| 6 |
+
const inputFile = path.join(__dirname, '__urls.csv');
|
| 7 |
+
|
| 8 |
+
const fileStream = fs.createReadStream(inputFile);
|
| 9 |
+
const rl = readline.createInterface({
|
| 10 |
+
input: fileStream,
|
| 11 |
+
crlfDelay: Infinity
|
| 12 |
+
});
|
| 13 |
+
|
| 14 |
+
for await (const line of rl) {
|
| 15 |
+
if (!line.trim()) continue;
|
| 16 |
+
|
| 17 |
+
const parts = line.split(',');
|
| 18 |
+
const prefix = parts[0].substring(0, 3);
|
| 19 |
+
const outputFile = path.join(__dirname, `${prefix}.csv`);
|
| 20 |
+
|
| 21 |
+
fs.appendFileSync(outputFile, line + '\n');
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
console.log('Done processing URLs');
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
processUrls().catch(console.error);
|