Alles in einem
This commit is contained in:
parent
3b476d9d5d
commit
a56a0592cc
48
clearurls.js
48
clearurls.js
|
@ -1,3 +1,22 @@
|
||||||
|
/*
|
||||||
|
* ##################################################################
|
||||||
|
* # Fetch Rules & Exception from URL #
|
||||||
|
* ##################################################################
|
||||||
|
*/
|
||||||
|
function fetchFromURL(url)
|
||||||
|
{
|
||||||
|
fetch(url)
|
||||||
|
.then((response) => response.text().then(toJSON));
|
||||||
|
|
||||||
|
function toJSON(retrievedText) {
|
||||||
|
return JSON.parse(retrievedText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var globalRules = fetchFromURL('https://raw.githubusercontent.com/KevinRoebert/ClearUrls/master/rules/rules.json');
|
||||||
|
var globalExceptions = fetchFromURL('https://raw.githubusercontent.com/KevinRoebert/ClearUrls/master/rules/exceptions.json');
|
||||||
|
// ##################################################################
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ##################################################################
|
* ##################################################################
|
||||||
* # Supertyp Provider #
|
* # Supertyp Provider #
|
||||||
|
@ -46,6 +65,10 @@ function Provider(_name,_completeProvider=false){
|
||||||
rules.push(rule);
|
rules.push(rule);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.setRules = function(_rules) {
|
||||||
|
rules = _rules;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all rules as an array.
|
* Return all rules as an array.
|
||||||
*
|
*
|
||||||
|
@ -92,14 +115,15 @@ function Provider(_name,_completeProvider=false){
|
||||||
*/
|
*/
|
||||||
var amazon = new Provider("Amazon");
|
var amazon = new Provider("Amazon");
|
||||||
amazon.setURLPattern('(https:\\/\\/||http:\\/\\/).*(\\.amazon\\.)\\w{2,}\\/.*');
|
amazon.setURLPattern('(https:\\/\\/||http:\\/\\/).*(\\.amazon\\.)\\w{2,}\\/.*');
|
||||||
amazon.addException('.*(amazon\\.)\\w{2,}(\\/gp\\/).*');
|
amazon.setRules(globalRules);
|
||||||
amazon.addRule('pf_rd_[a-zA-Z]=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?');
|
// amazon.addException('.*(amazon\\.)\\w{2,}(\\/gp\\/).*');
|
||||||
amazon.addRule('qid=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?');
|
// amazon.addRule('pf_rd_[a-zA-Z]=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?');
|
||||||
amazon.addRule('sr=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?');
|
// amazon.addRule('qid=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?');
|
||||||
amazon.addRule('srs=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?');
|
// amazon.addRule('sr=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?');
|
||||||
amazon.addRule('.*(amazon-adsystem\\.com)\\/.*');
|
// amazon.addRule('srs=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?');
|
||||||
amazon.addRule('.*(adsensecustomsearchads\\.com)\\/.*');
|
// amazon.addRule('.*(amazon-adsystem\\.com)\\/.*');
|
||||||
amazon.addRule('pd_rd_[a-zA-Z]*=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?');
|
// amazon.addRule('.*(adsensecustomsearchads\\.com)\\/.*');
|
||||||
|
// amazon.addRule('pd_rd_[a-zA-Z]*=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?');
|
||||||
// ##################################################################
|
// ##################################################################
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -240,14 +264,6 @@ function clearUrl(request)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function fetchFromURL()
|
|
||||||
{
|
|
||||||
fetch('https://fiddle.jshell.net/robots.txt')
|
|
||||||
.then((response) => response.text().then(yourCallback));
|
|
||||||
|
|
||||||
function yourCallback( retrievedText ) { /* . . . */ }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call by each Request and checking the url.
|
* Call by each Request and checking the url.
|
||||||
*
|
*
|
||||||
|
|
19
data/data.json
Normal file
19
data/data.json
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"providers": {
|
||||||
|
"amazon": {
|
||||||
|
"urlPattern": "",
|
||||||
|
"rules": [
|
||||||
|
"pf_rd_[a-zA-Z]=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?",
|
||||||
|
"qid=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?",
|
||||||
|
"sr=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?",
|
||||||
|
"srs=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?",
|
||||||
|
".*(amazon-adsystem\\.com)\\/.*",
|
||||||
|
".*(adsensecustomsearchads\\.com)\\/.*",
|
||||||
|
"pd_rd_[a-zA-Z]*=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?"
|
||||||
|
],
|
||||||
|
"exceptions": [
|
||||||
|
".*(amazon\\.)\\w{2,}(\\/gp\\/).*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"amazon": [
|
|
||||||
".*(amazon\\.)\\w{2,}(\\/gp\\/).*"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"amazon": [
|
|
||||||
"pf_rd_[a-zA-Z]=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?",
|
|
||||||
"qid=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?",
|
|
||||||
"sr=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?",
|
|
||||||
"srs=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?",
|
|
||||||
".*(amazon-adsystem\\.com)\\/.*",
|
|
||||||
".*(adsensecustomsearchads\\.com)\\/.*",
|
|
||||||
"pd_rd_[a-zA-Z]*=[a-zA-Z0-9\\-\\.\\_]*[\\?|&]?"
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user