Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이혜인
/
Multiplex_Ticketing_Platform
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
ShinSeungMin
2022-05-19 00:28:38 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a591462037d212cc280eb00702b45f0a11090d86
a5914620
1 parent
e399e5bb
Add Crawling LotteCinema Movie Chart and Get Ticekt URL
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
0 deletions
LotteCinema/app.js
LotteCinema/package.json
LotteCinema/app.js
0 → 100644
View file @
a591462
let
express
=
require
(
'express'
);
let
app
=
express
();
let
request
=
require
(
'request'
);
const
asyncHandler
=
require
(
'express-async-handler'
)
const
{
response
}
=
require
(
'express'
);
const
puppeteer
=
require
(
'puppeteer'
);
const
cheerio
=
require
(
'cheerio'
);
app
.
get
(
'/LotteCinema'
,
asyncHandler
(
async
(
req
,
res
,
next
)
=>
{
const
browser
=
await
puppeteer
.
launch
();
const
page
=
await
browser
.
newPage
();
// 수집하고자 하는 URL을 입력
await
page
.
goto
(
'https://www.lottecinema.co.kr/NLCHS/Movie/List?flag=1'
);
let
content
=
await
page
.
content
();
let
$
=
cheerio
.
load
(
content
,
{
decodeEntities
:
true
});
let
data
=
[];
const
$bodyList
=
$
(
"#contents > div > ul.movie_list.type2"
).
children
(
"li"
);
let
i
=
0
;
$bodyList
.
each
(
function
(
elem
){
if
(
$
(
this
).
find
(
'a > em'
).
text
()
!=
"AD"
){
data
[
i
++
]
=
{
rank
:
i
,
url
:
$
(
this
).
find
(
'div.top_info > div > div > a'
).
attr
(
'href'
).
replace
(
""
),
title
:
$
(
this
).
find
(
' div.btm_info > strong'
).
text
(),
rate
:
$
(
this
).
find
(
'div.btm_info > span > span.rate_info > em'
).
text
(),
star
:
$
(
this
).
find
(
'div.btm_info > span > span.star_info'
).
text
(),
};
}
});
await
browser
.
close
();
res
.
send
(
data
);
//console.log(data);
}))
let
server
=
app
.
listen
(
80
);
// (async () => {
// const browser = await puppeteer.launch();
// const page = await browser.newPage();
// // 수집하고자 하는 URL을 입력
// await page.goto('https://www.lottecinema.co.kr/NLCHS/Movie/List?flag=1');
// let content = await page.content();
// let $ = cheerio.load(content, {decodeEntities: true});
// let data = [];
// const $bodyList = $("#contents > div > ul.movie_list.type2").children("li");
// let i =0;
// $bodyList.each(function(elem){
// if($(this).find('a > em').text() != "AD"){
// data[i++]={
// rank : i,
// url: $(this).find('div.top_info > div > div > a').attr('href').replace(""),
// title : $(this).find(' div.btm_info > strong').text(),
// rate : $(this).find('div.btm_info > span > span.rate_info > em').text(),
// star : $(this).find('div.btm_info > span > span.star_info').text(),
// };
// }
// });
// await browser.close();
// console.log(data);
// })();
LotteCinema/package.json
0 → 100644
View file @
a591462
{
"name"
:
"Crawling LotteCinema Site"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"body-parser"
:
"^1.17.1"
,
"express"
:
"^4.15.2"
,
"cheerio"
:
"^0.22.0"
,
"puppeteer"
:
"^14.1.0"
,
"express-async-handler"
:
"^1.2.0"
}
}
\ No newline at end of file
Please
register
or
login
to post a comment