//네이버 카페에서 새글 올라온 것 있는지 검사 하여 새글 상세 창 띄우기
let url = "<https://apis.naver.com/cafe-web/cafe2/ArticleList.json?search.clubid=28740941&search.queryType=lastArticle&search.page=1&search.perPage=50&ad=true&uuid=d27f6fd3-91a6-4951-8c2e-9268739c7a4b&adUnit=MW_CAFE_ARTICLE_LIST_RS>"
let article;
async function fetchData() {
let response = await fetch(url);
let data = await response.text();
let resItem = JSON.parse(data).message.result.articleList[0].item
console.log(resItem);
if(!article) article = resItem
if(resItem.articleId != article.articleId)
window.open(`https://m.cafe.naver.com/ca-fe/web/cafes/${resItem.cafeId}/articles/${resItem.articleId}?boardtype=L`);
}
//검사 시작
let startFetch = function() {
playFetch = setInterval(function() {
fetchData();
}, 3000);//3초마다 새글 검사
};
//검사 종료
let stopFetch = function() {
clearInterval(playFetch);
};