当前位置: 首页 > news >正文

新网站如何才做被百度收录网站打开速度影响因素

新网站如何才做被百度收录,网站打开速度影响因素,花都区手机版网站建设,简单的网页设计作业在用WebBrowser编程实现网页操作自动化时#xff0c;常要分析网页Html#xff0c;例如网页在加载数据时#xff0c;常会显示“系统处理中#xff0c;请稍候..”#xff0c;我们需要在数据加载完成后才能继续下一步操作#xff0c;如何抓取这个信息的网页html元素变化常要分析网页Html例如网页在加载数据时常会显示“系统处理中请稍候..”我们需要在数据加载完成后才能继续下一步操作如何抓取这个信息的网页html元素变化从而判断数据加载完毕呢用IE开发者工具是不可能抓取到的太快了。(当然设置足够长的延时也是可以实现的只是不够科学及稳妥毕竟有时因为网络原因数据加载时间可能超过原来设定时间其次设置延时过长也导致程序不够友好 实现的办法 1、先用“系统处理中”查找泛查找并在找到html中再细找缩小html元素范围。 bb FindHtmlElement(系统处理中, ExtendedWebBrowser1.Document, , InnerText, false) 2、添加一个Timer控件设定100毫秒。根据 1中找到的元素进行不断抓取并将抓到的结果输出到文本。 3、将2中输出导入Excel进行筛选并从中找到重复次数少的行便是数据加载、加载完成之间的变化。 Private Sub TimerProgress_Tick(sender As Object, e As EventArgs) Handles TimerProgress.TickIf Gethtmel ThenDim bb As HtmlElementbb FindHtmlElement(all_jzts, ExtendedWebBrowser1.Document, div, id, True)If Not bb Is Nothing ThenWriteRunLog(Style bb.Style)WriteRunLog(bb.OuterHtml)ElseWriteRunLog(all_jzts没找到)End Ifbb FindHtmlElement(jzts, ExtendedWebBrowser1.Document, div, id, True)If Not bb Is Nothing ThenWriteRunLog(Style bb.Style)WriteRunLog(bb.OuterHtml)ElseWriteRunLog(jzts没找到)End IfGethtmel FalseEnd If系统处理中请稍候...Application.DoEvents()End Sub Function FindHtmlElement(ByVal FindText As String, ByVal doc As HtmlDocument, ByVal cTagName As String, ByVal cGetAttribute As String, Optional ByVal StrictMatching As Boolean False) As HtmlElementcTagName检索具有指定 html 标记的元素标记需要输入完整的缺省时查找所有。例如input classbutton typesubmit value提交 stylecursor:hand不能只输入i需要输入inputcGetAttribute 比较的属性类型取值为Id、InnerText、Name、title、classname、value、Id、InnerText可以通过GetAttribute获取也可以通过HtmlElement.Id、HtmlElement.InnerText获取所以代码简化为用GetAttribute获取。docWebBrowserExt1.DocumentGetAttribute(classname) 例如显示classcommonTable的值commonTableStrictMatchingTrue严格匹配FindTextWriteRunLog(FindHtmlElement开始 FindText)TryDim i, k As IntegerFindHtmlElement NothingFindHtmlElementOfDocument docIf doc Is Nothing Then 2023.11.15在递归调用中因为有些iFrames还未真正加载从而导致传入的doc doc.Window.Frames.Item(k).Document 为 Nothing 从而引发异常未将对象引用设置到对象的实例。Exit FunctionEnd IfIf LCase(cGetAttribute) innertext Then InnerText必须严格匹配否则找到的结果是错误的。’StrictMatching TrueEnd IfIf cTagName ThenDim EE As HtmlElementCollection doc.GetElementsByTagName(cTagName)For i 0 To EE.Count - 1If InStr(EE.Item(i).GetAttribute(cGetAttribute), FindText) 0 _And (Not StrictMatching Or InStr(FindText, EE.Item(i).GetAttribute(cGetAttribute)) 0) ThenFindHtmlElement EE.Item(i)WriteRunLog(Loop1)WriteRunLog(FindHtmlElement结束0)Exit Function 找到就退出End IfNextElseFor i 0 To doc.All.Count - 1If InStr(doc.All.Item(i).GetAttribute(cGetAttribute), FindText) 0 _And (Not StrictMatching Or InStr(FindText, doc.All.Item(i).GetAttribute(cGetAttribute)) 0) And (cTagName Or LCase(cTagName) LCase(doc.All.Item(i).TagName)) ThenFindHtmlElement doc.All.Item(i)WriteRunLog(Loop1)WriteRunLog(FindHtmlElement结束0)Exit Function 找到就退出End IfNextEnd If上面没找到进行递归调用递归会查找所有嵌套的Frame。For k 0 To doc.Window.Frames.Count - 1If k 0 Then WriteRunLog(递归调用 doc.Window.Frames.Count doc.Window.Frames.Count.ToString) For TestEnd If2018.3.14 直接 递归调用WriteRunLog(递归调用 Str(k)) WriteRunLog(doc.Window.Frames.Item(k).Name doc.Window.Frames.Item(k).Name)FindHtmlElementOfDocument doc.Window.Frames.Item(k).DocumentFindHtmlElement FindHtmlElement(FindText, doc.Window.Frames.Item(k).Document, cTagName, cGetAttribute, StrictMatching)If Not FindHtmlElement Is Nothing Then 找到就退出循环WriteRunLog(FindHtmlElement结束1)Exit FunctionEnd IfNextCatch ex As ExceptionFindHtmlElement NothingWriteRunLog(FindHtmlElement发生异常 ex.Message)End TryEnd FunctionSub WriteRunLog(ByVal MyMsg As String)Using w As StreamWriter File.AppendText(RunLog.txt)Dim w As StreamWriterIf File.Exists(RunLog.txt) ThenIf My.Computer.FileSystem.GetFileInfo(RunLog.txt).Length 10485760 Then 2017.5.4 文件大于10M清0w File.CreateText(RunLog.txt)w.Write(文件大于10M置0从头开始)w.Write(Chr(9))Elsew File.AppendText(RunLog.txt)End IfElsew File.CreateText(RunLog.txt)End Ifw.Write(Now)w.Write(Chr(9)) 插入Tab键w.WriteLine(MyMsg)w.Flush()w.Close()End UsingEnd Sub
http://www.hkea.cn/news/14397126/

