导航:首页 > 源码编译 > 脚本获取源码指定的链接

脚本获取源码指定的链接

发布时间:2022-09-21 16:21:45

⑴ vba 中怎么通过链接获取网页源码

两种方法,一是使用AJAX,二是开启IE进程,我推荐用方法一,我的例子代码如下:

Dimhttp
Sethttp=CreateObject("Microsoft.XMLHTTP")
http.Open"POST","连接地址",False
http.send""
Ifhttp.Status=200Then
selection.text=http.responseText
EndIf

⑵ 如何提取网页源代码中的链接代码

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

⑶ 脚本大师做的脚本怎么导出源码

法导出源码的。如果不是小精灵好办了,按键精灵的脚本一般都是用文本文件编写的,直接打开脚本文本,复制里面的内容就行,但是一旦制作成按键小精灵,你就没办法从里面获取脚本源码,只能用录制功能再录制一遍,但录制出来的内容只是前台的鼠标操作和键盘操作,像找怪、自动加血这些功能是没有办法录制的。

⑷ 怎么从html源码中获取URL链接

1、火狐浏览器 点到一个空白的页面 右键 查看源代码 里面有url的一些地址;

希望对你有所帮助!!

⑸ "如何用shell脚本获取网页源码"

shell调用可抓取网页的工具即可。可写好抓取的python脚本,再用shell调用就行

⑹ 如何提取出网页源码里面的超链接地址

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

⑺ VBS里从网页源码里提取需要的网页链接

dim xp,url,MyStream
url=inputbox("输入网址")
if url&"a"<>"a" then
set xhp=createobject("microsoft.xmlhttp")
xhp.open "get",url,false
xhp.send
Set MyStream=CreateObject("Adodb.Stream")
MyStream.Type = 1
MyStream.Open
MyStream.Write xhp.responseBody
MyStream.SaveToFile "c:\xxx.html"
Msgbox "保存成功!哈哈"
end if

⑻ 怎么从html源码中获取URL链接

从html源码中获取URL链接的方法是写正则表达式处理。
举例:PHP获取页面中的所有链接
function getPageLink($url){
// 获取源文件的内容
$html=file_get_contents($url);
//编写正则表达式,匹配所有a标签内部的http连接
preg_match_all("/<a(s*[^>]+s*)href=([\"|']?)([^\"'>\s]+)([\"|']?)/ies",$html,$out);
// 匹配到的链接存入数组out

$arrLink=$out[3];
//解析链接
$arrUrl=parse_url($url);
// 返回链接
return $arrUrl;
}

⑼ Shell脚本中如何获取软链接的地址

$(pwd)和`pwd`效果是一样的,返回的是当前的路径

${0}返回的是脚本与当前路径的相对路径

所以

echo $(pwd)/${0}
就是脚本的绝对路径了

你执行下这个脚本就明白了

#!/bin/bash -x
echo ${0}
echo $(pwd)
echo $(pwd)/${0}

⑽ 谁会写个VBS脚本批量获取URL地址源代码内容

Dimfso,ts,s
setWshShell=WScript.CreateObject("WScript.Shell")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=fso.OpenTextFile("D:url.txt",1)'url.txt放在D盘
DoUntilts.AtEndOfStream
s=ts.ReadLine
iflen(s)>1then'非空行
'msgboxs
url_tmp=Trim(s)'去两端空格
'msgboxurl_tmp
date_str=get_url(url_tmp)
'msgboxdate_str
export_strurl_tmp&""&date_str&chr(13)&chr(10)
endif
loop
ts.Close
setWshShell=nothing
setfso=nothing
setts=nothing
msgbox"运行结束!"

Functionget_url(url)
Dimhttp
url_str="http://"&url&"/1.txt"'http://www.xx.com/1.txt
Sethttp=CreateObject("Msxml2.ServerXMLHTTP")
http.open"GET",url_str,False
http.send
ifhttp.status<>200then
get_url="error"'获取失败
else
get_url=http.responseText
endif
Sethttp=nothing
EndFunction

Subexport_str(str_e)
dimfs,exp_File
setfs=createobject("scripting.filesystemobject")
Setexp_File=fs.opentextfile("d:url_date.txt",8,true)'结果也在D盘
exp_File.writestr_e
exp_File.close
setfs=nothing
Setexp_File=nothing
EndSub

阅读全文

与脚本获取源码指定的链接相关的资料

热点内容
活塞式空气压缩机原理 浏览:791
vt编辑编制编译 浏览:806
抖音优质创作者推荐程序员 浏览:75
摄像机多控神器让拍摄轻松解压 浏览:422
杭州的服务器地址 浏览:277
全医药学大词典pdf 浏览:809
rv1109固件编译不通过 浏览:893
手机进水安卓怎么办 浏览:111
dns服务器如何内网外放 浏览:605
香港云服务器如何访问谷歌 浏览:370
诈骗命令 浏览:498
java使用容器 浏览:503
一个ip一个服务器地址 浏览:438
微信设置里的文件夹 浏览:263
编译原理什么是活跃信息 浏览:810
霍尼韦尔防区编程 浏览:814
esc如何设置到一个文件夹 浏览:772
linux网络超时 浏览:506
人的教育pdf 浏览:366
网络知识pdf 浏览:903