QQ音乐》是大家比较常用的音乐播放软件,但好多音乐因版权的原因需要付费后才能下载,今天就教大家免费下载QQ音乐中的付费音乐。
1、首先打开浏览器(这里以搜狗浏览器为例),在地址栏中输入QQ音乐的官方地址,进入QQ音乐官方网站的首页。
QQ音乐首页
2、在QQ音乐首页的搜索框中输入你想要的歌曲并搜索(这里以回小仙的《醒不来的》为例)。
3、点击此歌曲的播放按钮,跳转到播放界面。
播放界面
4、按下键盘上的F12键,在网页的右侧(或者下方)会弹出网页代码窗口,在其中找到第一个src代码,如下图所示,将src="" 双引号内的链接复制下来。
Ps:在双引号内双击即可选中引号内的链接。
代码
5、新建一个网页,在地址栏中粘贴刚才复制的链接并回车,将会打开一个黑色底面的播放窗口。
新建网页
6、点击此窗口播放进度条右侧下载按钮(竖3点),弹出一个下载文件的对话框,重新命名并选择保存的位置后,点击下载即可。
下载
下载后的文件的扩展名为.m4a,如果你需要把文件转换为mp3格式,可以参考以下步骤。
1、启动QQ音乐客户端,选择程序右上角的主菜单,在弹出的子菜单中选择“音频转码”。
2、在弹出的音频转码对话框中,选择“添加歌曲”,然后设置好转换文件的保存位置后,点击“开始转换”按钮对歌曲进行转换。
3 等待转换完成后,就会得到.MP3格式的文件了。
这个方法有一定的局限性,它只适用于能在网页上播放的歌曲,部分歌曲会提示“仅限客户端播放”,这时就只能打开客户端在线播放了^_^
仅限客户端播放
以上就是“免费下载QQ音乐中的付费音乐”的全部内容了,如果你觉得对你有帮助的话还请多多点赞,收藏和转发,谢谢!
.前言
QQ音乐官网:点击访问
作者成品效果预览:点击访问
作者其他博客成品汇总预览:点击访问
暂时源码并没有提供其他获取渠道,私聊作者获取即可,或通过博客后面名片添加作者,很简单!
二.主要功能点列表
顶级菜单
二级菜单
歌单推荐
新歌首发
精彩推荐
新碟首发
排行榜
MV
通用网站底部(版权、企业信息等)
三.产品效果图
1.切换顶级菜单、二级菜单:
2.歌单推荐(菜单切换+轮播):
3.新歌首发(菜单切换+轮播):
4.精彩推荐(轮播):
5.新碟首发(菜单切换+轮播):
6.排行榜(背景图裁剪实现:background-position属性):
7.MV(菜单切换+轮播):
项目目录截图:
img存放各种静态图片资源等;
page目录是通用目录文件(看名称几乎也能明白了),top就是网站通用顶部,index就是框架通用主体盒子,foot就是网站通用底部;
router就是路由;
views其他功能目录文件,子目录home目录为首页,其他子目录功能待开发实现;
components为组件存放目录,子目录home专门存放首页组件页面(歌单推荐、新歌首发、精彩推荐。。mv等),所以首页已经被拆分成各个子页面,非常美观和利于后续功能拓展或修改
首页主页面 views/home/index.vue,通过引入子页面组件:
<template>
<div style="font-size: 14px;">
<song-sheet-recommend></song-sheet-recommend>
<new-song-first></new-song-first>
<hot-recommend></hot-recommend>
<new-dish-first></new-dish-first>
<ranking-list></ranking-list>
<mv></mv>
</div>
</template>
<script>
import songSheetRecommend from "../../components/home/song_sheet_recommend.vue";
import newSongFirst from "../../components/home/new_song_first.vue";
import hotRecommend from "../../components/home/hot_recommend.vue";
import newDishFirst from "../../components/home/new_dish_first.vue";
import rankingList from "../../components/home/ranking_list.vue";
import mv from "../../components/home/mv.vue";
export default {
components: {
songSheetRecommend,
newSongFirst,
hotRecommend,
newDishFirst,
rankingList,
mv
},
data() {
return {
};
},
mounted() {
},
methods: {
}
};
</script>
<style>
</style>
歌单推荐(首页其中子页面之一),菜单切换,模拟数据交互,types1和types2赋值给types:
<template>
<div class="mod_bg" style="font-size: 14px;">
<div style="margin: 0 10%;">
<div class="mod_title">
歌单推荐
</div>
<div class="mod_small_title">
<span v-for="(item,index) in submenus" :key="index" :class="subMenuIndex!==index?'sub-menu-hover':''" @click="selSubMenu(index)" :style="'padding: 10px 30px;'+(subMenuIndex===index?'color: #31c27c;':'')">
{{item.name}}
</span>
</div>
<div>
<el-carousel trigger="click" :autoplay="false" height="350px">
<el-carousel-item v-for="i in 4" :key="i" indicator-position="outside">
<div style="margin: 0 10%;" class="recommend-box">
<div class="recommend-item" v-for="(item,index) in types" :key="index">
<div class="play-item">
<div style="text-align: center;height: 224px;overflow: hidden;">
<el-image :src="item.img" fit="cover" style="width: 100%;height: 224px;" class="cover"></el-image>
</div>
<div class="play-box">
<img src="../../../public/img/cover_play.png">
</div>
</div>
<div class="recommend-item-title title-active">
{{item.name}}
</div>
<div class="recommend-item-des">
播放量:{{item.playNum}}
</div>
</div>
</div>
</el-carousel-item>
</el-carousel>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
subMenuIndex: 0,
submenus: [
{name:'为你推荐'},
{name:'经典'},
{name:'网络歌曲'},
{name:'韩语'},
{name:'官方歌单'},
{name:'情歌'},
],
types:[],
types1:[
{name:'二哥抖音最火',playNum:'4357.9万',img:require('../../../public/img/recommend1.jpg')},
{name:'华语天花板:奏响青春的时代乐章',playNum:'1190.5万',img:require('../../../public/img/recommend2.jpg')},
{name:'冬季限定 ·冰雪世界专属电音BGM',playNum:'4.3万',img:require('../../../public/img/recommend3.jpg')},
{name:'车载DJ热歌:轻松一路Fun肆嗨!',playNum:'4534.6万',img:require('../../../public/img/recommend4.jpg')},
{name:'爱的故事翻篇,被爱的人不用道歉',playNum:'2037.3万',img:require('../../../public/img/recommend5.jpg')}
],
types2:[
{name:'不为人知的天才,老一辈香港音乐人',playNum:'51.5万',img:require('../../../public/img/recommend6.jpg')},
{name:'以漂亮的姿势,穿越到八十年代',playNum:'87.5万',img:require('../../../public/img/recommend7.jpg')},
{name:'「经典粤语」唱着你我的悲欢离合',playNum:'123.3万',img:require('../../../public/img/recommend8.jpg')},
{name:'重温一把当年的火,粤语经典',playNum:'104.9万',img:require('../../../public/img/recommend9.jpg')},
{name:'有一种歌词,叫小美',playNum:'315.7万',img:require('../../../public/img/recommend10.jpg')}
]
};
},
mounted() {
this.types=this.types1;
},
methods: {
selSubMenu(index){//切換菜單
this.subMenuIndex=index;
console.info(index % 2);
if(index % 2===0){
this.types=this.types1;
}else{
this.types=this.types2;
}
},
}
};
</script>
<style>
.mod_bg {
background: url("../../../public/img/bg_detail.jpg") 50% 0 repeat-x;
/*background: linear-gradient(to bottom, #FFFFFF,#FFFFFF,#FFFFFF, #eeeeee);*/
}
.mod_bg .el-carousel__button{
background-color: #67e56d !important;
}
.mod_title{
height: 40px;
line-height: 40px;
font-size: 28px;
font-weight: bolder;
color: #3a3a3a;
text-align: center;
padding: 50px 0 24px 0;
letter-spacing:10px;
}
.mod_small_title{
text-align: center;
height: 50px;
line-height: 50px;
font-size: 15px;
}
.recommend-box{
display: flex;
}
.recommend-item{
width: calc(20% - 0px);
margin: 10px 10px 10px 10px;
cursor: pointer;
}
.recommend-item:first-of-type{
margin: 10px 10px 10px 0!important;
}
.recommend-item:last-of-type{
margin: 10px 0 10px 10px!important;
}
.recommend-item-title{
height: 22px;
line-height: 22px;
overflow: hidden;
text-overflow: ellipsis;
margin-top: 15px;
}
.title-active:hover{
cursor: pointer;
color: #31c27c;
}
.recommend-item-des{
color: #999;
}
.play-box{
opacity: 0;
position: relative;
text-align: center;
height: 224px;
overflow: hidden;
margin-top: -224px;
background-color: rgba(161, 161, 161, 0.5);
}
.play-box img{
width: 25px;
height: 25px;
margin-top: 87px;
}
.play-item:hover .cover{
transition: transform 1s ease 0s;
transform: scale(1.1);
}
.play-item:hover .play-box{
opacity: 1;
}
.play-item:hover .play-box img{
transition: transform 0.5s ease 0s;
transform: scale(2);
}
</style>
以QQ音乐官方网站作为参考,模拟实现,实现最终的效果还是满意的,样式交互等也是最大化模拟官方的,后续再不断完善、增加其他功能和其他页面。
需要源码:点赞 + 关注 + 留言 + 私信
觉得不错的点个赞,如有建议的请留言,非常感谢!
如需帮助,私聊作者即可!再次感谢~
本文对使用到的技术仅做简单的介绍,若想了解更多,请前往相应的官网网站进行学习。
本文适合对爬虫相关知识接触不多的新手,主要是普及Selenium如何做爬虫,大佬请跳过。
pip install Selenium
from selenium import webdriver
driver=webdriver.Chrome(executable_path="C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe")
如果看到开启了一个浏览器窗口就是成功了,否则下面会有相应的报错信息,需要检查前面的步骤。
1.元素定位方式:
分享快速定位元素的小妙招:看所需信息所在的标签的id,class,name的名称是否与标签下信息的语义有关,一般有关的都代表是唯一的。(从开发者的角度去思考)若无法通过当前标签唯一定位,则考虑父级标签,一次类推,总是能找到定位的方法的。
2.鼠标事件(模拟鼠标操作)
3.键盘事件(模拟键盘操作)
4.其他操作
使用csv库,将爬取到的数据写入到csv文件中进行持久化。
from selenium import webdriver
import csv
from time import sleep
import time
#
# Author : ATFWUS
# Date : 2021-03-21 20:00
# Version : 1.0
# 爬取周杰伦最热门五首歌曲的基本信息,歌词,前五百条热门评论
# 此代码仅供交流学习使用
#
#1.创建Chrome浏览器对象,这会在电脑上在打开一个浏览器窗口
driver=webdriver.Chrome(executable_path="C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe")
#2.打开QQ音乐 -周杰伦页面
driver.get("https://y.qq.com/n/yqq/singer/0025NhlN2yWrP4.html")
#3.配置
csv_file=open('songs.csv','w',newline='',encoding='utf-8')
writer=csv.writer(csv_file)
start=time.time()
# 取前5首歌曲
song_numer=5
song_url_list=[]
song_resourses=[]
songlist__item=driver.find_elements_by_class_name("songlist__item")
# 获取所有歌曲url
for song in songlist__item:
song__url=song.find_element_by_class_name("js_song").get_attribute("href")
song_url_list.append(song__url)
song_numer-=1
if(song_numer==0):
break
# print(song_url_list)
print("已获取周杰伦热门歌曲列表前五首的url")
print()
# 获取一首歌曲所需要的信息
def getSongResourse(url):
song_resourse={}
driver.get(url)
# 这个0.5秒用于等待异步请求的完成
sleep(0.8)
# 获取歌曲名
song_name=driver.find_element_by_class_name("data__name_txt").text
print("开始获取歌曲《"+song_name+"》的基本信息")
# 获取流派,发行时间,评论数
song_liupai=driver.find_element_by_css_selector(".js_genre").text[3:]
song_time=driver.find_element_by_css_selector(".js_public_time").text[5:]
song_comment_num=driver.find_element_by_css_selector(".js_into_comment").text[3:-1]
print("歌曲《" + song_name + "》基本信息获取完毕")
print("开始获取歌曲《" + song_name + "》的歌词")
# 点击展开歌词
driver.find_element_by_partial_link_text("[展开]").click()
sleep(0.3)
lyic=""
# 获取拼接歌词
lyic_box=driver.find_element_by_id("lrc_content").find_elements_by_tag_name("p")
for l in lyic_box:
if l.text!="":
lyic+=l.text+"\n"
print("歌曲《" + song_name + "》的歌词获取完毕")
print("开始获取歌曲《" + song_name + "》的第1-15条热门评论")
# 获取500条评论
comments=[]
# 点击加载更多29次,每次多出15条评论
for i in range(33):
driver.find_element_by_partial_link_text("点击加载更多").click()
print("开始获取歌曲《" + song_name + "》的第"+str((i+1)*15+1)+"-"+str((i+2)*15)+"条热门评论")
sleep(0.5)
comments_list=driver.find_element_by_css_selector(".js_hot_list").find_elements_by_tag_name("li")
for com in comments_list:
content=com.find_element_by_css_selector(".js_hot_text").text
content_time=com.find_element_by_css_selector(".comment__date").text
zan_num=com.find_element_by_class_name("js_praise_num").text
comment={}
comment.update({"评论内容":content})
comment.update({"评论时间":content_time})
comment.update({"评论点赞次数":zan_num})
comments.append(comment)
print("歌曲《" + song_name + "》的前五百条热门评论获取完毕")
print("歌曲《"+song_name+"》所有信息获取完毕")
print()
song_resourse.update({"歌曲名":song_name})
song_resourse.update({"流派":song_liupai})
song_resourse.update({"发行时间":song_time})
song_resourse.update({"评论数":song_comment_num})
song_resourse.update({"歌词":lyic})
song_resourse.update({"500条精彩评论":comments})
return song_resourse
for song_page in song_url_list:
song_resourses.append(getSongResourse(song_page))
# break
print("正在写入CSV文件...")
for i in song_resourses:
writer.writerow([i["歌曲名"],i["流派"],i["发行时间"],i["评论数"],i["歌词"]])
for j in i["500条精彩评论"]:
writer.writerow([j["评论内容"],j["评论时间"],j["评论点赞次数"]])
writer.writerow([])
csv_file.close()
end=time.time()
print("爬取完成,总耗时"+str(end-start)+"秒")
pip install padas
import pandas as pd
import csv
# 这五个列表用于创建Series
se=[]
names=[]
# 先读取CSV文件的内容至内存中
with open("songs.csv",'r',encoding="utf8") as f:
# 创建阅读器对象
reader=csv.reader(f)
rows=[row for row in reader]
index=0
print("开始解析CSV数据...")
for i in range(5):
s1=[]
# 读取第一行信息
names.append(rows[index].__str__().split(',')[0][2:-1])
index+=1
# 读取五百条评论的点赞消息
for j in range(510):
s1.append(int(rows[index].__str__().split(',')[2][2:-2]))
index+=1
se.append(s1)
# 读取掉空行
index+=1
print("CSV数据解析成功\n")
# 创建的5个series
for i in range(5):
series=pd.Series(se[i])
print("歌曲《"+names[i]+"》的平均点赞次数是:" + str(series.mean()))
print("歌曲《" + names[i] + "》的标准差是:" + str(series.std()))
print()
感叹:爬下几千条评论,看了之后,发现,有伤感那味了,哈哈哈
作者:ATFWUS
原文链接:https://blog.csdn.net/ATFWUS/article/details/115053245
*请认真填写需求信息,我们会在24小时内与您取得联系。