feat: implement specialty content module with expanded Page entity fields, database migrations, and data import utilities
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
const fs = require('fs');
|
||||
const html = fs.readFileSync('/home/x79/sisvietnamvn_01/BV_DHYD_HCM/Các chuyên khoa tại Bệnh viện Đại học Y Dược TP. Hồ Chí Minh.html', 'utf8');
|
||||
|
||||
let imgCount = 0;
|
||||
let idx = 0;
|
||||
while (true) {
|
||||
idx = html.indexOf('<img', idx);
|
||||
if (idx === -1) break;
|
||||
|
||||
const endIdx = html.indexOf('>', idx);
|
||||
const tag = html.substring(idx, endIdx + 1);
|
||||
|
||||
// get parent context 100 chars before
|
||||
const ctxBefore = html.substring(Math.max(0, idx - 100), idx);
|
||||
|
||||
if (ctxBefore.includes('chuyen-khoa')) {
|
||||
console.log('Context:', ctxBefore);
|
||||
console.log('Tag:', tag);
|
||||
console.log('---');
|
||||
imgCount++;
|
||||
}
|
||||
|
||||
idx = endIdx;
|
||||
if (imgCount > 5) break;
|
||||
}
|
||||
Reference in New Issue
Block a user