Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ShinSeungMin
/
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
임승현
2022-05-31 10:02:01 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
78c6c5c40a96883a4f4322579dd7b8c93737b521
78c6c5c4
1 parent
f42986f0
Enable to Contain the Information of Selectable Movies
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
WebCrawling/src/CGVExample.java
WebCrawling/src/CGVExample.java
View file @
78c6c5c
...
...
@@ -150,6 +150,7 @@ public class CGVExample {
Iterator
<
Element
>
GoldenEgg
=
elements1
.
select
(
"span.percent"
).
iterator
();
Iterator
<
Element
>
link
=
elements1
.
select
(
"a.link-reservation"
).
iterator
();
//영화 제목, 순위, 예매율, 영화 코드, 골든에그 지수를 가져와 CGVMovieInfo 객체 생성자에 파라미터로 넘겨주고, 인스턴스를 받아옴.
while
(
title
.
hasNext
()){
String
newTitle
=
title
.
next
().
text
();
int
newRank
=
Integer
.
parseInt
(
rank
.
next
().
text
().
replace
(
"No."
,
""
));
...
...
@@ -164,8 +165,8 @@ public class CGVExample {
}
for
(
CGVMovieInfo
elem
:
Movies
)
{
elem
.
printMovieInfo
();
//
System.out.println(elem.getRank() + " : " + elem.getTitle());
//
elem.printMovieInfo();
System
.
out
.
println
(
elem
.
getRank
()
+
" : "
+
elem
.
getTitle
());
}
//영화 이름(Integer 선택지), 영화관 지역 코드, 영화관 이름, 관람 일자 입력 시, (시간 선택 가능한) 예매 사이트로 이동.
...
...
@@ -185,10 +186,12 @@ public class CGVExample {
String
otherFormat
=
String
.
format
(
"THEATER_CD=%s&PLAY_YMD=%s"
,
theaterCode
,
date
);
url_ticketing
+=
(
"?"
+
otherFormat
);
//예매 가능한 영화 리스트를 얻기 위해 빠른 예매 사이트로 이동.
WebDriver
driver_ticketing
=
new
ChromeDriver
();
driver_ticketing
.
get
(
url_ticketing
);
try
{
Thread
.
sleep
(
1000
);}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();}
//Frame 전환
WebElement
selecting_area
=
driver_ticketing
.
switchTo
().
frame
(
"ticket_iframe"
).
findElement
(
By
.
className
(
"theater-area-list"
));
List
<
WebElement
>
selected_areas_list
=
selecting_area
.
findElements
(
By
.
cssSelector
(
"ul > li > a > span.name"
));
...
...
@@ -212,17 +215,22 @@ public class CGVExample {
//선택한 영화관에서, 선택한 일자에 상영하는 영화 목록 들고오기
WebElement
selecting_movies
=
driver_ticketing
.
findElement
(
By
.
className
(
"movie-select"
));
List
<
WebElement
>
selected_movies_list
=
selecting_movies
.
findElements
(
By
.
cssSelector
(
"#movie_list > ul > li"
));
LinkedHashMap
<
String
,
String
>
accessible_movies
=
new
LinkedHashMap
<>();
//선택불가를 제외한 영화 제목 출력
for
(
WebElement
movie_element
:
selected_movies_list
){
String
movie_enabled
=
movie_element
.
getAttribute
(
"class"
);
if
(
movie_enabled
.
endsWith
(
"dimmed"
))
break
;
else
System
.
out
.
println
(
movie_element
.
findElement
(
By
.
cssSelector
(
"span.text"
)).
getText
());
else
{
String
title
=
movie_element
.
findElement
(
By
.
cssSelector
(
"span.text"
)).
getText
();
String
code
=
movie_element
.
getAttribute
(
"movie_cd_group"
);
accessible_movies
.
put
(
title
,
code
);
System
.
out
.
println
(
title
+
" : "
+
code
);
}
}
try
{
try
{
driver_ticketing
.
close
();
//드라이버 연결 해제
driver_ticketing
.
quit
();
//프로세스 종료
}
catch
(
Exception
e
)
{
...
...
Please
register
or
login
to post a comment