oovm / ZhihuLink

A Mathematica package used to download Q&As on zhihu.com
Mozilla Public License 2.0
8 stars 2 forks source link

Local save format #5

Open oovm opened 6 years ago

oovm commented 6 years ago

议题: 如何保存本地请求

oovm commented 6 years ago

目录结构

目录用途

stats

存放用户的详细信息

user

存放获取的用户列表

post

用户的生产内容, 回答, 专栏回答等

follow

用户关注的话题/用户等

database

归档

oovm commented 6 years ago

文件命名

stats

name.time.json

user

time.json

post

name.type.time.json

follow

name.type.offset.json

follow总归不需要时间戳了


时间戳(time)

ts=ToString@IntegerPart[1000AbsoluteTime@Now]
anti=DateObject[ToExpression@ts/1000.]
water-vapor commented 6 years ago

Current API output directory structure

Miscellaneous/Profile/user_id.json
Miscellaneous/Topic/topic_id.json
Miscellaneous/Question/question_id.json
Miscellaneous/Answer/answer_id.json
Miscellaneous/Messages/user_id.json
Miscellaneous/Notifications/user_id.json

Members/Followees/user_id.json
Members/Followers/user_id.json
Members/FollowingQuestions/user_id.json
Members/FollowingTopics/user_id.json
Members/FollowingColumns/user_id.json
Members/FollowingFavlists/user_id.json
Members/Questions/user_id.json
Members/Answers/user_id.json
Members/Pins/user_id.json
Members/Articles/user_id.json
Members/Columns/user_id.json
Members/Favlists/user_id.json
Members/Activities/user_id.json

Questions/Followers/question_id.json
Questions/Comments/question_id.json
Questions/Invitees/question_id.json
Questions/InvitationCandidates/question_id.json

Answers/Comments/answer_id.json
Answers/Upvoters/answer_id.json

Pins/Comments/pin_id.json

Topics/Followers/topic_id.json
Topics/Essence/topic_id.json
Topics/BestAnswerers/topic_id.json
Topics/TopQuestions/topic_id.json
Topics/TimelineQuestions/topic_id.json
Topics/TopActivities/topic_id.json
Topics/TimelineActivities/topic_id.json

Articles/Upvoters/post_id.json
Articles/Comments/post_id.json

Columns/Followers/column_id.json
Columns/Posts/column_id.json

Each file contains the attributes as described in folder names of id. Please specify the arguments and returns of stats, user, post, follow to eliminate ambiguities. Example:

ZhihuLinkGetUser takes a user ID, and saves the data of Miscellaneous/Profile to user/user_id.timestamp.json, where timestamp is the program execution time, format specified by ts.

oovm commented 6 years ago

Categories:


Members/Followees/user_id.json Members/Followers/user_id.json Members/FollowingQuestions/user_id.json Members/FollowingTopics/user_id.json Members/FollowingColumns/user_id.json Members/FollowingFavlists/user_id.json


Answers/Comments/answer_id.json Answers/Upvoters/answer_id.json Articles/Upvoters/post_id.json Articles/Comments/post_id.json Questions/Comments/question_id.json

Holding

Miscellaneous/Profile/user_id.json
Miscellaneous/Topic/topic_id.json
Miscellaneous/Question/question_id.json
Miscellaneous/Answer/answer_id.json
Miscellaneous/Messages/user_id.json
Miscellaneous/Notifications/user_id.json

Members/Questions/user_id.json
Members/Answers/user_id.json
Members/Pins/user_id.json
Members/Articles/user_id.json
Members/Columns/user_id.json
Members/Favlists/user_id.json
Members/Activities/user_id.json

Questions/Followers/question_id.json
Questions/Invitees/question_id.json
Questions/InvitationCandidates/question_id.json

Pins/Comments/pin_id.json

Topics/Followers/topic_id.json

Columns/Followers/column_id.json
Columns/Posts/column_id.json