VS2010的VB.NET版本爬虫程序代码mp3QZQx-2024-8-16 - 13-32

Imports System.Net
Imports System.IO

Module Module1

Sub Main()
    Dim songUrls As String() = {
        "http://music.163.com/song/media/outer/url?id=5238221.mp3",
        "http://music.163.com/song/media/outer/url?id=240515.mp3",
        "http://music.163.com/song/media/outer/url?id=5255631.mp3",
        "http://music.163.com/song/media/outer/url?id=163123.mp3",
        "http://music.163.com/song/media/outer/url?id=82932.mp3",
        "http://music.163.com/song/media/outer/url?id=25795016.mp3",
        "http://music.163.com/song/media/outer/url?id=5255640.mp3"
    }

    Dim savePath As String = "C:\Users\Administrator\Desktop\爬虫程序mp3QZQx-2024-8-16 - 副本\新建文件夹\"

    For i As Integer = 0 To 6
        DownloadSong(songUrls(i), savePath & "song" & (i + 1) & ".mp3")
    Next
End Sub

Private Sub DownloadSong(ByVal url As String, ByVal savePath As String)
    Dim i As Integer
    Try
        Using client As New WebClient()
            client.DownloadFile(url, savePath)
            Console.WriteLine("歌曲 {0} 下载完成,保存在:{1}", i + 1, savePath)
        End Using
    Catch ex As Exception
        Console.WriteLine("下载歌曲 {0} 时出错:{1}", i + 1, ex.Message)
    End Try
End Sub

End Module

附测试地址

https://www.shiyinren.com/

http://music.163.com/song/media/outer/url?id=2164349779.mp3

http://lx.sycdn.kuwo.cn/c3bbc5a11310baf7e94cc53d03ddd71f/66bed8be/resource/n2/20/98/4213031618.mp3

https://www.myfreemp3.com.cn/jdlg.php?page=audioPage&type=netease&name=%E7%BB%8F%E5%85%B8%E8%80%81%E6%AD%8C500%E9%A6%96

水手
http://music.163.com/song/media/outer/url?id=5238221.mp3

香水有毒
http://music.163.com/song/media/outer/url?id=240515.mp3

  "http://music.163.com/song/media/outer/url?id=5238221.mp3",
        "http://music.163.com/song/media/outer/url?id=240515.mp3",
        "http://music.163.com/song/media/outer/url?id=5255631.mp3",
        "http://music.163.com/song/media/outer/url?id=163123.mp3",
        "http://music.163.com/song/media/outer/url?id=82932.mp3",
        "http://music.163.com/song/media/outer/url?id=25795016.mp3",
        "http://music.163.com/song/media/outer/url?id=5255640.mp3"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

易软科技(河源)有限公司

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值