Showing
1 changed file
with
25 additions
and
0 deletions
status.py
0 → 100644
1 | +import requests | ||
2 | +from bs4 import BeautifulSoup | ||
3 | +from datetime import datetime | ||
4 | + | ||
5 | +day_month = datetime.today().month | ||
6 | +day_day = datetime.today().day | ||
7 | + | ||
8 | +data = [] | ||
9 | +url='https://search.naver.com/search.naver?sm=top_hty&fbm=1&ie=utf8&query=%EC%BD%94%EB%A1%9C%EB%82%98+%ED%98%84%ED%99%A9' | ||
10 | +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')} | ||
11 | +req = requests.get(url, headers=hdr) | ||
12 | +html = req.text | ||
13 | +soup = BeautifulSoup(html, 'html.parser') | ||
14 | +for i in soup.select('div[class=state_graph]'): | ||
15 | + data.append(i.text) | ||
16 | +datasets = data[0] | ||
17 | +datasets = datasets.split(" ",10) | ||
18 | +datasets = datasets[1:] | ||
19 | +datasets = datasets[:-1] | ||
20 | +for i in range(0,4): | ||
21 | + datasets[i] = datasets[i].replace(" ","") | ||
22 | + | ||
23 | +datasets.append(day_month) | ||
24 | +datasets.append(day_day) | ||
25 | +print(datasets) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment