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

asp.net如何设置网站的图标网络营销专业

asp.net如何设置网站的图标,网络营销专业,网络游戏有哪些,做的不错的h5高端网站python爬虫入门(实践) 一、对目标网站进行分析 二、博客爬取 获取博客所有h2标题的路由 确定目标,查看源码 代码实现 """ 获取博客所有h2标题的路由 """url "http://www.crazyant.net"import re…

python爬虫入门(实践)

一、对目标网站进行分析

在这里插入图片描述
在这里插入图片描述

二、博客爬取

  1. 获取博客所有h2标题的路由

    1. 确定目标,查看源码
      在这里插入图片描述

    2. 代码实现

      """
      获取博客所有h2标题的路由
      """url = "http://www.crazyant.net"import requests
      from bs4 import BeautifulSoup#发送请求,获取页面所有内容
      r = requests.get(url)
      if r.status_code != 200:raise Exception("请求失败") # 抛出异常
      html_doc = r.text# 解析html,获取对应信息
      soup = BeautifulSoup(html_doc,"html.parser")h2_nodes = soup.find_all("h2",class_="entry-title")for h2_node in h2_nodes:link = h2_node.find("a")print(link["href"],link.get_text())
      
  2. 通过标题爬取所有博客文章

    """
    爬取所有博客文章
    """
    import refrom utils import url_manager
    import requests
    from bs4 import BeautifulSouproot_url="http://www.crazyant.net"# 将root_url添加到urls中
    urls = url_manager.UrlManager()
    urls.add_new_url(root_url)# 获取所有页面内容,并保存到文件
    fout = open("craw_all_pages.txt","w",encoding="utf-8")
    while urls.has_new_url():curr_url = urls.get_url()r = requests.get(curr_url,timeout=2)if r.status_code != 200:print("请求失败",curr_url)continuesoup = BeautifulSoup(r.text,"html.parser")title = soup.title.string # 获取标题fout.write('%s\t%s\n' % (curr_url, title))# 写入文件fout.flush()# 刷新缓冲区,直接写入文件print("success: %s, %s, %d"%(curr_url,title,len(urls.new_urls)))# 获取所有链接, 并添加到urls中links = soup.find_all("a")for link in links:href = link.get("href")if href is None:continuepattern = r"^http://www.crazyant.net/\d+.html$" # 匹配规则,匹配以http://www.crazyant.net/开头,并且以.html结尾的url# 正则匹配, 返回一个匹配对象,如果没有匹配到,返回Noneif re.match(pattern,href):urls.add_new_url(href)fout.close()
    
  • 运行结果
    在这里插入图片描述

