Changed style logs

This commit is contained in:
zeldaroot 2021-01-10 01:15:32 +02:00
parent 4cd7c68a4b
commit ea5fd24cb5
2 changed files with 152 additions and 30 deletions

View file

@ -2749,6 +2749,10 @@ while [ "${WHILE}" -lt "2" ]; do
;;
"l"|"ll"|"log"|"logs"|"live"|"lb"|"lbt"|"lbf"|"lbb" )
if [ "${1}" = "lb" ] || [ "${1}" = "lbt" ] || [ "${1}" = "lbf" ] || [ "${1}" = "lbb" ] || [ "${2}" = "bot" ] || [ "${2}" = "bots" ]; then
RR='\o033[0;31m'
GG='\o033[0;32m'
YY='\o033[0;33m'
NCC='\o033[0m'
_br
if [ "${1}" = "live" ]; then
_line
@ -2758,7 +2762,11 @@ while [ "${WHILE}" -lt "2" ]; do
tail \
-n0 -f /home/*/log/err*.log \
-n0 -f /home/*/log/out*.log \
| grep "BOT DETECTED"
| sed \
-e 's/\([0-9T:-]*\):\s*/\1/' \
-e 's/\(TRUE BOT DETECTED\)/ \o033[32mTRUE\o033[39m/' \
-e 's/\(FAKE BOT DETECTED\)/ \o033[31mFAKE\o033[39m/' \
-e 's/\(BAD BOT DETECTED\)/ \o033[33mBAD!\o033[39m/'
_br
fi
if [ "${3}" = "" ] && { [ "${1}" = "lb" ] || [ "${2}" = "bot" ] || [ "${2}" = "bots" ]; }; then
@ -2766,7 +2774,13 @@ while [ "${WHILE}" -lt "2" ]; do
_header "BOT DETECTED"
_line
_br
grep "BOT DETECTED" /home/*/log/err*.log /home/*/log/out*.log
grep \
"BOT DETECTED" /home/*/log/err*.log /home/*/log/out*.log \
| sed -E "s/\/home\/([0-9A-Za-z.-]{10})([0-9A-Za-z.-]*)\/log\/(out|err)-0\.log:([0-9T:-]*):\s*/\4 \1/" \
| sed -E "s/TRUE BOT DETECTED/ ${GG}TRUE${NCC}/" \
| sed -E "s/FAKE BOT DETECTED/ ${RR}FAKE${NCC}/" \
| sed -E "s/BAD BOT DETECTED/ ${YY}BAD!${NCC}/" \
| sort -k1
_br
_line
_br
@ -2776,7 +2790,11 @@ while [ "${WHILE}" -lt "2" ]; do
_header "TRUE BOT DETECTED"
_line
_br
grep "TRUE BOT DETECTED" /home/*/log/err*.log /home/*/log/out*.log
grep \
"TRUE BOT DETECTED" /home/*/log/err*.log /home/*/log/out*.log \
| sed -E "s/\/home\/([0-9A-Za-z.-]{10})([0-9A-Za-z.-]*)\/log\/(out|err)-0\.log:([0-9T:-]*):\s*/\4 \1/" \
| sed -E "s/TRUE BOT DETECTED/ ${GG}TRUE${NCC}/" \
| sort -k1
_br
_line
_br
@ -2786,7 +2804,11 @@ while [ "${WHILE}" -lt "2" ]; do
_header "FAKE BOT DETECTED"
_line
_br
grep "FAKE BOT DETECTED" /home/*/log/err*.log /home/*/log/out*.log
grep \
"FAKE BOT DETECTED" /home/*/log/err*.log /home/*/log/out*.log \
| sed -E "s/\/home\/([0-9A-Za-z.-]{10})([0-9A-Za-z.-]*)\/log\/(out|err)-0\.log:([0-9T:-]*):\s*/\4 \1/" \
| sed -E "s/FAKE BOT DETECTED/ ${RR}FAKE${NCC}/" \
| sort -k1
_br
_line
_br
@ -2796,7 +2818,11 @@ while [ "${WHILE}" -lt "2" ]; do
_header "BAD BOT DETECTED"
_line
_br
grep "BAD BOT DETECTED" /home/*/log/err*.log /home/*/log/out*.log
grep \
"BAD BOT DETECTED" /home/*/log/err*.log /home/*/log/out*.log \
| sed -E "s/\/home\/([0-9A-Za-z.-]{10})([0-9A-Za-z.-]*)\/log\/(out|err)-0\.log:([0-9T:-]*):\s*/\4 \1/" \
| sed -E "s/BAD BOT DETECTED/ ${YY}BAD!${NCC}/" \
| sort -k1
_br
_line
_br

View file

