diff --git a/README.md b/README.md index 5828caa..9cb5891 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,6 @@ www的那个地址抓CK,登录后F12点到network,不要用命令document.co 2023/3/14 正常使用 +2023/3/28 修复评价内容乱码 + ![image](https://i.postimg.cc/NG6g4pHf/1.jpg) \ No newline at end of file diff --git a/jd_comment.py b/jd_comment.py index b95cb34..a7a854d 100644 --- a/jd_comment.py +++ b/jd_comment.py @@ -15,6 +15,7 @@ import os import random import sys import time,re +import urllib.parse try: @@ -326,7 +327,7 @@ def sunbw(N, opts=None): 'orderId': oid, 'productId': pid, 'score': str(xing), # 商品几星 - 'content': bytes(Str, encoding="gbk"), # 评价内容 + 'content': urllib.parse.quote(Str), # 评价内容 'imgs': imgurl + ',' + imgurl2, 'saveStatus': 2, 'anonymousFlag': 1 @@ -417,7 +418,7 @@ def review(N, opts=None): data1 = { 'orderId': oid, 'productId': pid, - 'content': bytes(context, encoding="gbk"), + 'content': urllib.parse.quote(context), 'anonymousFlag': 1, 'score': 5 }