first commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import https from 'https';
|
||||
|
||||
function getHtml(url) {
|
||||
return new Promise((resolve) => {
|
||||
https.get(url, (res) => {
|
||||
let data = '';
|
||||
res.on('data', c => data += c);
|
||||
res.on('end', () => resolve(data));
|
||||
}).on('error', (e) => resolve('ERROR: ' + e.message));
|
||||
});
|
||||
}
|
||||
|
||||
async function run() {
|
||||
const pages = [
|
||||
'https://onlylm.co.kr/',
|
||||
'https://onlylm.co.kr/estimate/',
|
||||
'https://onlylm.co.kr/service/wall/',
|
||||
'https://onlylm.co.kr/service/silicone/',
|
||||
'https://onlylm.co.kr/service/paint/',
|
||||
'https://onlylm.co.kr/gallery/'
|
||||
];
|
||||
|
||||
for (const p of pages) {
|
||||
const html = await getHtml(p);
|
||||
const titleMatch = html.match(/<title[^>]*>(.*?)<\/title>/i);
|
||||
const descMatch = html.match(/<meta[^>]*name=["']description["'][^>]*content=["'](.*?)["']/i);
|
||||
const canMatch = html.match(/<link[^>]*rel=["']canonical["'][^>]*href=["'](.*?)["']/i);
|
||||
const h1Matches = [...html.matchAll(/<h1[^>]*>([\s\S]*?)<\/h1>/gi)];
|
||||
const h2Count = (html.match(/<h2[\s>]/gi) || []).length;
|
||||
const imgWithoutAlt = (html.match(/<img(?![^>]*\balt=)[^>]*>/gi) || []).length;
|
||||
const totalImgs = (html.match(/<img[\s>]/gi) || []).length;
|
||||
const hasSchema = html.includes('application/ld+json');
|
||||
|
||||
console.log(`\n========================================`);
|
||||
console.log(`URL: ${p}`);
|
||||
console.log(`Title (${titleMatch ? titleMatch[1].length : 0}자): ${titleMatch ? titleMatch[1] : '없음'}`);
|
||||
console.log(`Description (${descMatch ? descMatch[1].length : 0}자): ${descMatch ? descMatch[1] : '없음'}`);
|
||||
console.log(`Canonical: ${canMatch ? canMatch[1] : '없음'}`);
|
||||
console.log(`H1 태그 개수: ${h1Matches.length}`);
|
||||
h1Matches.forEach((m, i) => {
|
||||
const text = m[1].replace(/<[^>]*>/g, '').replace(/\s+/g, ' ').trim();
|
||||
console.log(` - H1 [${i+1}]: ${text}`);
|
||||
});
|
||||
console.log(`H2 개수: ${h2Count}`);
|
||||
console.log(`이미지 총 개수: ${totalImgs}, alt 누락 이미지: ${imgWithoutAlt}`);
|
||||
console.log(`Schema.org JSON-LD 적용 여부: ${hasSchema ? 'O' : 'X'}`);
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
Reference in New Issue
Block a user