@ -10,7 +10,7 @@
// @supportURL https://enota.club/
// @icon https://avatars3.githubusercontent.com/u/16612433?s=200
// @license MIT
// @version 2020.10
// @version 2021.01
// @run-at document-end
// @include http://*/*/movies?id=*
// @include https://*/*/movies?id=*
@ -118,6 +118,12 @@ function parseData() {
'kinopoisk_id=' +
kp_id
);
urls.push(
'https://bazon.cc/api/search?' +
'token=2848f79ca09d4bbbf419bcdb464b4d11&' +
'kp=' +
kp_id
);
urls.push('https://pleer.video/' + kp_id + '.json');
urls.push('https://rating.kinopoisk.ru/' + kp_id + '.xml');
}
@ -422,6 +428,19 @@ function getAPI(url, callback) {
: '0'
};
}
} else if (url.indexOf('bazon.cc') + 1) {
try {
var result_parse = JSON.parse(response.responseText);
if (
result_parse &&
result_parse.results &&
result_parse.results[0]
) {
result = result_parse.results[0];
}
} catch (e) {
console.log(e);
}
} else {
try {
result = JSON.parse(response.responseText);
@ -436,7 +455,10 @@ function getAPI(url, callback) {
var res = {};
if (url.indexOf('pleer.video') + 1) {
res = parsePleer(result);
} else if (url.indexOf('apicollaps.cc') + 1) {
} else if (
url.indexOf('apicollaps.cc') + 1 ||
url.indexOf('bazon.cc') + 1
) {
res = parseKP(result);
} else if (url.indexOf('omdbapi.com') + 1) {
res = parseOMDb(result);
@ -585,24 +607,34 @@ function parseOMDb(res) {
}
function parseKP(r) {
if (!r.id) return {};
if (!r.id && !r.kinopoisk_id) return {};
var res = r;
return {
imdb_id: res.imdb_id ? res.imdb_id.replace(/[^0-9]/g, '') : '',
title_ru: res.name
? res.name
.split('(')[0]
.split('[')[0]
.trim()
: '',
title_en: res.name_eng
? res.name_eng
.split('(')[0]
.split('[')[0]
.trim()
: '',
year: res.year ? (res.year + '').split('-')[0].replace(/[^0-9]/g, '') : '',
type: res.type && res.type === 'series' ? '1' : '0',
title_ru:
res.name || (res.info && res.info.rus)
? (res.name || (res.info && res.info.rus))
.split('(')[0]
.split('[')[0]
.trim()
: '',
title_en:
res.name_eng || (res.info && res.info.orig)
? (res.name_eng || (res.info && res.info.orig))
.split('(')[0]
.split('[')[0]
.trim()
: '',
year:
res.year || (res.info && res.info.year)
? ((res.year || (res.info && res.info.year)) + '')
.split('-')[0]
.replace(/[^0-9]/g, '')
: '',
type:
(res.type && res.type === 'series') || (res.serial && res.serial === '1')
? '1'
: '0',
genre: (Array.isArray(res.genre)
? res.genre
.map(function(v) {
@ -619,6 +651,15 @@ function parseKP(r) {
.filter(function(g) {
return g !== 'зарубежные' && g !== 'зарубежный';
})
: res.info && res.info.genre && typeof res.info.genre === 'string'
? res.info.genre
.split(',')
.map(function(g) {
return g.trim().toLowerCase();
})
.filter(function(g) {
return g && g !== 'зарубежные' && g !== 'зарубежный';
})
: []
).join(','),
country: (Array.isArray(res.country)
@ -629,12 +670,20 @@ function parseKP(r) {
? Object.keys(res.country).map(function(c) {
return res.country[c].trim();
})
: res.info && res.info.country && typeof res.info.country === 'string'
? res.info.country.split(',').map(function(c) {
return c.trim();
})
: []
).join(','),
actor: (res.actors
? res.actors.map(function(v, i) {
return i < 5 ? v : null;
})
: res.info && res.info.actors && typeof res.info.actors === 'string'
? res.info.actors.split(',').map(function(a, i) {
return i < 5 ? a.trim() : null;
})
: []
)
.filter(Boolean)
@ -643,24 +692,71 @@ function parseKP(r) {
? res.director.map(function(v, i) {
return i < 3 ? v : null;
})
: res.info && res.info.director && typeof res.info.director === 'string'
? res.info.director.split(',').map(function(d) {
return d.trim();
})
: []
)
.filter(Boolean)
.join(','),
description: res.description ? res.description : '',
poster: res.poster ? '1' : '',
kp_rating: res.kinopoisk ? Math.floor(res.kinopoisk * 10) : '',
kp_vote: '1000',
imdb_rating: res.imdb ? Math.floor(res.imdb * 10) : '',
imdb_vote: '1000',
description:
res.description || (res.info && res.info.description)
? res.description || (res.info && res.info.description)
: '',
poster: res.poster || (res.info && res.info.poster) ? '1' : '',
kp_rating: res.kinopoisk
? Math.floor(res.kinopoisk * 10)
: res.info && res.info.rating && res.info.rating.rating_kp
? Math.floor(parseFloat(res.info.rating.rating_kp) * 10)
: '',
kp_vote:
res.info && res.info.rating && res.info.rating.vote_num_kp
? parseInt(res.info.rating.vote_num_kp)
: '1000',
imdb_rating: res.imdb
? Math.floor(res.imdb * 10)
: res.info && res.info.rating && res.info.rating.rating_imdb
? Math.floor(parseFloat(res.info.rating.rating_imdb) * 10)
: '',
imdb_vote:
res.info && res.info.rating && res.info.rating.vote_num_imdb
? parseInt(res.info.rating.vote_num_imdb)
: '1000',
translate:
res.voiceActing && res.voiceActing[0]
? res.voiceActing.filter(function(voice) {
return !/(укр|eng)/i.test(voice);
})[0]
: res.translation
? res.translation
: '',
quality: res.quality ? res.quality : '',
premiere: res.premier ? res.premier : ''
quality: res.quality ? res.quality : res.quality ? res.quality : '',
premiere: res.premier
? res.premier
: res.info && res.info.premiere
? res.info.premiere
.split(' ')
.reverse()
.map(function(d) {
return d
.toLowerCase()
.replace('января', '01')
.replace('февраля', '02')
.replace('марта', '03')
.replace('апреля', '04')
.replace('мая', '05')
.replace('июня', '06')
.replace('июля', '07')
.replace('августа', '08')
.replace('сентября', '09')
.replace('октября', '10')
.replace('ноября', '11')
.replace('декабря', '12')
.padStart(2, '0');
})
.join('-')
: ''
};
}