Toggle navigation
Toggle navigation
This project
Loading...
Sign in
장수창
/
COVID19_Information_Chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
장수창
2020-06-08 02:50:31 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fd1fef7cdbe0d1ffee84b1b95a18489b8a6c1ca5
fd1fef7c
1 parent
c3dd9db8
nationwide status crawling added
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
status.py
status.py
0 → 100644
View file @
fd1fef7
import
requests
from
bs4
import
BeautifulSoup
from
datetime
import
datetime
day_month
=
datetime
.
today
()
.
month
day_day
=
datetime
.
today
()
.
day
data
=
[]
url
=
'https://search.naver.com/search.naver?sm=top_hty&fbm=1&ie=utf8&query=
%
EC
%
BD
%94%
EB
%
A1
%9
C
%
EB
%82%98
+
%
ED
%98%84%
ED
%99%
A9'
hdr
=
{
'Accept-Language'
:
'ko_KR,en;q=0.8'
,
'User-Agent'
:
(
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36'
)}
req
=
requests
.
get
(
url
,
headers
=
hdr
)
html
=
req
.
text
soup
=
BeautifulSoup
(
html
,
'html.parser'
)
for
i
in
soup
.
select
(
'div[class=state_graph]'
):
data
.
append
(
i
.
text
)
datasets
=
data
[
0
]
datasets
=
datasets
.
split
(
" "
,
10
)
datasets
=
datasets
[
1
:]
datasets
=
datasets
[:
-
1
]
for
i
in
range
(
0
,
4
):
datasets
[
i
]
=
datasets
[
i
]
.
replace
(
" "
,
""
)
datasets
.
append
(
day_month
)
datasets
.
append
(
day_day
)
print
(
datasets
)
\ No newline at end of file
Please
register
or
login
to post a comment