Skip to content

Commit 868d2a0

Browse files
author
mochazi
committed
QQ Music Update Server 🎉
1 parent 9ed0d1a commit 868d2a0

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# **Python3Webcrawler**
2-
## **[哔哩哔哩作者:-相依-](https://space.bilibili.com/343154012)**  **UPDATE 2020 7 28**
2+
## **[哔哩哔哩作者:-相依-](https://space.bilibili.com/343154012)**  **UPDATE 2021-01-10**
33
> **精心挑选了几个爬虫,给大家在学Scrapy框架之前打基础。**
44
>> **该项目仅限学习交流,请勿用于商业用途,如有侵权,请联系删除。**
55
66
|**程序依赖**|**安装指令**|**项目使用版本**|
77
|:----:|:--------:|:--------:|
8-
|**lxml**|**pip install lxml**|**4.5.2**|
8+
|**lxml**|**pip install lxml**|**4.6.2**|
99
|**aiohttp**|**pip install aiohttp**|**3.6.2**|
1010
|**requests**|**pip install requests**|**2.24.0**|
1111
|**PyExecJS**|**pip install PyExecJS**|**1.5.1**|

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ beautifulsoup4==4.9.1
55
certifi==2020.6.20
66
chardet==3.0.4
77
idna==2.10
8-
lxml==4.5.2
8+
lxml==4.6.2
99
multidict==4.7.6
1010
mysql-connector-python==8.0.21
1111
protobuf==3.12.2

新版QQ音乐/crawl.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,22 +164,23 @@ def download(song_mid,sing_name,singer_name):
164164
purl = html['req_0']['data']['midurlinfo'][0]['purl']
165165

166166

167-
url = 'http://119.147.228.27/amobile.music.tc.qq.com/{}'.format(purl)
167+
url = 'https://113.105.167.153/amobile.music.tc.qq.com/{}'.format(purl)
168168

169-
html = requests.get(url,headers = headers)
169+
html = requests.get(url,headers = headers,verify=False)
170170

171171
html.encoding = 'utf-8'
172172

173173
sing_file_name = '{} -- {}'.format(sing_name,singer_name)
174174

175175
filename = './新版QQ音乐/歌曲'
176176

177-
if not os.path.exists(filename):
178-
os.makedirs(filename)
179-
180-
with open('./新版QQ音乐/歌曲/{}.m4a'.format(sing_file_name),'wb') as f:
181-
print('\n正在下载{}歌曲.....\n'.format(sing_file_name))
182-
f.write(html.content)
177+
if html.status_code != 403:
178+
if not os.path.exists(filename):
179+
os.makedirs(filename)
180+
181+
with open('./新版QQ音乐/歌曲/{}.m4a'.format(sing_file_name),'wb') as f:
182+
print('\n正在下载{}歌曲.....\n'.format(sing_file_name))
183+
f.write(html.content)
183184

184185
except:
185186
print('查询权限失败,或没有查到对应的歌曲')

0 commit comments

Comments
 (0)