淘宝的网页字串转换(使用vb.net)

我爬下来的连接为

https://click.simba.taobao.com/cc_im?p=%BD%E0%C3%E6%D2%C7&s=1194321786&k=601&e=jvjI4EucITTy2F9WXZO1I0NqmvN1wXwCscz8ul%2BxbG%2FMLhlrKVZB9BBSfnEkGxnU%2B7%2BMrLVOjqKKMLgAzHSGGa26WjHr%2FnFJyg0q926rcH80l%2FhbVnCwEwnYP2zn3HfPwKamR0HoW7o%2BHdtOZxkWWEfElWhLjYznb991nFlfKsviyI844G77%2FTCepvSN4m5M49movUIeQT91F7BtIXjA7xjT3nbRS1t%2FtHOltJSErF8yXu6czxAfqhVAjQkV8pb6qBlDIqlOrjtHrrTmhV52Q24VjWNeDNd1HmQLuKmFSF7fo1peDgPl81alOdKJbqXjjJO%2BgtCS%2BZb2NP6d%2BY023iTlB1tdkBA82jJznyZckCxhRzgFEUwNEEYL%2BlAjltm7IMOd0bPI39mpd4f471dlrR0MzJSlZA1PsHw9hwgf3VAz2hImJhBKx564LE2qED1qzIrlmKH5L5F6Md8essnvuhqxKCL1NiH8JeBx%2B4%2B5VDuKhmz21CoLgfGbUT%2FUgX7mBz37eWaHSrgobrvEiU5noMsOR8KkTI7PBnCzv3GErv51G20dkyK%2BPVX0%2BYnrahA3%2FltRG3IlK0%2Br65T%2BlJyESQ%3D%3D#detail

我将上次的字串贴到browser后,会自动变成以下的字串

https://item.taobao.com/item.htm?id=558075412162&ali_refid=a3_430585_1006:1105386866:N:%E6%B4%81%E9%9D%A2%E4%BB%AA:3d8ac7bb296003678ea505df29f07c68&ali_trackid=1_3d8ac7bb296003678ea505df29f07c68#detail
我目的是要取得ID值"558075412162" 这个,因为原始的字串,没有这个ID
我要复制到browser才能取得ID,请问我使用vb.net怎么从原始数据取得ID值呢

初始的字串都是存在数据库里的,然后我再将其读到vb.net里

1个回答

Imports System.Net
Imports System.Text.RegularExpressions

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim http As HttpWebRequest = HttpWebRequest.Create(TextBox1.Text)
        http.Method = "GET"
        http.AllowAutoRedirect = False
        Dim re = http.GetResponse()
        Dim url = re.Headers("Location")
        MsgBox(Regex.Match(url, "(?<=id\=)\d+").Value)
    End Sub
End Class

图片说明

问题如果解决,请点我回答左上角的采纳,谢谢

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