Skip to content

Commit

Permalink
fix zhihu article url
Browse files Browse the repository at this point in the history
  • Loading branch information
aturret committed Nov 14, 2024
1 parent 20cbabe commit 6747084
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions app/services/zhihu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
ZHIHU_HOST,
ALL_METHODS,
ZHIHU_COOKIES,
ZHIHU_API_PARAMS
ZHIHU_API_ANSWER_PARAMS
)
from ...utils.logger import logger

Expand Down Expand Up @@ -197,7 +197,7 @@ async def _get_request_url(self) -> None:
+ "/answers/"
+ self.answer_id
+ "?"
+ ZHIHU_API_PARAMS
+ ZHIHU_API_ANSWER_PARAMS
)
return
else:
Expand All @@ -210,10 +210,10 @@ async def _get_request_url(self) -> None:
if self.method == "api":
self.request_url = (
ZHIHU_COLUMNS_API_HOST
+ "/articles/"
+ "/article/"
+ self.article_id
+ "?"
+ ZHIHU_API_PARAMS
+ ZHIHU_API_ANSWER_PARAMS
)
return
self.request_url = f"https://{host}{request_url_path}"
Expand Down
2 changes: 1 addition & 1 deletion app/services/zhihu/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SHORT_LIMIT = 600
ZHIHU_COLUMNS_API_HOST = "https://zhuanlan.zhihu.com/api"
ZHIHU_API_HOST = "https://www.zhihu.com/api/v4"
ZHIHU_API_PARAMS = ("include=content%2Cexcerpt%2Cauthor%2Cvoteup_count%2Ccomment_count%2Cquestion%2Ccreated_time"
ZHIHU_API_ANSWER_PARAMS = ("include=content%2Cexcerpt%2Cauthor%2Cvoteup_count%2Ccomment_count%2Cquestion%2Ccreated_time"
"%2Cquestion.detail")
ZHIHU_HOST = "https://www.zhihu.com"
ALL_METHODS = ["api", "json", "html"]
Expand Down

0 comments on commit 6747084

Please sign in to comment.