No two requests shall be the same!
This commit is contained in:
parent
0c9862d836
commit
eb727bd6c4
@ -10,7 +10,7 @@ class FourmiSpider(Spider):
|
|||||||
"""
|
"""
|
||||||
name = "FourmiSpider"
|
name = "FourmiSpider"
|
||||||
_sources = []
|
_sources = []
|
||||||
synonyms = []
|
synonyms = set()
|
||||||
|
|
||||||
def __init__(self, compound=None, selected_attributes=[".*"], *args, **kwargs):
|
def __init__(self, compound=None, selected_attributes=[".*"], *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
@ -19,7 +19,7 @@ class FourmiSpider(Spider):
|
|||||||
:param selected_attributes: A list of regular expressions that the attributes should match.
|
:param selected_attributes: A list of regular expressions that the attributes should match.
|
||||||
"""
|
"""
|
||||||
super(FourmiSpider, self).__init__(*args, **kwargs)
|
super(FourmiSpider, self).__init__(*args, **kwargs)
|
||||||
self.synonyms.append(compound)
|
self.synonyms.add(compound)
|
||||||
self.selected_attributes = selected_attributes
|
self.selected_attributes = selected_attributes
|
||||||
|
|
||||||
def parse(self, response):
|
def parse(self, response):
|
||||||
@ -42,6 +42,8 @@ class FourmiSpider(Spider):
|
|||||||
:return: A list of Scrapy Request objects
|
:return: A list of Scrapy Request objects
|
||||||
"""
|
"""
|
||||||
requests = []
|
requests = []
|
||||||
|
if compound not in self.synonyms:
|
||||||
|
self.synonyms.add(compound)
|
||||||
for parser in self._sources:
|
for parser in self._sources:
|
||||||
parser_requests = parser.new_compound_request(compound)
|
parser_requests = parser.new_compound_request(compound)
|
||||||
if parser_requests is not None:
|
if parser_requests is not None:
|
||||||
|
Reference in New Issue
Block a user