Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dagouzhi committed Jun 16, 2024
1 parent b7e6243 commit 1627616
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 49 deletions.
Binary file modified dgz/build/outputs/dist.dgz
Binary file not shown.
100 changes: 52 additions & 48 deletions packages/js-crawler/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,57 @@ export declare type LaunchOptions = {
onError?: (err: any) => void;
};

function fix () {
try {
const a =document.querySelector('button');
if (/验证/gi.test(a.innerText)) {
// @ts-ignore
const v = eval(`${document.querySelector('form').firstChild.data?.replace('=', '')}`)
const input = document.querySelector('input');
input.value = v
a.click()
}
} catch (error) {

}
try {
// 定义要替换的文本
const targetText = window.location.host;
const replacementText = '影视基地';

// 遍历所有文本节点并进行替换
function replaceText(node) {
// 如果是文本节点,进行替换
if (node.nodeType === Node.TEXT_NODE) {
node.nodeValue = node.nodeValue.replace(new RegExp(targetText, 'g'), replacementText);
} else {
// 否则,遍历子节点进行替换
for (let child of node.childNodes) {
replaceText(child);
}
}
}

// 从文档的body开始替换
replaceText(document.body);
} catch (error) {

}

try {
const style = document.createElement('style');
const css = `
.home * { pointer-events: none; }
#header, .v-sort-nav, .footer{ display: none !important; }
`;
style.appendChild(document.createTextNode(css));
document.getElementsByTagName('head')[0].appendChild(style);
} catch (error) {

}
}
fix();

class SDK extends EventEmitter {
host: string = '';
conf: Config = {};
Expand Down Expand Up @@ -40,54 +91,7 @@ class SDK extends EventEmitter {
}

init() {
try {
const a =document.querySelector('button');
if (/验证/gi.test(a.innerText)) {
// @ts-ignore
const v = eval(`${document.querySelector('form').firstChild.data?.replace('=', '')}`)
const input = document.querySelector('input');
input.value = v
a.click()
}
} catch (error) {

}
try {
// 定义要替换的文本
const targetText = window.location.host;
const replacementText = '影视基地';

// 遍历所有文本节点并进行替换
function replaceText(node) {
// 如果是文本节点,进行替换
if (node.nodeType === Node.TEXT_NODE) {
node.nodeValue = node.nodeValue.replace(new RegExp(targetText, 'g'), replacementText);
} else {
// 否则,遍历子节点进行替换
for (let child of node.childNodes) {
replaceText(child);
}
}
}

// 从文档的body开始替换
replaceText(document.body);
} catch (error) {

}

try {
const style = document.createElement('style');
const css = `
.home * { pointer-events: none; }
#header, .v-sort-nav, .footer{ display: none !important; }
`;
style.appendChild(document.createTextNode(css));
document.getElementsByTagName('head')[0].appendChild(style);
} catch (error) {

}

fix();
}

getHome() {
Expand Down
Loading

0 comments on commit 1627616

Please sign in to comment.