Skip to content

Instantly share code, notes, and snippets.

@jihunleekr
Last active February 10, 2017 05:43
Show Gist options
  • Save jihunleekr/68ca63bf65a81a994b8fe89cce08632d to your computer and use it in GitHub Desktop.
Save jihunleekr/68ca63bf65a81a994b8fe89cce08632d to your computer and use it in GitHub Desktop.
네이버 블로그글, 까페글의 이미지, 동영상, 키워드 갯수를 세어줍니다. 파이어폭스 콘솔창에서만 실행됩니다.
cd(document.getElementById('screenFrame'));
if(location.href.match(/cafe/)) {
var word = prompt('카운트할 키워드를 입력하세요');
console.log('이미지:', document.getElementById('cafe_main').contentDocument.querySelectorAll('.inbox img[src^="http://cafep"]').length);
console.log('동영상:', document.getElementById('cafe_main').contentDocument.querySelectorAll('.inbox iframe[src^="http://serviceapi"]').length);
var wordList = document.getElementById('cafe_main').contentDocument.querySelectorAll('.inbox')[0].innerText.match(new RegExp(word, 'ig'));
console.log('키워드:', wordList ? wordList.length : 0);
} else {
console.log('이미지:', document.getElementById('mainFrame').contentDocument.querySelectorAll('[id^="post-view"] img[src^="http://postfiles"]').length);
console.log('동영상:', document.getElementById('mainFrame').contentDocument.querySelectorAll('[id^="post-view"] iframe[src^="http://serviceapi"]').length);
var word = prompt('카운트할 키워드를 입력하세요');
var wordList = document.getElementById('mainFrame').contentDocument.querySelectorAll('[id^="post-view"]')[0].innerText.match(new RegExp(word, 'ig'));
console.log('키워드:', wordList ? wordList.length : 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment