Skip to content

Commit 048bcdb

Browse files
author
Xavier Grangier
committed
grangier#161 - add parser list variable
1 parent ced075f commit 048bcdb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

goose/configuration.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929

3030
HTTP_DEFAULT_TIMEOUT = 30
3131

32+
AVAILABLE_PARSERS = {
33+
'lxml' : Parser,
34+
'soupparser': ParserSoup,
35+
}
36+
3237

3338
class Configuration(object):
3439

@@ -84,6 +89,7 @@ def __init__(self):
8489
self.additional_data_extractor = None
8590

8691
# Parser type
92+
self.available_parsers = AVAILABLE_PARSERS.keys()
8793
self.parser_class = 'lxml'
8894

8995
# set the local storage path
@@ -94,7 +100,7 @@ def __init__(self):
94100
self.http_timeout = HTTP_DEFAULT_TIMEOUT
95101

96102
def get_parser(self):
97-
return Parser if self.parser_class == 'lxml' else ParserSoup
103+
return AVAILABLE_PARSERS[self.parser_class]
98104

99105
def get_publishdate_extractor(self):
100106
return self.extract_publishdate

0 commit comments

Comments
 (0)