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
이혜인
2022-05-20 01:35:31 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
187a626700be8e1c13777d4e67d84336e218719a
187a6267
1 parent
2ecd9b93
printing ticketing rate
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
23 deletions
Megabox_crawling/megaboxCrawling.py
Megabox_crawling/megaboxCrawling.py
View file @
187a626
from
urllib
import
response
import
requests
from
bs4
import
BeautifulSoup
from
selenium
import
webdriver
from
webdriver_manager.chrome
import
ChromeDriverManager
from
selenium.webdriver.common.keys
import
Keys
# driver = webdriver.Chrome()
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
.
get
(
url
)
driver2
.
implicitly_wait
(
3
)
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
)
iframes
=
driver
.
find_elements_by_css_selector
(
'iframe'
)
driver
.
switch_to
.
frame
(
'frameBokdMBooking'
)
driver
.
find_element_by_id
(
'btn'
)
r
=
driver
.
page_source
soup
=
BeautifulSoup
(
r
,
"html.parser"
)
attr
=
soup
.
select
(
"#mCSB_4_container>ul>li>button"
)
for
brch
in
attr
:
print
(
brch
[
'brch-nm'
],
brch
[
'brch-no'
])
seoul
=
soup
.
select
(
"#mCSB_4_container>ul>li>button"
)
Gyeonggi
=
soup
.
select
(
"#mCSB_5_container>ul>li>button"
)
Incheon
=
soup
.
select
(
"#mCSB_6_container>ul>li>button"
)
DCS
=
soup
.
select
(
"#mCSB_7_container>ul>li>button"
)
#Daejeon Chungcheong Sejong
BDG
=
soup
.
select
(
"#mCSB_8_container>ul>li>button"
)
#Busan Daegu Gyeongsang
GJ
=
soup
.
select
(
"#mCSB_9_container>ul>li>button"
)
#gwangju_jeonla
Gangwon
=
soup
.
select
(
"#mCSB_10_container>ul>li>button"
)
dict1
=
dict
()
for
brch
in
seoul
:
dict1
[
brch
[
'brch-nm'
]]
=
brch
[
'brch-no'
]
for
brch
in
Gyeonggi
:
dict1
[
brch
[
'brch-nm'
]]
=
brch
[
'brch-no'
]
for
brch
in
Incheon
:
dict1
[
brch
[
'brch-nm'
]]
=
brch
[
'brch-no'
]
for
brch
in
DCS
:
dict1
[
brch
[
'brch-nm'
]]
=
brch
[
'brch-no'
]
for
brch
in
BDG
:
dict1
[
brch
[
'brch-nm'
]]
=
brch
[
'brch-no'
]
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
:
print
(
movie
[
'movie-nm'
],
movie
[
'movie-no'
])
# for i in btn:
# print(i['brch-nm'])
#driver.find_element_by_css_selector('div').send_keys(Keys.ENTER)
# soup = BeautifulSoup(driver.page_source, 'html.parser')
# theater = soup.select('li')
# for i in theater:
# print(i.text)
# driver.close()
# response = requests.post(url)
# soup = BeautifulSoup(response.text, "html.parser")
# movie_location = {}
# for(brch_nm) in soup.select('#frameBokdMBooking'):
# print(brch_nm)
movie_dict
[
movie
[
'movie-nm'
]]
=
[
movie
[
'movie-no'
],
movie
[
'form-at'
]]
print
(
movie
[
'movie-nm'
],
movie
[
'movie-no'
],
movie
[
'form-at'
])
#form-at: 처음 그냥 받아올 때 해당 날짜에 영화 있는지 확인(장소 상관 없이)
#brch-no로 쿼리 주고 나서 form-at확인 필요
...
...
Please
register
or
login
to post a comment