You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
1.9 KiB
JavaScript
81 lines
1.9 KiB
JavaScript
"use strict";
|
|
|
|
const bhttp = require("bhttp");
|
|
|
|
const stScrapeCategory = require("./lib/st/task/scrape-category");
|
|
const stFindCategories = require("./lib/st/task/find-categories");
|
|
const stScrapeProduct = require("./lib/st/task/scrape-product");
|
|
const stNormalizeProduct = require("./lib/st/task/normalize-product");
|
|
const lcscFindCategories = require("./lib/lcsc/task/find-categories");
|
|
const lcscScrapeCategory = require("./lib/lcsc/task/scrape-category");
|
|
const lcscNormalizeProduct = require("./lib/lcsc/task/normalize-product");
|
|
|
|
let state = {
|
|
session: bhttp.session({
|
|
headers: {
|
|
"user-agent": "seekseek.org beta crawler (contact/problems: admin@cryto.net)"
|
|
}
|
|
})
|
|
};
|
|
|
|
module.exports = {
|
|
database: {
|
|
host: "/run/postgresql",
|
|
database: "seekseek_documentation"
|
|
},
|
|
seed: [{
|
|
id: "st:home",
|
|
tags: [ "st:home" ],
|
|
data: {}
|
|
}, {
|
|
id: "lcsc:home",
|
|
tags: [ "lcsc:home" ],
|
|
data: {}
|
|
}],
|
|
tags: {
|
|
"st:home": [ "st:findCategories" ],
|
|
"st:category": [ "st:scrapeCategory" ],
|
|
"st:product": [ "st:scrapeProduct", "st:normalizeProduct" ],
|
|
"lcsc:home": [ "lcsc:findCategories" ],
|
|
"lcsc:category": [ "lcsc:scrapeCategory" ],
|
|
"lcsc:product": [ "lcsc:normalizeProduct" ]
|
|
},
|
|
tasks: {
|
|
"st:findCategories": {
|
|
ttl: "15d",
|
|
run: stFindCategories(state)
|
|
},
|
|
"st:scrapeCategory": {
|
|
ttl: "1d",
|
|
taskInterval: "60s",
|
|
version: "2",
|
|
run: stScrapeCategory(state)
|
|
},
|
|
"st:scrapeProduct": {
|
|
ttl: "15d",
|
|
taskInterval: "5s",
|
|
run: stScrapeProduct(state)
|
|
},
|
|
"st:normalizeProduct": {
|
|
dependsOn: [ "st:scrapeProduct" ],
|
|
version: "4",
|
|
run: stNormalizeProduct(state)
|
|
},
|
|
"lcsc:findCategories": {
|
|
ttl: "30d",
|
|
taskVersion: "1",
|
|
run: lcscFindCategories(state)
|
|
},
|
|
"lcsc:scrapeCategory": {
|
|
ttl: "30d",
|
|
taskInterval: "1m",
|
|
run: lcscScrapeCategory(state)
|
|
},
|
|
"lcsc:normalizeProduct": {
|
|
version: "3",
|
|
parallelTasks: Infinity,
|
|
run: lcscNormalizeProduct(state)
|
|
},
|
|
}
|
|
};
|