이혜인

adding movie info

......@@ -17,6 +17,23 @@ let movie_data = [];
(async () => {
const driver = new webdriver.Builder().forBrowser('chrome').build();
driver.get(booking_url);
driver.switchTo().frame(0)//frameBokdMBooking 프레임 가져옴
let list = await driver.wait(until.elementsLocated(By.css('#mCSB_1_container>ul>li>.btn')));
r = 0;
for (item of list) {
//Using getAttribute to get the data
movie_data[r++] = {
'rank' : r,
'title' : await item.getAttribute("movie-nm"),
'movie_num':await item.getAttribute("movie-no"),
'running':await item.getAttribute("form-at"),
}
}
driver.close();
r = 0;
const browser = await puppeteer.launch({
headless: true
......@@ -31,6 +48,11 @@ let movie_data = [];
const name = $(list).find('div.tit-area > p.tit').attr('title');
const rate = $(list).find('div.rate-date > span.rate').text();
if(movie_data[r].title === name){
movie_data[r]['rate'] = rate;
}else{
movie_data[r]['rate'] = '예매율 0.0%';
}
});
r = 0;
for(i of movie_data){
......@@ -40,6 +62,11 @@ let movie_data = [];
browser.close();
})();
// (async () => {
// })();
......