From 41d548aadc75682b6eb4e73c3fd1bebede25cbee Mon Sep 17 00:00:00 2001 From: PeasantWorker <2608882093@qq.com> Date: Fri, 24 Dec 2021 11:17:07 +0800 Subject: [PATCH] extract success --- ...\347\273\210\346\236\201\344\277\256\347\202\274.json" | 1 + main.py | 3 ++- src/ebook/community.py | 8 +++----- 3 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 "data/\345\211\215\347\253\257\344\275\223\351\252\214\350\256\276\350\256\241\342\200\224\342\200\224HTML5+CSS3\347\273\210\346\236\201\344\277\256\347\202\274.json" diff --git "a/data/\345\211\215\347\253\257\344\275\223\351\252\214\350\256\276\350\256\241\342\200\224\342\200\224HTML5+CSS3\347\273\210\346\236\201\344\277\256\347\202\274.json" "b/data/\345\211\215\347\253\257\344\275\223\351\252\214\350\256\276\350\256\241\342\200\224\342\200\224HTML5+CSS3\347\273\210\346\236\201\344\277\256\347\202\274.json" new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ "b/data/\345\211\215\347\253\257\344\275\223\351\252\214\350\256\276\350\256\241\342\200\224\342\200\224HTML5+CSS3\347\273\210\346\236\201\344\277\256\347\202\274.json" @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/main.py b/main.py index 5a13e17..8757cde 100644 --- a/main.py +++ b/main.py @@ -12,4 +12,5 @@ if __name__ == "__main__": print('-------' * 20) print('开始向社区发帖') book_dir = 'data/{}/'.format(key) - # send_topic(web_url, book_dir) \ No newline at end of file + mapping_path = 'data/{}.json'.format(key) + send_topic(web_url, book_dir, mapping_path) \ No newline at end of file diff --git a/src/ebook/community.py b/src/ebook/community.py index 2d21d00..85176e0 100644 --- a/src/ebook/community.py +++ b/src/ebook/community.py @@ -65,7 +65,7 @@ def post(url, params, retry=3, headers=None): raise error -def send_topic(web_url, book_dir): +def send_topic(web_url, book_dir, mapping_path): data_dir = 'data' # web_url = "https://codechina.csdn.net/csdn/book_code_c798a5992a654857867ec15660e1c32a/-/blob/master/" request_url = 'http://ccloud.internal.csdn.net/v1/internal/community/content/sendTopic' @@ -75,8 +75,6 @@ def send_topic(web_url, book_dir): files = get_all_files(book_dir) print(files) - mapping_path = 'data/深入剖析Nginx.json' - if not os.path.exists(mapping_path): chapter_code_mapping = {} save_mapping = json.dumps(chapter_code_mapping, @@ -101,11 +99,11 @@ def send_topic(web_url, book_dir): send_topic_request_param = { "type": "long_text", - "cateId": 20966, + "cateId": 20967, "content": topic_content, "topicTitle": topic_title, "mdContent": topic_content, - "communityId": 3821, + "communityId": 3823, "loginUserName": "BBS_Assistant", "bizNo": "ebook" } -- GitLab