在我的文本框中
external.xx.fbcdn.net/safe_image.php?d=AQBitTwGIFdSUoa1&url=http%3A%2F%2Fapi-download.com%2Fgatekeeper%2FW3siZSI6MTQ5OTkyNTc4MSwiZCI6InNodXR0ZXJzdG9jay1tZWRpYSIsImsiOiJwaG90b1wvNDE3NDM0NDQzXC9tZWRpdW0uanBnIiwibSI6MH0sIlBZRG5JV2RoM2FhU09MS0FQVzUzRjFGTjhqMCJd%2Fshutterstock_417434443.jpg%3Ftoken%3Dexp%3D1499925781%7Eacl%3D %2Fgatekeeper%2FW3siZSI6MTQ5OTkyNTc4MSwiZCI6InNodXR0ZXJzdG9jay1tZWRpYSIsImsiOiJwaG90b1wvNDE3NDM0NDQzXC9tZWRpdW0uanBnIiwibSI6MH0sIlBZRG5JV2RoM2FhU09MS0FQVzUzRjFGTjhqMCJd%2Ftest_417434443.jpg%2A%7Ehmac%3D7bab702bc0ef6b59b90061f22552226e8671410b&安培; _nc_hash = AQC6jPXsLA9PVA_F
我想解决这个问题
api-download.com/gatekeeper/W3siZSI6MTQ5OTkyNTc4MSwiZCI6InNodXR0ZXJzdG9jay1tZWRpYSIsImsiOiJwaG90b1wvNDE3NDM0NDQzXC9tZWRpdW0uanBnIiwibSI6MH0sIlBZRG5JV2RoM2FhU09MS0FQVzUzRjFGTjhqMCJd/test_417434443.jpg
如何直接从vb.net
执行此操作答案 0 :(得分:0)
字符串是url编码的。
如果您对网址进行解码,它将变得更具可读性,实际上这个网站会将其作为网址并自动链接。
external.xx.fbcdn.net/safe_image.php?d=AQBitTwGIFdSUoa1&url = http://api-download.com/gatekeeper/W3siZSI6MTQ5OTkyNTc4MSwiZCI6InNodXR0ZXJzdG9jay1tZWRpYSIsImsiOiJwaG90b1wvNDE3NDM0NDQzXC9tZWRpdW0uanBnIiwibSI6MH0sIlBZRG5JV2RoM2FhU09MS0FQVzUzRjFGTjhqMCJd/shutterstock_417434443.jpg?token=exp=1499925781~acl=/gatekeeper/W3siZSI6MTQ5OTkyNTc4MSwiZCI6InNodXR0ZXJzdG9jay1tZWRpYSIsImsiOiJwaG90b1wvNDE3NDM0NDQzXC9tZWRpdW0uanBnIiwibSI6MH0sIlBZRG5JV2RoM2FhU09MS0FQVzUzRjFGTjhqMCJd/test_417434443.jpg *〜HMAC = 7bab702bc0ef6b59b90061f22552226e8671410b&安培; _nc_hash = AQC6jPXsLA9PVA_F
您现在可以看到您要查找的部分是网址查询。
清理所需字符串并获得所需值的最简单方法是向项目添加对System.Web.Dll的引用,并将System.Web导入到您的类中。
然后,您可以使用Utility
中的共享方法清理字符串,然后将其解析为值集合。
在两者之间创建一个新的URI
,以便您可以读取要解析的查询字符串属性。
Dim original = "external.xx.fbcdn.net/safe_image.php?d=AQBitTwGIFdSUoa1&url=http://api-download.com/gatekeeper/W3siZSI6MTQ5OTkyNTc4MSwiZCI6InNodXR0ZXJzdG9jay1tZWRpYSIsImsiOiJwaG90b1wvNDE3NDM0NDQzXC9tZWRpdW0uanBnIiwibSI6MH0sIlBZRG5JV2RoM2FhU09MS0FQVzUzRjFGTjhqMCJd/shutterstock_417434443.jpg?token=exp=1499925781~acl=/gatekeeper/W3siZSI6MTQ5OTkyNTc4MSwiZCI6InNodXR0ZXJzdG9jay1tZWRpYSIsImsiOiJwaG90b1wvNDE3NDM0NDQzXC9tZWRpdW0uanBnIiwibSI6MH0sIlBZRG5JV2RoM2FhU09MS0FQVzUzRjFGTjhqMCJd/test_417434443.jpg*~hmac=7bab702bc0ef6b59b90061f22552226e8671410b&_nc_hash=AQC6jPXsLA9PVA_F"
Dim decoded = HttpUtility.UrlDecode(original)
Dim ul = New Uri("http://" & decoded)
Dim col = HttpUtility.ParseQueryString(ul.Query)
Dim whatIWant = col("url") ' this is the value that you want.