中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

模仿別人的網(wǎng)站東莞關(guān)鍵詞優(yōu)化平臺(tái)

模仿別人的網(wǎng)站,東莞關(guān)鍵詞優(yōu)化平臺(tái),想自己做微信網(wǎng)站的工作,做電商網(wǎng)站前端的技術(shù)選型是本項(xiàng)目純學(xué)習(xí)使用。 1 scrapy 代碼 爬取邏輯非常簡(jiǎn)單,根據(jù)url來處理翻頁,然后獲取到詳情頁面的鏈接,再去爬取詳情頁面的內(nèi)容即可,最終數(shù)據(jù)落地到excel中。 經(jīng)測(cè)試,總計(jì)獲取 11299條中醫(yī)藥材數(shù)據(jù)。 import pandas as…

本項(xiàng)目純學(xué)習(xí)使用。

1 scrapy 代碼

爬取邏輯非常簡(jiǎn)單,根據(jù)url來處理翻頁,然后獲取到詳情頁面的鏈接,再去爬取詳情頁面的內(nèi)容即可,最終數(shù)據(jù)落地到excel中。
經(jīng)測(cè)試,總計(jì)獲取 11299條中醫(yī)藥材數(shù)據(jù)。

import pandas as pd
import scrapyclass ZhongyaoSpider(scrapy.Spider):name = "zhongyao"start_urls = [f"https://www.zysj.com.cn/zhongyaocai/index__{i}.html" for i in range(1, 27)]def __init__(self, *args, **kwargs):self.data = []def parse(self, response):for li in response.css('div#list-content ul li'):a_tag = li.css('a')title = a_tag.css('::attr(title)').get()href = a_tag.css('::attr(href)').get()if title and href:# 構(gòu)建完整的詳情頁 URLdetail_url = response.urljoin(href)yield scrapy.Request(detail_url, callback=self.parse_detail, meta={'title': title})# 解析邏輯def parse_detail(self, response):title = response.meta['title']pinyin = response.css('div.item.pinyin_name_phonetic div.item-content::text').get(default='').strip()alias = response.css('div.item.alias div.item-content p::text').get(default='').strip()english_name = response.css('div.item.english_name div.item-content::text').get(default='').strip()source = response.css('div.item.alias div.item-content p::text').get(default='').strip()# 性味flavor = response.css('div.item.flavor div.item-content p::text').get(default='').strip()functional_indications = response.css('div.item.flavor div.item-content p::text').get(default='').strip()usage = response.css('div.item.usage div.item-content p::text').get(default='').strip()excerpt = response.css('div.item.excerpt div.item-content::text').get(default='').strip()#habitat = response.css('div.item.habitat div.item-content p::text').get(default='').strip()# 出處provenance = response.css('div.item.provenance div.item-content p::text').get(default='').strip()# 性狀shape_properties = response.css('div.item.shape_properties div.item-content p::text').get(default='').strip()# 歸經(jīng)attribution = response.css('div.item.attribution div.item-content p::text').get(default='').strip()#  原形態(tài)prototype = response.css('div.item.prototype div.item-content p::text').get(default='').strip()# 名家論述discuss = response.css('div.item.discuss div.item-content p::text').get(default='').strip()# 化學(xué)成分chemical_composition = response.css('div.item.chemical_composition div.item-content p::text').get(default='').strip()item = {'title': title,'pinyin': pinyin,'alias': alias,'source': source,'english_name': english_name,'habitat': habitat,'flavor': flavor,'functional_indications': functional_indications,'usage': usage,'excerpt': excerpt,'provenance': provenance,'shape_properties': shape_properties,'attribution':  attribution,'prototype': prototype,'discuss': discuss,'chemical_composition': chemical_composition,}self.data.append(item)yield itemdef closed(self, reason):# 當(dāng)爬蟲關(guān)閉時(shí),保存數(shù)據(jù)到 Excel 文件df = pd.DataFrame(self.data)df.to_excel('zhongyao_data.xlsx', index=False)

2 爬取截圖

在這里插入圖片描述

3 爬取數(shù)據(jù)截圖

在這里插入圖片描述

http://www.risenshineclean.com/news/5615.html

相關(guān)文章:

  • 專業(yè)網(wǎng)站建設(shè)咨詢seo優(yōu)化網(wǎng)站教程
  • 微信做網(wǎng)站支付工具廣州疫情最新消息今天封城了
  • 廈門北京網(wǎng)站建設(shè)公司seo專業(yè)知識(shí)培訓(xùn)
  • 網(wǎng)站建設(shè)推廣代運(yùn)營(yíng)運(yùn)營(yíng)培訓(xùn)
  • 快手秒刷自助網(wǎng)站seo推廣哪家好
  • 桂林山水網(wǎng)頁制作seo服務(wù)套餐
  • c 多語言網(wǎng)站怎么做中國(guó)進(jìn)入全國(guó)緊急狀態(tài)
  • 順德做營(yíng)銷網(wǎng)站公司百度關(guān)鍵詞排行榜
  • 長(zhǎng)沙網(wǎng)站建設(shè)工作室打開官方網(wǎng)站
  • 公眾號(hào)做淘寶客接入手機(jī)網(wǎng)站深圳網(wǎng)絡(luò)推廣最新招聘
  • 中國(guó)網(wǎng)站排名站長(zhǎng)之家玄幻小說排行榜百度風(fēng)云榜
  • 設(shè)備租賃網(wǎng)站建設(shè)搜索優(yōu)化引擎
  • 黃巖路橋網(wǎng)站設(shè)計(jì)google搜索中文入口
  • 免費(fèi)b站軟件推廣網(wǎng)站廣州優(yōu)化防控措施
  • 設(shè)計(jì)出色的網(wǎng)站杭州百家號(hào)優(yōu)化
  • 網(wǎng)站建設(shè)策目標(biāo)安卓?jī)?yōu)化大師全部版本
  • 如何選擇網(wǎng)站公司網(wǎng)絡(luò)銷售平臺(tái)有哪些
  • 重慶市建筑工程造價(jià)信息網(wǎng)優(yōu)化師是干嘛的
  • 紹興以往網(wǎng)站招工做宣傳推廣的形式有哪些
  • 外貿(mào)做獨(dú)立網(wǎng)站怎么樣蘇州seo網(wǎng)站優(yōu)化軟件
  • 制作視頻的軟件手機(jī)seo平臺(tái)是什么意思
  • 站長(zhǎng)網(wǎng)站統(tǒng)計(jì)市場(chǎng)營(yíng)銷實(shí)際案例
  • wordpress 注冊(cè)鏈接搜索引擎優(yōu)化的主要手段
  • 動(dòng)態(tài)網(wǎng)站開發(fā)語言企業(yè)網(wǎng)站設(shè)計(jì)規(guī)范
  • 網(wǎng)站推廣規(guī)劃百度問答入口
  • 網(wǎng)站流量怎么做的南京網(wǎng)站設(shè)計(jì)
  • 開發(fā)利用水資源安徽seo優(yōu)化
  • 網(wǎng)站分為四個(gè)步驟開發(fā)建設(shè)百度推廣費(fèi)用
  • 鄭州網(wǎng)站建設(shè)哪家公司便宜網(wǎng)絡(luò)營(yíng)銷運(yùn)營(yíng)推廣
  • 做趣味圖形的網(wǎng)站seo引擎搜索