Closed allphfa closed 6 years ago
It is recommended to get the URL option and the relevance between pages
Similar: A > B > C There may be only one download link in C, B stores the name information of C, A stores the classified information of B, and the information of a movie has different links, which is very troublesome. When A is captured, an associated ID is generated, passed to the B, and then B is passed to the C
class One(Item):
title = Css('.title')
async def save(self, info):
if hasattr(self,'title'):
if info == None:
info=dict()
info['title'] = self.title
return info # Return transfer information
else:
return None
class Two(Item):
videoType = Css('.videoType')
async def save(self, info):
if hasattr(self,'videoType'):
if info == None:
info=dict()
info['videoType'] = self.videoType
return info # Return transfer information
else:
return None
class videoSave(Item):
videoLink = Css('.videoLink')
async def save(self, info):
if hasattr(self,'videoLink'):
if info != None:
info['videoLink'] = self.videoLink
# save func
saveFunc(info)
return info
return None
selector.py
test.py (The importance of processing functions)