YousList icon indicating copy to clipboard operation
YousList copied to clipboard

나무위키 하단 파워링크

Open lunamoth opened this issue 2 years ago • 41 comments

나무위키 개별 항목 하단 파워링크 광고가 언제인가부터 차단이 안되고 있습니다. 차단 지원 해주시면 좋을 것 같습니다.

예제: https://namu.wiki/w/uBlock%20Origin

lunamoth avatar Jan 19 '22 13:01 lunamoth

제보 감사합니다. #198 이슈 대응 이후에 차단하기 까다롭게 업데이트 되어 방법을 고민 중입니다.

yous avatar Jan 19 '22 17:01 yous

aac6f9f 커밋에서 업데이트했습니다. 자리까지 없어지진 않지만 실제 광고는 나오지 않습니다.

추가로 아이디가 있는 경우 스킨을 변경하면 광고가 나오지 않는다는 정보가 있습니다. https://board.namu.wiki/b/free/2768161

yous avatar Jan 19 '22 17:01 yous

확인해보니 또 사이트가 업데이트되어 광고가 보이는 상태입니다.

yous avatar Jan 20 '22 07:01 yous

2022-01-22 오후 5:39 광고 안나오네요. 적용 감사드립니다

lunamoth avatar Jan 22 '22 08:01 lunamoth

개발자도구를 열어보니 "https://namu.wiki/i/" + 무작위 문자열 로 시작하는 URL을 차단하던데, 이 때문에 오류가 발생하는 것으로 보입니다..

gaeulbyul avatar Jan 22 '22 09:01 gaeulbyul

파이어폭스에서는 가만히 있으면 다시 정상적인 페이지로 이동하는데, 크롬에선 안 되네요.

yous avatar Jan 22 '22 10:01 yous

문제가 생기는 부분은 되돌렸습니다.

yous avatar Jan 22 '22 10:01 yous

namu.wiki#?#article div[id]:-abp-has(.wiki-macro-toc:not(#toc))

제가 방금 만든 필터인데(AdBlock 기준), 이렇게 해보시면 어떨까요?


크롬 개발자도구 스크린샷

  1. 나무위키의 광고영역에는 "fakewiki"라고 하는[^1], 화면상에는 안보이지만 마치 문서 내용같이 .wikik-paragraph.wiki-link-internal등이 들어있는 요소가 있는데요. 얘가 왜 존재하는 지는 확실치는 않으나, 이걸 이용해서 광고영역을 구분하는 게 먹히더라구요.

  2. 나무위키의 목차는 <div class="wiki-macro-toc" id="toc"> ... </div> 처럼 생겼고, id가 toc로 되어있으나 저 fakewiki 영역의 경우엔 id가 없습니다. 웹 표준상 같은 아이디를 두 번이상 사용하는 걸 허용하지 않으므로, 문서에서 사용하는 목차인지 아닌지를 구분할 수 있을거 같습니다.

[^1]: 나무위키의 전역변수 webpackJsonp 내부에 있습니다.

gaeulbyul avatar Jan 22 '22 11:01 gaeulbyul

@gaeulbyul 감사합니다. 지금도 .wiki-macro-toc 항목이 보이시나요? 지금은 #toc 외에는 안 잡히는 것 같습니다.

yous avatar Jan 22 '22 13:01 yous

어... 이번엔 저 요소가 없어졌네요... 예상보다 금방 대응하는 걸 보면 이쪽을 모니터링이라도 하는거 같습니다... 😅 다른 방법을 강구해봐야겠네요..

gaeulbyul avatar Jan 22 '22 13:01 gaeulbyul

이런 식으로 해볼 수는 있을 것 같습니다.

namu.wiki#?#article div[id]:-abp-has(img[src*="//searchad-phinf.pstatic.net/"])

yous avatar Jan 22 '22 13:01 yous

다만 가끔가다 이미지가 없는 광고가 있더라구요. 이 점을 감안하면 다른 방법도 연구해봐야겠습니다..

gaeulbyul avatar Jan 22 '22 13:01 gaeulbyul

namu.wiki##article div[id]:empty + div[id]:empty + div[id]:not(:empty) + div[id]:not(:empty)

광고영역 주변에 내용없이 비어있는 <div>태그가 있다는 점을 이용하여 작성한 규칙입니다. (솔직히, 이것도 오래 못가서 금방 우회할거 같긴 합니다만...)

gaeulbyul avatar Jan 22 '22 15:01 gaeulbyul

searchad-phinf.pstatic.net은 최근에 추가해서 이미지와 같이 있는 광고인데 텍스트만 보이는 중입니다.

