From d9ac1e905c8646ee66175c05ef30e721941fda3a Mon Sep 17 00:00:00 2001 From: jimin Date: Mon, 10 Apr 2023 19:22:38 +0900 Subject: [PATCH] =?UTF-8?q?feat/data=20:=20=EC=B1=84=EB=84=90Id=20?= =?UTF-8?q?=EA=B0=80=EC=A0=B8=EC=98=B4=20#4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/content/index.ts | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/content/index.ts b/src/content/index.ts index c2db818..d5110ea 100644 --- a/src/content/index.ts +++ b/src/content/index.ts @@ -1,27 +1,18 @@ -console.info('chrome-ext template-react-ts content script'); - +console.info('pop-filterbubble-client content script'); const root = document.documentElement; -let videoList = root.querySelectorAll('#video-title-link'); -let LinktoArr = Array.from(videoList); -LinktoArr.map((a,idx) => { - if (a instanceof HTMLAnchorElement) { - let href = a.href; - let params = href .substring( href .indexOf('=')+1, href .length ); - console.log(idx, params); - } -}); - -//개수가 24개 이하면 처리 -/*function getVideoId () { - for(let i :number = 0; i < videoList.length; i++) { - if (videoList[i] instanceof HTMLAnchorElement) { - let href = videoList[i].href; - } - +setInterval(()=> { + const videoList = root.querySelectorAll('#text > a'); + const linkToArr = Array.from(videoList); + + const newVideoList = linkToArr.map((a,idx) => { + if (a instanceof HTMLAnchorElement) { + let href = a.href; + let channelId = href .replace('https://www.youtube.com/',''); + return channelId; } - -}; -console.log(root.innerHTML);*/ + }); + console.log(newVideoList); +},5000); export {};