⑴ 如何提取網頁代碼中的鏈接代碼

Private Sub Command1_Click()

Dim s As String

s = Text1.Text
s = Replace(Text1.Text, vbCrLf, "") '移除所有回車換行符

'Dim oRegEx As RegExp
'Set oRegEx = New RegExp
'Dim oMatches As MatchCollection
'Dim oMatch As Match

Dim oRegEx As Object
Set oRegEx = CreateObject("VBScript.RegExp")
Dim oMatches As Object
Dim oMatch As Object

With oRegEx
.Global = True '全局匹配
.IgnoreCase = True '忽略大小寫
.Pattern = "<a[^>]*?href=[""' ]?(.*?)(?:""|'| ).[^> ]*?>([\s\S]*?)</a>"
'提取所有A標簽的正則式,小括弧中是子匹配引用組第一個是 (.*?) 第二個是([\s\S]*?)
Set oMatches = .Execute(s)

If oMatches.Count >= 1 Then
Text2.Text = ""

Dim sHref As String, sInnerText As String

Dim i As Integer

Dim sLink As String

'Dim colLinks As Scripting.Dictionary
'Set colLinks = New Scripting.Dictionary

Dim colLinks As Object
Set colLinks = CreateObject("Scripting.Dictionary")

For Each oMatch In oMatches

sHref = oMatch.SubMatches(0) '(.*?)
sInnerText = oMatch.SubMatches(1) '([\s\S]*?)
sInnerText = RemoveTags(sInnerText) '移除A標簽(內容)中的多餘標簽
sInnerText = Replace(sInnerText, " ", "") '移除A標簽(內容)中的所有空格
sLink = "<A href=""" & sHref & """>" & sInnerText & "</A>"

If Not colLinks.Exists(sLink) Then
colLinks.Add sLink, sLink
Text2.Text = Text2.Text & sLink & vbNewLine
End If

Next

End If

End With

Set oMatches = Nothing
Set oMatch = Nothing
Set oRegEx = Nothing
Set colLinks = Nothing
End Sub

'這個函數可以去除html代碼中的標簽
Function RemoveTags(ByVal html As String)

'Dim oRegEx As RegExp
'Set oRegEx = New RegExp
Dim oRegEx As Object

Set oRegEx = CreateObject("VBScript.RegExp")

With oRegEx
.Global = True
.IgnoreCase = True
.Pattern = "<[^>]*>"
RemoveTags = .Replace(html, "")
End With

Set oRegEx = Nothing
End Function

⑵ 求一在一大段網頁源代碼中提取URL源碼

呵呵,我以前寫過一個函數,你試試吧:

Private Sub Command1_Click()
Text1 = FindStrMulti$(源碼變數, "WWW", "COM", vbCrLf, 1)
End Sub

'取得字元串中的指定內容(字元串變數,關鍵字前綴,關鍵字後綴,輸出的分隔符,是否包含關鍵字)
Function FindStrMulti$(Strall$, FirstStr$, EndStr$, SplitStr$, Findmod&)
Dim i&, j&
Do
i = InStr(i + 1, Strall, FirstStr)
If i = 0 Then Exit Do
If Findmod = 0 Then i = i + Len(FirstStr)
j = InStr(i, Strall, EndStr)
If j = 0 Then Exit Do
If Findmod = 1 Then j = j + Len(EndStr)
FindStrMulti = IIf(Len(FindStrMulti) > 0, FindStrMulti & SplitStr, "") & Mid(Strall, i, j - i)
Loop
End Function

⑶ 如何通過網頁源代碼來提取網頁中的圖片

可以現在網頁源碼中找到圖片的鏈接,然後將圖片在新窗口打開並進行保存。

1、右版擊想要提取的圖片權,在展開的菜單中點擊「檢查」按鈕打開控制台:

⑷ 怎麼獲取網頁源代碼中的文件

獲取網頁源代碼中的文件的具體步驟如下:

1、首先我們在瀏覽器里隨意打開一張網頁查看版其源代碼。權

⑸ 如何獲取html網頁原始的源代碼

直接打開網頁,快捷鍵 Ctrl + U ,看到的就是源代碼

⑹ 如何獲得某個網頁的PHP源碼

那你只能跟網站的擁有者或者開發者聯系索取了。別妄想直接通過某個軟體或程序就能獲得網站的後台源碼,要真能這樣,我把支付寶的源碼拿來玩玩?
當然,如果你能找到一個牛X的黑客通過非常規的手段去獲取源碼,那當我沒說。

⑺ 請問如何提取網頁源代碼指定內容(最好用批處理)

就是一個採集工具了。建議安裝個採集軟體試下,破解版的火車頭

⑻ 怎樣取得網頁中的HTML源代碼

1、瀏覽器打開網頁,右鍵-》查看源代碼

以上兩種方法,選擇其一即可。

⑼ 怎樣得到一個網頁的源代碼

右擊網頁,點擊「查看源代碼」;或是在瀏覽器菜單中選擇「查看」->「查看網頁源代碼」。