Files
nypc_python_advanced/Spider/neteaseMusicSpider/readme.md
iamzhaohaibo 667ff765fb update Spider/neteaseMusicSpider/readme.md.
Signed-off-by: iamzhaohaibo <941604465@qq.com>
2025-12-13 08:09:55 +00:00

113 lines
3.0 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 代码使用&驱动下载说明
> 建议使用Google Chrome 浏览器
## 1、创建虚拟环境并下载对应packages推荐
:reminder_ribbon:作者建议:真的建议所有的`Python`学习者去使用虚拟环境。创建方法参考如下:
### 1、使用`Pycharm`创建项目时候去创建虚拟环境
![image-20251213151523446](./pics/image-20251213151523446.png)
> Based on your own existing python interpreter to create a virtual python interpreter environment by `Virtualenv` Tool.
### 2、使用命令
确保你的Python环境已经有了`venv`模块然后在你的Python项目目录下执行如下指令
```bash
python -m venv YourVirtualEnv # YourVirtualEnv你的虚拟环境名称
```
## 2、检查自己浏览器版本
### 1、打开Google Chrome
### 2、F12进入帮助或者浏览器地址栏输入`chrome://settings/help`
### 3、复制你的Chrome版本号
![image-20251213152220366](./pics/image-20251213152220366.png)
### 4、进入下载地址
#### 1最新版
```
https://googlechromelabs.github.io/chrome-for-testing/#stable
```
#### 2直下版
```
https://storage.googleapis.com/chrome-for-testing-public/版本号/系统类型/文件名.zip
```
> 版本号:和自己浏览器对应
>
> 系统类型:
>
> Windows**win32/64**32bit or 64bit
>
> Mac**mac-x64/mac-arm64**intel Chip/Apple Chip
>
> Linux**linux64**
>
> 文件名:
>
> WIndowschromedriver-win32.zip/chromedriver-win64.zip
>
> Macchromedriver-mac-x64.zip/chromedriver-mac-arm64.zip
>
> Linuxchromedriver-linux64.zip
如大部分最新版Windows安装的最新64位Google Chrome可以参考如下链接截止2025-12-13
```
https://storage.googleapis.com/chrome-for-testing-public/145.0.7575.2/win64/chromedriver-win64.zip
```
一定要看清楚版本号、系统类型、文件名,少一个都不行。
## 3、下载解压和修改代码驱动位置
作者的Google Chrome是`128.0.6613.138` 系统是Mac 10Intel Chipx86_64
那么下载
```
https://storage.googleapis.com/chrome-for-testing-public/128.0.6613.138/mac-x64/chromedriver-mac-x64.zip
```
解压:
![image-20251213154237730](./pics/image-20251213154237730.png)
如果是Windows电脑你们下载的Windows版驱动解压出来的是`.exe`可执行文件
复制可执行文件到你的项目或者你能找到的地方。
找到驱动注册代码、修改路径:
```python
service = Service(executable_path='./chromedriver_win32/chromedriver.exe') # 根据自己实际位置来修改,记得!!!!
```
如我的绝对路径(你的一定一定一定不是这个路径,憋整错了)
```bash
/Users/zhaohaibo/Desktop/chromedriver-mac-x64/chromedriver
```
## 5、后续改进...
After you complete all the procedures mentioned above, just RUN IT !!!!!!!
`You and the code must have at least one can RUN.`
这里的解析网页函数获取排行的应该是奇数rankId不是所有的因此还要改进。