| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67 | const delay = 2002; // 조절
function makeAjaxRequest(method, url, data, successCallback) {
const xhr = new XMLHttpRequest();
if (method === 'GET') {
xhr.open('GET', url + '?' + new URLSearchParams(data).toString(), true);
} else if (method === 'POST') {
xhr.open('POST', url, true);
}
if (method === 'POST') {
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
}
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
if (method === 'GET') {
successCallback(xhr.responseText);
} else if (method === 'POST') {
successCallback(JSON.parse(xhr.responseText));
}
}
};
if (method === 'GET') {
xhr.send();
} else if (method === 'POST') {
xhr.send(new URLSearchParams(data).toString());
}
}
function processPage(page) {
setTimeout(function () {
makeAjaxRequest('GET', '/index.php', { act: 'dispMemberOwnComment', page: page }, function (data) {
const parser = new DOMParser();
const body = parser.parseFromString(data, 'text/html');
const links = body.querySelectorAll('section > table > tbody > tr > td > a');
links.forEach(function (link, z) {
setTimeout(function () {
if (link.textContent.match(/삭제 되었습니다/g)) {
return;
}
const docuSrl = link.getAttribute('href').match(/\d+/g)[0];
const cmtSrl = link.getAttribute('href').split('#comment_')[1];
makeAjaxRequest('POST', '/', {
document_srl: docuSrl,
comment_srl: cmtSrl,
at: true,
module: 'board',
_rx_ajax_compat: 'JSON',
act: 'procBoardDeleteComment'
}, function (returnJson) {
console.log(cmtSrl + ' ' + returnJson.message + '(' + link.textContent + ')');
});
}, z * delay);
});
});
}, page * delay);
}
makeAjaxRequest('GET', '/index.php', { act: 'dispMemberOwnComment' }, function (data) {
const parser = new DOMParser();
const body = parser.parseFromString(data, 'text/html');
const totalPage = parseInt(body.querySelector("section > table > caption").textContent.replace(/[\t\n\r]+|[\s]{2,}/g, '').split('/')[1]);
for (let i = 1; i <= totalPage; i++) {
processPage(i);
}
}); |
국정원에 넘기는 코드네 ㅇㅅㅇ - dc App
이정도 코드는 그냥 gpt한테 물어보면 자세히 설명해줌