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

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

公司怎么制作網(wǎng)站免費(fèi)發(fā)帖推廣網(wǎng)站

公司怎么制作網(wǎng)站,免費(fèi)發(fā)帖推廣網(wǎng)站,網(wǎng)站如何配置域名,自建個(gè)人網(wǎng)站一.最終效果 二.項(xiàng)目代碼 2.1 新建項(xiàng)目 本文使用scrapy分布式、多線程爬蟲框架編寫的高性能爬蟲,因此新建、運(yùn)行scrapy項(xiàng)目3步驟: 1.新建項(xiàng)目: scrapy startproject weibo_hot 2.新建 spider: scrapy genspider hot_search "weibo.com" 3…

一.最終效果

二.項(xiàng)目代碼

2.1 新建項(xiàng)目

本文使用scrapy分布式、多線程爬蟲框架編寫的高性能爬蟲,因此新建、運(yùn)行scrapy項(xiàng)目3步驟:

1.新建項(xiàng)目:
scrapy startproject weibo_hot

2.新建 spider:
scrapy genspider hot_search "weibo.com"

3.運(yùn)行 spider:
scrapy crawl hot_search

注意:hot_search 是spider中的name

4.編寫item:

class WeiboHotItem(scrapy.Item):index = scrapy.Field()topic_flag = scrapy.Field()icon_desc_color = scrapy.Field()small_icon_desc = scrapy.Field()small_icon_desc_color = scrapy.Field()is_hot = scrapy.Field()is_gov = scrapy.Field()note = scrapy.Field()mid = scrapy.Field()url = scrapy.Field()flag = scrapy.Field()name = scrapy.Field()word = scrapy.Field()pos = scrapy.Field()icon_desc = scrapy.Field()

5.編寫爬蟲解析代碼:


import os
from itemadapter import ItemAdapter
from .settings import DATA_URI
from .Utils import Tooltool = Tool()class WeiboHotPipeline:def open_spider(self, spider):self.hot_line = "index,mid,word,label_name,raw_hot,category,onboard_time\n"data_dir = os.path.join(DATA_URI)file_path = data_dir + '/hot.csv'#判斷文件夾存放的位置是否存在,不存在則新建文件夾if os.path.isfile(file_path):self.data_file = open(file_path, 'a', encoding='utf-8')else:if not os.path.exists(data_dir):os.makedirs(data_dir)self.data_file = open(file_path, 'a', encoding='utf-8')self.data_file.write(self.hot_line)def close_spider(self, spider):  # 在關(guān)閉一個(gè)spider的時(shí)候自動(dòng)運(yùn)行self.data_file.close()def process_item(self, item, spider):try:hot_line = '{},{},{},{},{},{},{}\n'.format(item.get('index', ''),item.get('mid', ''),item.get('word', ''),item.get('label_name', ''),item.get('raw_hot', ''),tool.translate_chars(item.get('category', '')),tool.get_format_time(item.get('onboard_time', '')),)self.data_file.write(hot_line)except BaseException as e:print("hot錯(cuò)誤在這里>>>>>>>>>>>>>", e, "<<<<<<<<<<<<<錯(cuò)誤在這里")return item

三.注意事項(xiàng)

settings.py配置項(xiàng)修改


# Obey robots.txt rules
ROBOTSTXT_OBEY = False # 關(guān)閉,否則根據(jù)weibo的爬蟲策略爬蟲無(wú)法獲取數(shù)據(jù)

如果

四.運(yùn)行過(guò)程

五.項(xiàng)目說(shuō)明文檔

六.獲取完整源碼

愛(ài)學(xué)習(xí)的小伙伴,本次案例的完整源碼,已上傳微信公眾號(hào)“一個(gè)努力奔跑的snail”,后臺(tái)回復(fù) 熱搜榜 即可獲取。

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

相關(guān)文章:

  • 吉林省建設(shè)廳網(wǎng)站首頁(yè)域名??烤W(wǎng)頁(yè)推廣大全
  • 網(wǎng)站功能設(shè)計(jì)的內(nèi)容個(gè)人怎么注冊(cè)自己的網(wǎng)站
  • 無(wú)貨源電商平臺(tái)有哪些廈門站長(zhǎng)優(yōu)化工具
  • 廣告?zhèn)髅焦揪W(wǎng)站網(wǎng)站推廣策劃報(bào)告
  • html5網(wǎng)站開(kāi)發(fā)的源碼網(wǎng)絡(luò)顧問(wèn)
  • 西藏建設(shè)廳網(wǎng)站首頁(yè)seo科技網(wǎng)
  • 做視頻網(wǎng)站虛擬主機(jī)怎么選廣告聯(lián)盟接廣告
  • wordpress 采集圖片seo排名點(diǎn)擊首頁(yè)
  • 怎么用服務(wù)器搭建網(wǎng)站推廣之家app下載
  • 公司名稱注冊(cè)查詢系統(tǒng)seo營(yíng)銷工具
  • wordpress漂亮的主題網(wǎng)站seo優(yōu)化有哪些方面
  • 商丘做網(wǎng)站sqlongliqi市場(chǎng)營(yíng)銷四大基本策略
  • linux如何架設(shè)網(wǎng)站貴陽(yáng)網(wǎng)絡(luò)推廣排名
  • 微信小程序視頻網(wǎng)站開(kāi)發(fā)教程靜態(tài)網(wǎng)頁(yè)制作
  • 網(wǎng)站建設(shè)圖片怎么做免費(fèi)b站網(wǎng)頁(yè)推廣
  • 網(wǎng)站做數(shù)據(jù)分析的意義北京百度推廣投訴電話
  • 做網(wǎng)站營(yíng)業(yè)執(zhí)照經(jīng)營(yíng)范圍怎么填寫免費(fèi)seo排名軟件
  • 做公司網(wǎng)站用什么系統(tǒng)上海疫情最新數(shù)據(jù)
  • 淮安市哪里可以做網(wǎng)站開(kāi)魯視頻
  • wordpress頁(yè)面教程視頻小紅書搜索優(yōu)化
  • 商標(biāo) 做網(wǎng)站 是幾類站長(zhǎng)工具天美傳媒
  • 雅安交通建設(shè)集團(tuán)網(wǎng)站太原網(wǎng)絡(luò)推廣公司哪家好
  • 鄭州網(wǎng)站建設(shè)網(wǎng)站制作百度官網(wǎng)推廣平臺(tái)電話
  • 輕云服務(wù)器 多個(gè)網(wǎng)站今日頭條鄭州頭條新聞
  • 泉州網(wǎng)站制作專業(yè)產(chǎn)品怎么做市場(chǎng)推廣
  • 網(wǎng)站建設(shè)的常用詞搜收錄網(wǎng)
  • 動(dòng)態(tài)購(gòu)物網(wǎng)站開(kāi)發(fā)源代碼西地那非能提高硬度嗎
  • 做網(wǎng)站能拿多少錢淘寶指數(shù)查詢工具
  • 電信服務(wù)器做網(wǎng)站網(wǎng)絡(luò)整合營(yíng)銷理論案例
  • 織夢(mèng)響應(yīng)式茶葉網(wǎng)站流感用什么藥最好