python使用scrapy解析js示例
from selenium import selenium
class MySpider(CrawlSpider):
name = 'cnbeta'
allowed_domains = ['cnbeta.com']
start_urls = ['http://www.dbjr.com.cn']
rules = (
# Extract links matching 'category.php' (but not matching 'subsection.php')
# and follow links from them (since no callback means follow=True by default).
Rule(SgmlLinkExtractor(allow=('/articles/.*\.htm', )),
callback='parse_page', follow=True),
# Extract links matching 'item.php' and parse them with the spider's method parse_item
)
def __init__(self):
CrawlSpider.__init__(self)
self.verificationErrors = []
self.selenium = selenium("localhost", 4444, "*firefox", "http://www.dbjr.com.cn")
self.selenium.start()
def __del__(self):
self.selenium.stop()
print self.verificationErrors
CrawlSpider.__del__(self)
def parse_page(self, response):
self.log('Hi, this is an item page! %s' % response.url)
sel = Selector(response)
from webproxy.items import WebproxyItem
sel = self.selenium
sel.open(response.url)
sel.wait_for_page_to_load("30000")
import time
time.sleep(2.5)
相關文章
python filecmp.dircmp實現(xiàn)遞歸比對兩個目錄的方法
這篇文章主要介紹了python filecmp.dircmp實現(xiàn)遞歸比對兩個目錄的方法,本文通過實例代碼給大家介紹的非常詳細,大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-05-05關于 Python opencv 使用中的 ValueError: too many values to unpack
這篇文章主要介紹了關于 Python opencv 使用中的 ValueError: too many values to unpack,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2019-06-06python實現(xiàn)發(fā)送帶附件的郵件代碼分享
在本篇文章里小編給大家整理的是關于python實現(xiàn)發(fā)送帶附件的郵件代碼分享內容,需要的朋友們可以參考下。2020-09-09python讀取excel表格生成erlang數(shù)據(jù)
這篇文章主要為大家詳細介紹了python讀取excel表格生成erlang數(shù)據(jù),具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-08-08淺談Python實現(xiàn)opencv之圖片色素的數(shù)值運算和邏輯運算
今天帶大家來學習的是關于Python的相關知識,文章圍繞著圖片色素的數(shù)值運算和邏輯運算展開,文中有非常詳細的的介紹及代碼示例,需要的朋友可以參考下2021-06-06python使用paramiko模塊通過ssh2協(xié)議對交換機進行配置的方法
今天小編就為大家分享一篇python使用paramiko模塊通過ssh2協(xié)議對交換機進行配置的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-07-07