相关文章:

  • 什么网站做一手项目好海外网站推广方法
  • 福建省建设继续教育网站公关公司经营范围
  • 六安企业网站seo多少钱电商网站后台
  • 深圳微信网站运营商城网站开发的目的和意义
  • 哪里有网站建设开发公司企业做网站的好处千秋网络
  • 北京企业网站seo平台erp .net网站开发
  • 微网站 留言板免费开网店app
  • asp美食网站源码网站 工商备案
  • 做网站要签合同吗郑州短视频拍摄公司
  • 跳蚤市场网站开发背景门户网站的基本特征多选题
  • 上海建设人才网官网提供常州网站优化
  • 专业建站哪家好宁波网站制作工具
  • 建设一个地方门户网站建立一个网站多少钱
  • 学校网站报价单做百度网站需不需要备案吗
  • 做网站可以使用rem单位吗做网站什么字体
  • 织梦软件展示网站有限公司网站建设 互成网络地址 四川
  • 鱼台县建设局网站软件下载网站怎么赚钱
  • 建设集团有限公司网站wordpress页面中去掉分页
  • 自微网站首页什么是小程序商城
  • 张家港市住房城乡建设局网站访问网站出来的是目录
  • 网站备案号密码2022年楼市大爆发
  • 音乐相册制作网站广告营销留电话网站
  • 建设邮费自己的网站 要不要购买服务器的律师微网站建设
  • 网站配色模板html制作网页代码模板
  • seo站长工具推广平台网站建设活动广告
  • html5 网站 代码运城盐湖区姚孟信通网站开发中心
  • 永州网站推广东莞制作网站建设的公司
  • 制作一个网站的步骤百科网站程序
  • 浩博建设集团网站广州易网网站建设
  • 长沙有效的可以看的网站大型网站建设哪家好