Skip to content

Commit f16cc5b

Browse files
authored
Merge pull request #1 from LittleYe233/main
Enhance installation process
2 parents 46c3ff5 + d6ffb61 commit f16cc5b

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,23 @@
66
源库链接:[自动评价](https://github.com/qiu-lzsnmb/jd_lzsnmb)
77
[评论爬虫](https://github.com/2274900/JD_comment_spider)
88

9-
### 本脚本只是对以上两位的结合以及魔改,用于解决评论文不对题的问题。经测试,本脚本能初步解决这一问题。
9+
### 本脚本只是对以上两位的结合以及魔改,用于解决评论文不对题的问题。经测试,本脚本能初步解决这一问题。
1010

1111
## 思路
1212

1313
由爬虫先行对商品的既有评价进行爬取,在此基础上进行自己的评价
1414

1515
## 使用方法
1616

17-
获取电脑版ck后填入 auto_comment_plus.py 文件,运行此文件即可
17+
在终端中执行:
18+
19+
```bash
20+
git clone https://github.com/Dimlitter/jd_AutoComment.git
21+
cd jd_AutoComment
22+
pip install -r requirements.txt
23+
```
24+
25+
然后获取电脑版ck后填入 auto_comment_plus.py 文件,运行此文件即可
1826

1927
> 此脚本需要的依赖较多,需自行安装
2028

auto_comment_plus.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@
99
import requests
1010
from lxml import etree
1111
import jdspider
12+
import yaml
13+
14+
CONFIG_PATH = './config.yml'
1215

1316
jieba.setLogLevel(jieba.logging.INFO)
1417
"""
1518
ck填到下面就好,只支持网页版的Ck
1619
以下为最短格式
1720
"""
18-
ck = ''
21+
with open(CONFIG_PATH, 'r', encoding='utf-8') as f:
22+
cfg = yaml.safe_load(f)
23+
ck = cfg['user']['cookie']
1924

2025
headers = {
2126
'cookie': ck,

config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
user:
2+
cookie: ''

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
jieba
2+
requests
3+
lxml
4+
zhon
5+
pyyaml

0 commit comments

Comments
 (0)