Showing
1 changed file
with
13 additions
and
2 deletions
1 | +# -*- coding: utf-8 -*- | ||
2 | +import json | ||
3 | + | ||
1 | import telegram | 4 | import telegram |
2 | from telegram.ext import Updater | 5 | from telegram.ext import Updater |
3 | from telegram.ext import MessageHandler, Filters | 6 | from telegram.ext import MessageHandler, Filters |
... | @@ -16,7 +19,7 @@ def covid_num_crawling(): | ... | @@ -16,7 +19,7 @@ def covid_num_crawling(): |
16 | soup = BeautifulSoup(code, "html.parser") | 19 | soup = BeautifulSoup(code, "html.parser") |
17 | info_num = soup.select("div.status_today em") | 20 | info_num = soup.select("div.status_today em") |
18 | result = int(info_num[0].string) + int(info_num[1].string) | 21 | result = int(info_num[0].string) + int(info_num[1].string) |
19 | - return result | 22 | + return resul |
20 | 23 | ||
21 | def covid_news_crawling(): | 24 | def covid_news_crawling(): |
22 | code = req.urlopen("https://search.naver.com/search.naver?where=news&sm=tab_jum&query=%EC%BD%94%EB%A1%9C%EB%82%98") | 25 | code = req.urlopen("https://search.naver.com/search.naver?where=news&sm=tab_jum&query=%EC%BD%94%EB%A1%9C%EB%82%98") |
... | @@ -30,6 +33,15 @@ def covid_news_crawling(): | ... | @@ -30,6 +33,15 @@ def covid_news_crawling(): |
30 | if title_list.index(i) == 2: | 33 | if title_list.index(i) == 2: |
31 | break | 34 | break |
32 | return output_result | 35 | return output_result |
36 | + | ||
37 | + | ||
38 | + def toJson(mnet_dict): | ||
39 | + with open('mnet_chart.json', 'w', encoding='utf-8') as file : | ||
40 | + json.dump(mnet_dict, file, ensure_ascii=False, indent='\t') | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
33 | 45 | ||
34 | 46 | ||
35 | #텔레그램 관련 코드 | 47 | #텔레그램 관련 코드 |
... | @@ -77,4 +89,3 @@ def handler(update, context): | ... | @@ -77,4 +89,3 @@ def handler(update, context): |
77 | echo_handler = MessageHandler(Filters.text, handler) | 89 | echo_handler = MessageHandler(Filters.text, handler) |
78 | dispatcher.add_handler(echo_handler) | 90 | dispatcher.add_handler(echo_handler) |
79 | 91 | ||
80 | - | ... | ... |
-
Please register or login to post a comment