OxbridgeEconomics
commited on
Commit
·
36b7b27
1
Parent(s):
93e74f7
commit
Browse files
daily.py
CHANGED
@@ -100,10 +100,10 @@ i = 1
|
|
100 |
while i > -1:
|
101 |
CATEGORY_URL = f"http://www.csrc.gov.cn/searchList/a1a078ee0bc54721ab6b148884c784a8?_isAgg=true&_isJson=true&_pageSize=18&_template=index&_rangeTimeGte=&_channelName=&page={i}"
|
102 |
i = i + 1
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
parsed_datetime = datetime.strptime(time.strftime("%Y-%m-%d", time.strptime(article['publishedTimeStr'],"%Y-%m-%d %H:%M:%S")), "%Y-%m-%d")
|
108 |
if parsed_datetime < (datetime.today() - timedelta(days=DELTA)):
|
109 |
i = -1
|
@@ -128,8 +128,8 @@ while i > -1:
|
|
128 |
article['sentimentScore'], article['sentimentLabel'] = sentiment_computation(article['content'])
|
129 |
article['id'] = uuid.uuid5(uuid.NAMESPACE_OID, article['titleCN']+article['publishDate'])
|
130 |
update_content(article)
|
131 |
-
|
132 |
-
|
133 |
|
134 |
print("data.eastmoney.com")
|
135 |
def crawl_eastmoney(url, article):
|
|
|
100 |
while i > -1:
|
101 |
CATEGORY_URL = f"http://www.csrc.gov.cn/searchList/a1a078ee0bc54721ab6b148884c784a8?_isAgg=true&_isJson=true&_pageSize=18&_template=index&_rangeTimeGte=&_channelName=&page={i}"
|
102 |
i = i + 1
|
103 |
+
try:
|
104 |
+
content = fetch_url(CATEGORY_URL)
|
105 |
+
reportinfo = json.loads(content)
|
106 |
+
for article in reportinfo['data']['results']:
|
107 |
parsed_datetime = datetime.strptime(time.strftime("%Y-%m-%d", time.strptime(article['publishedTimeStr'],"%Y-%m-%d %H:%M:%S")), "%Y-%m-%d")
|
108 |
if parsed_datetime < (datetime.today() - timedelta(days=DELTA)):
|
109 |
i = -1
|
|
|
128 |
article['sentimentScore'], article['sentimentLabel'] = sentiment_computation(article['content'])
|
129 |
article['id'] = uuid.uuid5(uuid.NAMESPACE_OID, article['titleCN']+article['publishDate'])
|
130 |
update_content(article)
|
131 |
+
except Exception as error:
|
132 |
+
print(error)
|
133 |
|
134 |
print("data.eastmoney.com")
|
135 |
def crawl_eastmoney(url, article):
|