yous avatar Jan 22 '22 17:01 yous

PR을 남기고 싶었는데 방법을 잘 모르겠어서 댓글로 남깁니다.

namu.wiki##:xpath(//article//div[div[count(.//div/img[starts-with(@src, '//w.namu.la/s/')]) > 2]/following-sibling::div[count(.//div[2]/span[starts-with(text(), 'http')]) = 3]])

item4 avatar Jan 24 '22 06:01 item4

div>span>img 형태로 사이트가 변경되었네요.

yous avatar Jan 24 '22 09:01 yous

namu.wiki##:xpath(//article//div[count(div) = 2][count(div[1]//img[starts-with(@src, '//w.namu.la/s/')]) > 2][count(div[2]//div[starts-with(text(), 'http')]) = 3])

바뀐 디자인에도 대응 가능한 버전입니다

item4 avatar Jan 24 '22 10:01 item4

어느 순간 다시 나오기 시작했습니다. Uploading Screenshot_20220129-232622_Kiwi Browser.jpg…

tjtnsgns avatar Jan 29 '22 14:01 tjtnsgns

광고 텍스트에서 프로토콜을 뺐네요.

yous avatar Jan 29 '22 14:01 yous

@item4 이런 건 어떤가요?

namu.wiki##:xpath(//article//div[count(div)=2][count(div[1]//img[starts-with(@src,'//w.namu.la/s/')])>2][div[2][count(div)=3]/div/div[last()][count(div)=3]])

yous avatar Feb 02 '22 08:02 yous

프로토콜 검사를 넣었던게 오작동 방지목적이었는데 프로토콜이 없는 URL 패턴을 xpath로 검사하는 건 매우 비현실적인듯하니 그냥 저게 나아보입니다.

item4 avatar Feb 03 '22 06:02 item4

하단 div에 빈 div가 추가되었네요.

yous avatar Feb 04 '22 11:02 yous

이번엔 상위 div에 빈 div가 추가되었네요.

yous avatar Feb 09 '22 03:02 yous

@yous Umanle S.R.L. updated their website to prevent List-KR Script and Youslist blocking their PowerLink advertisement.

piquark6046 avatar Mar 08 '22 14:03 piquark6046

Accidentally closed in ac876de (#212), re-opening for future issues.

yous avatar Mar 12 '22 19:03 yous

Note that namu.wiki site owner updated their structure, so we need an update to the filter.

seia-soto avatar Mar 14 '22 18:03 seia-soto

Please, update to following filter as simply removing [id] condition from div works:

##article>p+div div[id]:has(div[id]:has(div>ul>li,div>a[href*="/w/%EB%B6%84%EB%A5%98:"]))~div:has(img[src*="//w.namu.la/s/"],img[src^="data:image/png;base64,"])

div[id]>ul>li to div>ul>li

image

seia-soto avatar Mar 14 '22 19:03 seia-soto

Namuwiki removed <p/> tag inside article tag and rule update is required.

Here is another rule that works:

##article div:has(a[href*="/w/%EB%B6%84%EB%A5%98:"]) ~ div:has(td > img[src*="w.namu.la"], td > img[src^="data:image/png;base64,"])

Using td to detect the image is bit dangerous as we can make false-positive case when namuwiki updates their website to use td tag in content area.

image

seia-soto avatar Mar 15 '22 20:03 seia-soto

Namuwiki updated their site structure again. Also, changed the image host to ww.namu.la.

namu.wiki##article div:has(a[href*="/w/%EB%B6%84%EB%A5%98:"]) ~ div:has(tr > td img[src^="//ww.namu.la"])

image

Update 1

Fixes invalid blocking

##article div:has(a[href*="/w/%EB%B6%84%EB%A5%98:"]) ~ div:has(tr > td img[src^="//ww.namu.la"] + div[class] + div[class])

Update 2

Found new edge case

##article div:has(a[href*="/w/%EB%B6%84%EB%A5%98:"]) ~ div:has(div.wiki-paragraph) ~ div:has(tr > td img[src^="//ww.namu.la"])

Update 3

Found yet another edge case that DOM structure was completely different

namu.wiki##article div:has(a[href*="/w/%EB%B6%84%EB%A5%98:"]) ~ div:has(div.wiki-paragraph) ~ div:has(img[src*="w.namu.la"])

seia-soto avatar Mar 22 '22 15:03 seia-soto

@yous Someone has dom structure that doesn't include table related tag on their view. Also, their image links that shown on dom started with //w.namu.la. Please, consider the edge case. I don't know why but the structure was really different.

image

From @Bananamilk452

seia-soto avatar Mar 22 '22 17:03 seia-soto