작성 : 2023-12-11 15:11 조회 : 539
document.querySelectorAll('script[type="application/json"]').forEach(sc =>{ if(sc.innerHTML.indexOf('comment_count')===-1){return; } let codes = sc.innerHTML.match(/"code":\s?[^,]+,/); if(codes == null) return; // console.log(codes); let comment_counts = sc.innerHTML.match(/"comment_count":\s?[\d]+/); if(comment_counts == null) return; // console.log(comment_counts); console.log('댓글수: ',codes[0],comment_counts[0]) });