Search for single compound, filename should be lowercase
This commit is contained in:
parent
a4dd6e1835
commit
ffb3861034
@ -8,12 +8,9 @@ class FourmiSpider(Spider):
|
||||
__parsers = []
|
||||
synonyms = []
|
||||
|
||||
def __init__(self, compounds=None, *args, **kwargs):
|
||||
def __init__(self, compound=None, *args, **kwargs):
|
||||
super(FourmiSpider, self).__init__(*args, **kwargs)
|
||||
if isinstance(compounds, list):
|
||||
self.synonyms.extend(compounds)
|
||||
else:
|
||||
self.synonyms.append(compounds)
|
||||
self.synonyms.append(compound)
|
||||
|
||||
def parse(self, reponse):
|
||||
for parser in self.__parsers:
|
||||
|
@ -3,8 +3,8 @@
|
||||
Fourmi, an webscraper build to search specific information for a given compound.
|
||||
|
||||
Usage:
|
||||
fourmi search <compound>...
|
||||
fourmi [options] search <compound>...
|
||||
fourmi search <compound>
|
||||
fourmi [options] search <compound>
|
||||
fourmi -h | --help
|
||||
fourmi --version
|
||||
|
||||
@ -44,8 +44,8 @@ def load_parsers(rel_dir="FourmiCrawler/parsers"):
|
||||
return parsers
|
||||
|
||||
|
||||
def setup_crawler(searchables):
|
||||
spider = FourmiSpider(compounds=searchables)
|
||||
def setup_crawler(searchable):
|
||||
spider = FourmiSpider(compound=searchable)
|
||||
spider.add_parsers(load_parsers())
|
||||
settings = get_project_settings()
|
||||
crawler = Crawler(settings)
|
Reference in New Issue
Block a user