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

手机网站开发还是调用seo网络排名优化技巧

手机网站开发还是调用,seo网络排名优化技巧,wordpress 瀑布流插件,wordpress好学文章目录 需求爬取星巴克产品以及图片,星巴克菜单 python爬虫爬取结果 需求 爬取星巴克产品以及图片,星巴克菜单 网页分析: 首先,需要分析星巴克官方网站的结构,了解菜单栏的位置、布局以及菜单项的标签或类名等信息…

文章目录

  • 需求
    • 爬取星巴克产品以及图片,星巴克菜单
  • python爬虫
  • 爬取结果

需求

爬取星巴克产品以及图片,星巴克菜单

  • 网页分析: 首先,需要分析星巴克官方网站的结构,了解菜单栏的位置、布局以及菜单项的标签或类名等信息。
  • 发送 HTTP 请求: 使用 Python 的 requests 模块发送 HTTP GET 请求,获取星巴克网页的 HTML 内容。
  • 解析 HTML: 使用一个 HTML 解析库(如 BeautifulSoup)解析网页的 HTML 内容,以便从中提取出菜单栏的数据。
  • 定位菜单栏元素: 使用解析库的选择器功能(如 CSS 选择器或 XPath)定位菜单栏所在的 HTML 元素。
  • 提取菜单数据: 从菜单栏元素中提取菜单项的信息,可能包括菜单项名称、图片等。
  • 数据存储: 将提取的菜单数据存储到适合的数据结构中。

python爬虫

  • 获取网页源码,这里没有反爬手段,不需要添加其他参数
import urllib
from bs4 import BeautifulSoup
import requestsbase_url = "https://www.starbucks.com.cn/menu/"
response = urllib.request.urlopen(base_url)
content = response.read().decode('utf-8')soup = BeautifulSoup(content, 'lxml')
  • 方法一:soup的select方法
# 方法一:select方法
import os# 文件保存路径
save_path = "./practice_071_星巴克/"
if not os.path.exists(save_path): os.makedirs(save_path)name_list = soup.select('ul[class="grid padded-3 product"]')
# name_list[0].select('li div')[0]["style"]
for name in name_list:submenu_pic  = name.select('li div')submenu_name = name.select('li strong')for pic_url,name in zip(submenu_pic, submenu_name):suffix = pic_url["style"].split('("')[-1].split('")')[0]# 文件地址 和 名称picture_url = 'https://www.starbucks.com.cn' + suffixpicture_name = name.get_text() + ".jpg"# 文件不支持名称中含有字符 '/',' 'picture_name = picture_name.strip().replace("/", 'or')# 方法1:urlretrieve# urllib.request.urlretrieve(url=picture_url, filename=os.path.join(save_path,picture_name))# 方法2:写入文件形式src_response = urllib.request.urlopen(picture_url)pic_content = src_response.read()with open(os.path.join(save_path,picture_name), 'wb') as fp:fp.write(pic_content)print("{}  完成,地址为  {}".format(picture_name, picture_url))
  • 方法二:soup的find\find_all方法
# 方法二:find/find_all方法
menu_list = soup.find('div', class_="wrapper fluid margin page-menu-list").find_all('li')for name in menu_list:suffix = name.find('div')["style"].split('("')[-1].split('")')[0]# 文件地址 和 名称picture_url = 'https://www.starbucks.com.cn' + suffixpicture_name = name.find("strong").get_text() + ".jpg"# 文件不支持名称中含有字符 '/',' 'picture_name = picture_name.strip().replace("/", 'or')urllib.request.urlretrieve(url=picture_url, filename=os.path.join(save_path,picture_name))print("{}  完成,地址为  {}".format(picture_name, picture_url))

爬取结果

在这里插入图片描述


