在全部伪类元素加载完成后,使用这个代码,将html里面的::before等动态添加的伪类元素直接替换为对应文字,这样可以使用自动化快捷爬取
css=document.styleSheets[0].cssRules;
Object.keys(css).forEach(function(k,v){
stylename=css[k].selectorText.split('::')[0];
content=css[k].style.content.replaceAll('"','');
document.querySelectorAll(stylename).forEach(function(ek,ev){
ek.replaceWith(content);
});
});

发表回复