mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
Adding new Admin UI. Updating Fredy to V3.0.0 as it has been a large rewrite. Thanks for all contributions and help on the way!
45 lines
1.1 KiB
JavaScript
Executable File
45 lines
1.1 KiB
JavaScript
Executable File
const utils = require('../utils');
|
|
|
|
let appliedBlackList = [];
|
|
|
|
function normalize(o) {
|
|
return o;
|
|
}
|
|
|
|
function applyBlacklist(o) {
|
|
const titleNotBlacklisted = !utils.isOneOf(o.title, appliedBlackList);
|
|
const descNotBlacklisted = !utils.isOneOf(o.description, appliedBlackList);
|
|
|
|
return o.id != null && titleNotBlacklisted && descNotBlacklisted;
|
|
}
|
|
|
|
const config = {
|
|
url: null,
|
|
crawlContainer: '#main_column .wgg_card',
|
|
crawlFields: {
|
|
id: '@data-id',
|
|
details: '.row .noprint .col-xs-11 |removeNewline |trim',
|
|
price: '.middle .col-xs-3 |removeNewline |trim',
|
|
size: '.middle .text-right |removeNewline |trim',
|
|
title: '.truncate_title a |removeNewline |trim',
|
|
link: '.truncate_title a@href',
|
|
},
|
|
paginate: '.pagination-sm:first a:last@href',
|
|
normalize: normalize,
|
|
filter: applyBlacklist,
|
|
};
|
|
|
|
exports.init = (sourceConfig, blacklist) => {
|
|
config.enabled = sourceConfig.enabled;
|
|
config.url = sourceConfig.url;
|
|
appliedBlackList = blacklist || [];
|
|
};
|
|
|
|
exports.metaInformation = {
|
|
name: 'Wg gesucht',
|
|
baseUrl: 'https://www.wg-gesucht.de/',
|
|
id: __filename.slice(__dirname.length + 1, -3),
|
|
};
|
|
|
|
exports.config = config;
|