Skip to content

Commit

Permalink
feat/data : 채널Id 가져옴
Browse files Browse the repository at this point in the history
  • Loading branch information
moana16 committed Apr 10, 2023
1 parent de82bc8 commit d9ac1e9
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions src/content/index.ts
Original file line number Diff line number Diff line change
@@ -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 {};

0 comments on commit d9ac1e9

Please sign in to comment.