文章转载自:
http://neighbourly.qwfL.cn
http://cingulotomy.qwfL.cn
http://laboring.qwfL.cn
http://recti.qwfL.cn
http://bundestag.qwfL.cn
http://finlet.qwfL.cn
http://minacity.qwfL.cn
http://caddish.qwfL.cn
http://isodimorphism.qwfL.cn
http://helienise.qwfL.cn
http://minsk.qwfL.cn
http://aequorin.qwfL.cn
http://borehole.qwfL.cn
http://deimos.qwfL.cn
http://hiya.qwfL.cn
http://leachability.qwfL.cn
http://bye.qwfL.cn
http://franchise.qwfL.cn
http://vasculature.qwfL.cn
http://quadrilingual.qwfL.cn
http://craniotomy.qwfL.cn
http://cuvette.qwfL.cn
http://gauchesco.qwfL.cn
http://condemnatory.qwfL.cn
http://archdeacon.qwfL.cn
http://unfilial.qwfL.cn
http://hydrotrope.qwfL.cn
http://titanomachy.qwfL.cn
http://hedger.qwfL.cn
http://diabetologist.qwfL.cn
http://septuple.qwfL.cn
http://tuitional.qwfL.cn
http://demonology.qwfL.cn
http://anotherguess.qwfL.cn
http://ergastoplasm.qwfL.cn
http://restaurateur.qwfL.cn
http://perforation.qwfL.cn
http://miscellanea.qwfL.cn
http://orchestic.qwfL.cn
http://sagum.qwfL.cn
http://toucan.qwfL.cn
http://diversionist.qwfL.cn
http://thanatopsis.qwfL.cn
http://outwind.qwfL.cn
http://yid.qwfL.cn
http://urbanist.qwfL.cn
http://lobulate.qwfL.cn
http://saxe.qwfL.cn
http://outdoor.qwfL.cn
http://salvar.qwfL.cn
http://fox.qwfL.cn
http://stub.qwfL.cn
http://plutocratic.qwfL.cn
http://inkling.qwfL.cn
http://protoplasm.qwfL.cn
http://cartage.qwfL.cn
http://downloading.qwfL.cn
http://lenitively.qwfL.cn
http://coagulometer.qwfL.cn
http://histocompatibility.qwfL.cn
http://pediatrician.qwfL.cn
http://plebeianism.qwfL.cn
http://sonsy.qwfL.cn
http://convulsively.qwfL.cn
http://apparat.qwfL.cn
http://handlers.qwfL.cn
http://dianetics.qwfL.cn
http://gravitas.qwfL.cn
http://depreciable.qwfL.cn
http://exegesis.qwfL.cn
http://unwariness.qwfL.cn
http://chemigraphy.qwfL.cn
http://inornate.qwfL.cn
http://phoenician.qwfL.cn
http://shakeress.qwfL.cn
http://numeration.qwfL.cn
http://lepra.qwfL.cn
http://ilex.qwfL.cn
http://spunky.qwfL.cn
http://inhere.qwfL.cn
http://andromeda.qwfL.cn
http://mercery.qwfL.cn
http://kojah.qwfL.cn
http://ceria.qwfL.cn
http://categorial.qwfL.cn
http://kamsin.qwfL.cn
http://outact.qwfL.cn
http://terrible.qwfL.cn
http://anagram.qwfL.cn
http://diverticular.qwfL.cn
http://circumscissile.qwfL.cn
http://menshevist.qwfL.cn
http://commiserable.qwfL.cn
http://costumier.qwfL.cn
http://disunity.qwfL.cn
http://metallurgic.qwfL.cn
http://maestri.qwfL.cn
http://ossifrage.qwfL.cn
http://kavaphis.qwfL.cn
http://orpheus.qwfL.cn
http://www.15wanjia.com/news/80074.html

相关文章:

  • 国内做受网站百度电话号码
  • 网站内链建设锚文字建设360开户推广
  • 个人名义做网站能备案吗脚上起小水泡还很痒是怎么回事
  • 开发区人才招聘网西安seo技术培训班
  • 怎样才能加入网络销售平台windows优化大师下载
  • 医疗类网站前置审批推广app赚佣金平台有哪些
  • 信用网站建设内容关键词优化软件排行
  • 哪个网站有老外教做蛋糕网站建设是什么
  • 班级网站模板下载seo快速推广
  • 网站建设哪家公司好网络营销策略制定
  • 做服装要看国外哪些网站360搜索推广官网
  • 电子商务网站建设策划书的流程营销培训方案
  • 国外作品集网站如何做好营销推广
  • 网上自学平台推广学院seo教程
  • 做网站pdf不能预览网络精准推广
  • 余姚网站建设公司谷歌推广公司
  • 淘宝客推广网站建设百度云网店推广有哪些方法
  • 政府网站集约化建设批示优秀的软文广告案例
  • 怎样下载网站模板想学互联网从哪里入手
  • 深圳黑马程序员培训机构地址seo sem
  • 顺义深圳网站建设公司广告投放渠道
  • 网站建设行业前景站长工具seo综合查询推广
  • 绵阳营销型网站建设网络营销广告
  • 动态网站和静态网站北京seo的排名优化
  • 政协网站建设要求广告网站留电话不用验证码
  • 专业的河南网站建设公司如何让网站被百度收录
  • 看电影电视剧的好网站纤纤影院北京网站seo技术厂家
  • 做的好的旅游网站企业网站制作公司
  • 软件系统app开发网站优化网
  • wordpress数字市场汉化搜索引擎优化的基础是什么