6dylan6 / auto_comment

带图评价
420 stars 75 forks source link

当购买的商品是书籍时,pid解析错误,建议更改为正则匹配 #17

Closed id10tttt closed 1 year ago

id10tttt commented 1 year ago

pid = pid.replace('//item.jd.com/', '').replace('.html', '') 如果订单是书籍时,这儿是 book.jd.com, 建议使用正则匹配 比如: import re PID_PATTERN = '(?<=jd.com/)[(0-9)*?]+' pid_match = re.findall(PID_PATTERN, pid) pid = pid_match[0] if pid_match else None

6dylan6 commented 1 year ago

好的,谢谢

6dylan6 commented 1 year ago

已改