Added an basic parser class to extend, next step implementing the global function
This commit is contained in:
parent
d91706d6e5
commit
325febe834
@ -12,6 +12,8 @@ from scrapy.utils.project import get_project_settings
|
|||||||
|
|
||||||
|
|
||||||
def setup_crawler(searchable):
|
def setup_crawler(searchable):
|
||||||
|
# [TODO] - Initiate all parsers for the different websites and get
|
||||||
|
# allowed URLs.
|
||||||
spider = FourmiSpider(compound=searchable)
|
spider = FourmiSpider(compound=searchable)
|
||||||
settings = get_project_settings()
|
settings = get_project_settings()
|
||||||
crawler = Crawler(settings)
|
crawler = Crawler(settings)
|
||||||
|
@ -6,10 +6,11 @@ class FourmiSpider(Spider):
|
|||||||
|
|
||||||
def __init__(self, compound=None, *args, **kwargs):
|
def __init__(self, compound=None, *args, **kwargs):
|
||||||
super(FourmiSpider, self).__init__(*args, **kwargs)
|
super(FourmiSpider, self).__init__(*args, **kwargs)
|
||||||
# [TODO] - Initiate all parsers for the different websites and get
|
|
||||||
# allowed URLs.
|
|
||||||
|
|
||||||
def parse(self, reponse):
|
def parse(self, reponse):
|
||||||
# [TODO] - This function should delegate it's functionality to other
|
# [TODO] - This function should delegate it's functionality to other
|
||||||
# parsers.
|
# parsers.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def add_parser(self, parser):
|
||||||
|
self.parsers.add(parser)
|
||||||
|
Reference in New Issue
Block a user