Created
April 3, 2024 03:26
-
-
Save zhu3pang/d2cc0c624e20d036416a6bdf385a74db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
# pip3 install youtube-search-python | |
# brew install yt-dlp | |
# brew install ffmpeg | |
from youtubesearchpython import VideosSearch | |
music_list = [ | |
'丁香花', | |
'秋天不回来', | |
# '求佛', | |
# '让泪化作相思雨', | |
# '有一种爱叫做放手', | |
# '最后一次放手', | |
# '等一分钟', | |
# '分手在那个秋天', | |
# '下辈子如果我还记得你', | |
# '曾经最美', | |
# '爸爸妈妈', | |
# '三国恋', | |
# '太多', | |
# '偏爱', | |
# '七月七日晴', | |
# '一直很安静', | |
# '不要用我的爱来伤害我', | |
# '断点', | |
# '爱上你是一个错', | |
# '折子戏', | |
# '一万个理由', | |
# '心痛2009', | |
# '被伤过的心还可以爱谁', | |
# '丢了幸福的猪', | |
# '忘不掉的伤', | |
# '十一年', | |
# '香水有毒', | |
# '回心转意', | |
# '天使的翅膀', | |
# '外滩十八号', | |
# '老人与海', | |
# '你到底爱谁', | |
# '冰吻', | |
# '分手那天', | |
# '今生最爱', | |
# '做你的爱人', | |
# '回来我的爱', | |
# '偷偷的哭', | |
# '一个人的寂寞', | |
# '最幸福的人', | |
# '爱情买卖', | |
# '伤不起', | |
# '犯错', | |
# '错错错', | |
# '下完这场雨', | |
# '没那么简单', | |
# '舍不得', | |
# '我爱他', | |
# '为你而活', | |
# '这条街擦肩而过', | |
# '愚爱', | |
# '放生', | |
# '生日礼物', | |
# '痴心绝对', | |
# '有没有人告诉你', | |
# '加速度', | |
# '亲爱的你怎么不在我身边', | |
# '漂亮的姑娘就要嫁人了', | |
# '想太多', | |
# '离别', | |
# '预谋', | |
# '蝴蝶泉边', | |
# '独立', | |
# '太早', | |
# '当你孤单你会想起谁', | |
# '孤单北半球', | |
# '该死的温柔', | |
# '爱情诺曼底', | |
# '下沙', | |
# '那女孩对我说', | |
# '下一个天亮', | |
# '纷飞', | |
# '爱死的昨天', | |
# '飞舞', | |
# '天涯', | |
# '爱情错觉', | |
# '你的选择', | |
# '死心塌地', | |
# '别说我的眼泪你无所谓', | |
# '那一夜', | |
# '狼爱上羊', | |
# '不要在我寂寞的时候说爱我', | |
# '老鼠爱大米', | |
# '两只蝴蝶', | |
# '爱情码头', | |
# '寂寞才说爱', | |
# '感动天感动地', | |
# '哥只是个传说', | |
# '小三', | |
# '我爱你胜过你爱我', | |
# '不要再来伤害我', | |
# '你把爱情给了谁', | |
# '死了都要爱', | |
# '香烟爱上火柴', | |
# '在心底从此永远有个你', | |
# '白狐', | |
# '在他乡', | |
# '2002年的第一场雪', | |
# '黄昏', | |
] | |
if __name__ == '__main__': | |
for music in music_list: | |
result = VideosSearch(music, limit=1).result() | |
video_url = result.get('result')[0].get('link') | |
subprocess.check_output(f'/opt/homebrew/bin/yt-dlp -o {music}.mp3 -x --audio-format mp3 --audio-quality 0 {video_url}', shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment