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-20 02:56:03 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
adc87dad4fe4811c56fe24d3636fbcb32bba6041
adc87dad
1 parent
187a6267
adding ticketing rate & rank
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
Megabox_crawling/megaboxCrawling.py
Megabox_crawling/megaboxCrawling.py
View file @
adc87da
...
...
@@ -5,31 +5,27 @@ from selenium import webdriver
from
webdriver_manager.chrome
import
ChromeDriverManager
from
selenium.webdriver.common.keys
import
Keys
options
=
webdriver
.
ChromeOptions
()
options
.
add_argument
(
"headless"
)
#창 안 띄움
options
.
add_experimental_option
(
"excludeSwitches"
,
[
"enable-logging"
])
driver
=
webdriver
.
Chrome
(
options
=
options
)
driver2
=
webdriver
.
Chrome
(
options
=
options
)
# driver = webdriver.Chrome(ChromeDriverManager().install(),options=options)
url
=
"https://megabox.co.kr/booking"
rate_url
=
"https://www.megabox.co.kr/movie"
driver
.
maximize_window
()
driver2
.
maximize_window
()
driver
.
implicitly_wait
(
3
)
driver
.
implicitly_wait
(
2
)
driver
.
get
(
url
)
driver2
.
implicitly_wait
(
3
)
driver2
.
implicitly_wait
(
2
)
driver2
.
get
(
rate_url
)
title
=
driver2
.
find_elements_by_class_name
(
'number'
)
r2
=
driver2
.
page_source
soup
=
BeautifulSoup
(
r2
,
"html.parser"
)
ticketing_rate
=
soup
.
select
(
'.rate'
)
for
i
in
ticketing_rate
:
print
(
i
.
string
)
movie_name
=
soup
.
select
(
'.tit-area > p.tit'
)
iframes
=
driver
.
find_elements_by_css_selector
(
'iframe'
)
...
...
@@ -59,14 +55,24 @@ for brch in GJ:
dict1
[
brch
[
'brch-nm'
]]
=
brch
[
'brch-no'
]
for
brch
in
Gangwon
:
dict1
[
brch
[
'brch-nm'
]]
=
brch
[
'brch-no'
]
# print(dict1)
attr1
=
soup
.
select
(
"#mCSB_1_container>ul>li>button"
)
movie_dict
=
dict
()
for
movie
in
attr1
:
movie_dict
[
movie
[
'movie-nm'
]]
=
[
movie
[
'movie-no'
],
movie
[
'form-at'
]]
print
(
movie
[
'movie-nm'
],
movie
[
'movie-no'
],
movie
[
'form-at'
])
for
r
,
m
in
zip
(
ticketing_rate
,
movie_name
):
movie_dict
[
m
[
'title'
]]
.
append
(
r
.
string
)
rank
=
1
for
value
in
movie_dict
.
values
():
if
(
len
(
value
)
==
2
):
value
.
append
(
"예메율 0.0
%
"
)
if
(
rank
<=
10
):
value
.
append
({
'rank'
:
rank
})
rank
+=
1
print
(
movie_dict
)
#form-at: 처음 그냥 받아올 때 해당 날짜에 영화 있는지 확인(장소 상관 없이)
#brch-no로 쿼리 주고 나서 form-at확인 필요
...
...
Please
register
or
login
to post a comment