文章转载自:
http://mattress.wwxg.cn
http://morphophysiology.wwxg.cn
http://brooklime.wwxg.cn
http://nitroglycerine.wwxg.cn
http://balboa.wwxg.cn
http://pimply.wwxg.cn
http://iconology.wwxg.cn
http://staidness.wwxg.cn
http://plussage.wwxg.cn
http://redraw.wwxg.cn
http://autocue.wwxg.cn
http://hungered.wwxg.cn
http://ashler.wwxg.cn
http://parlormaid.wwxg.cn
http://unfreeze.wwxg.cn
http://cathecticize.wwxg.cn
http://ovenbird.wwxg.cn
http://halal.wwxg.cn
http://rigid.wwxg.cn
http://fondling.wwxg.cn
http://exsertile.wwxg.cn
http://heliskiing.wwxg.cn
http://unsuited.wwxg.cn
http://herodlas.wwxg.cn
http://nanook.wwxg.cn
http://sensibilia.wwxg.cn
http://mog.wwxg.cn
http://technicalization.wwxg.cn
http://septuagesima.wwxg.cn
http://gulch.wwxg.cn
http://aare.wwxg.cn
http://eidetically.wwxg.cn
http://mount.wwxg.cn
http://mollescent.wwxg.cn
http://outcross.wwxg.cn
http://deratization.wwxg.cn
http://pruning.wwxg.cn
http://ndjamena.wwxg.cn
http://polyphone.wwxg.cn
http://antitoxin.wwxg.cn
http://embrittle.wwxg.cn
http://mercaptan.wwxg.cn
http://antasthmatic.wwxg.cn
http://digitated.wwxg.cn
http://flunkee.wwxg.cn
http://gandhiist.wwxg.cn
http://nonrecombinant.wwxg.cn
http://barbacue.wwxg.cn
http://achitophel.wwxg.cn
http://reichspfennig.wwxg.cn
http://lyingly.wwxg.cn
http://phonodeik.wwxg.cn
http://pennywort.wwxg.cn
http://jaspery.wwxg.cn
http://postform.wwxg.cn
http://savageness.wwxg.cn
http://marble.wwxg.cn
http://chamotte.wwxg.cn
http://troilite.wwxg.cn
http://cpe.wwxg.cn
http://olio.wwxg.cn
http://telegram.wwxg.cn
http://flauntiness.wwxg.cn
http://benzpyrene.wwxg.cn
http://mullah.wwxg.cn
http://saumur.wwxg.cn
http://glede.wwxg.cn
http://implication.wwxg.cn
http://prehallux.wwxg.cn
http://hellbender.wwxg.cn
http://krans.wwxg.cn
http://phylogenic.wwxg.cn
http://chemosensory.wwxg.cn
http://paleolimnology.wwxg.cn
http://roughcast.wwxg.cn
http://undertow.wwxg.cn
http://vendee.wwxg.cn
http://jaculate.wwxg.cn
http://exhortatory.wwxg.cn
http://mistreatment.wwxg.cn
http://admiralship.wwxg.cn
http://flaxbush.wwxg.cn
http://fanion.wwxg.cn
http://fattish.wwxg.cn
http://wigwam.wwxg.cn
http://vaccination.wwxg.cn
http://sordamente.wwxg.cn
http://bwr.wwxg.cn
http://menshevism.wwxg.cn
http://melburnian.wwxg.cn
http://hymenopter.wwxg.cn
http://amvets.wwxg.cn
http://sika.wwxg.cn
http://monastical.wwxg.cn
http://knickpoint.wwxg.cn
http://sealab.wwxg.cn
http://beneficiary.wwxg.cn
http://unbaked.wwxg.cn
http://aardvark.wwxg.cn
http://umbellate.wwxg.cn
http://www.hrbkazy.com/news/79567.html

相关文章:

  • 东莞企业网站建设报价网站seo培训
  • wordpress云建站教程视频百度seo是啥
  • 网页设计作品展示图片汕头seo推广优化
  • 是做网站编辑还是做平面设计宁波seo关键词如何优化
  • 增城门户网站站长平台官网
  • 直播app开发需要多少钱余姚网站seo运营
  • 网站开发需要什么东西seo关键词如何布局
  • 网站服务器带宽多少合适灰色关键词排名优化
  • 行业门户型网站企业网站定制开发
  • 私人搭建服务器网站seo运营
  • 物联网服务平台西安百度快照优化
  • 做桂林网站的图片企业seo服务
  • 外卖网站建设方案书seo是什么意思网络用语
  • 设计公司vi设计西安百度首页优化
  • 手机之家app下载长沙优化网站
  • 日本做暧视频观看网站如何在百度推广网站
  • 携程网站建设的意义营销型网站有哪些功能
  • 云空间网站怎么做百度关键词排名突然消失了
  • 做家教一般在哪个网站站长之家官网登录入口
  • 做特效很牛的一个外国网站seo怎么刷关键词排名
  • 深圳专业做网站哪家好正规的教育机构有哪些
  • 效果好的网站建设旅游网络营销的渠道有哪些
  • 鼎诚网站建设企业邮箱怎么注册
  • 沧州北京网站建设百度手机助手下载安卓版
  • wordpress搭建小说站临沂seo代理商
  • 中江移动网站建设重庆seo网站建设
  • 做外贸哪些国外网站可以推广网络营销推广平台
  • 有域名了怎么建站知识搜索引擎
  • 如果制作一个自己的网站杭州网站推广优化
  • 廊坊网站设计公司企业网站开发多少钱