Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*
댓글 선택자를 설정해주셔야 합니다.
페이스북 그룹
리액션 : '#mount_0_0 > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div:nth-child(4) > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div > div.iqfcb0g7.tojvnm2t.a6sixzi8.k5wvi7nf.q3lfd5jv.pk4s997a.bipmatt0.cebpdrjk.qowsmv63.owwhemhu.dp1hu0rb.dhp61c6y.l9j0dhe7.iyyx5f41.a8s20v7p > div > div > div > div.q5bimw55.rpm2j7zs.k7i0oixp.gvuykj2m.j83agx80.cbu4d94t.ni8dbmo4.eg9m0zos.l9j0dhe7.du4w35lb.ofs802cu.pohlnb88.dkue75c7.mb9wzai9.l56l04vs.r57mb794.kh7kg01d.c3g1iek1.otl40fxz.cxgpxx05.rz4wbd8a.sj5x9vvc.a8nywdso > div.j83agx80.cbu4d94t.buofh1pr a.esr5mh6w'
공유 : '#mount_0_0 > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div:nth-child(4) > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div > div.iqfcb0g7.tojvnm2t.a6sixzi8.k5wvi7nf.q3lfd5jv.pk4s997a.bipmatt0.cebpdrjk.qowsmv63.owwhemhu.dp1hu0rb.dhp61c6y.l9j0dhe7.iyyx5f41.a8s20v7p > div > div > div h3 a';
댓글 : '#mount_0_0 > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div.rq0escxv.l9j0dhe7.du4w35lb > div > div > div.j83agx80.cbu4d94t.d6urw2fd.dp1hu0rb.l9j0dhe7.du4w35lb > div.rq0escxv.l9j0dhe7.du4w35lb.j83agx80.rj1gh0hx.buofh1pr.g5gj957u.ka73uehy.jifvfom9.gs1a9yip.owycx6da.btwxx1t3.dp1hu0rb > div.rq0escxv.l9j0dhe7.du4w35lb.j83agx80.cbu4d94t.d2edcug0.rj1gh0hx.buofh1pr.g5gj957u.hpfvmrgz.dp1hu0rb > div > div > div.j83agx80.cbu4d94t > div > div > div > div > div > div.rq0escxv.l9j0dhe7.du4w35lb.qmfd67dx.gile2uim.buofh1pr.g5gj957u.hpfvmrgz.aov4n071.oi9244e8.bi6gxh9e.h676nmdw.aghb5jc5 > div > div > div > div > div > div > div > div > div > div > div:nth-child(2) > div > div:nth-child(4) > div > div > div.cwj9ozl2.tvmbv18p > ul > li > div:nth-child(1) > div > div.stjgntxs.ni8dbmo4.g3eujd1d > div > div.q9uorilb.bvz0fpym.c1et5uql.sf5mxxl7 > div > div > div > div > span > div > a'
페이스북 페이지
공유 : '#jsc_c_aj > div > a'
댓글 : '#mount_0_0 > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div.rq0escxv.l9j0dhe7.du4w35lb > div > div > div.j83agx80.cbu4d94t.d6urw2fd.dp1hu0rb.l9j0dhe7.du4w35lb > div.dp1hu0rb.d2edcug0.taijpn5t.j83agx80.gs1a9yip > div > div > div > div > div > div > div > div > div > div > div > div > div > div:nth-child(2) > div > div:nth-child(5) > div > div > div.cwj9ozl2.tvmbv18p > ul > li > div:nth-child(1) > div > div.stjgntxs.ni8dbmo4.g3eujd1d > div > div.q9uorilb.bvz0fpym.c1et5uql.sf5mxxl7 > div > div._6cuy > div > div > div.nc684nl6 > a > span > span'
*/
var 선택자 = '#mount_0_0 > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div:nth-child(4) > div > div > div.rq0escxv.l9j0dhe7.du4w35lb > div > div.iqfcb0g7.tojvnm2t.a6sixzi8.k5wvi7nf.q3lfd5jv.pk4s997a.bipmatt0.cebpdrjk.qowsmv63.owwhemhu.dp1hu0rb.dhp61c6y.l9j0dhe7.iyyx5f41.a8s20v7p > div > div > div > div.q5bimw55.rpm2j7zs.k7i0oixp.gvuykj2m.j83agx80.cbu4d94t.ni8dbmo4.eg9m0zos.l9j0dhe7.du4w35lb.ofs802cu.pohlnb88.dkue75c7.mb9wzai9.l56l04vs.r57mb794.kh7kg01d.c3g1iek1.otl40fxz.cxgpxx05.rz4wbd8a.sj5x9vvc.a8nywdso > div.j83agx80.cbu4d94t.buofh1pr a.esr5mh6w';
function shuffle(a) {
for (let i = a.length; i; i--) {
let j = Math.floor(Math.random() * i);
[a[i - 1], a[j]] = [a[j], a[i - 1]];
}
}
var list = [];
document.querySelectorAll(선택자).forEach(function(e){
list.push({name:e.innerText, url:e.href, tag:e});
});
list = list.filter((v,i,a) => a.indexOf(v)===i);
shuffle(list)
for(var i=0; i<list.length; i++){
console.log(i+1, list[i].name, list[i].url, list[i].tag);
}
@gaerae

This comment has been minimized.

Copy link

@gaerae gaerae commented Aug 9, 2018

동일한 방법인데, 출력을 조금 이쁘게 만들어봤습니다. 😃
https://github.com/gaerae/facebook-contest-winner

@egoing

This comment has been minimized.

Copy link
Owner Author

@egoing egoing commented Aug 28, 2018

@gaerae님 멋지네요! ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment