Commit 76bf421a authored by sim's avatar sim

Delegate RIS parsing to RISParser

parent 238bf26d
...@@ -9,10 +9,8 @@ from scrapy.http import \ ...@@ -9,10 +9,8 @@ from scrapy.http import \
from scrapy import responsetypes as _responsetypes from scrapy import responsetypes as _responsetypes
from scrapy.responsetypes import ResponseTypes as BaseResponseTypes from scrapy.responsetypes import ResponseTypes as BaseResponseTypes
from gargantext.utils.json import json_loads from ..utils.json import json_loads
from ..parsers import RISParser
from RISparser.parser import Ris
from RISparser.config import TAG_KEY_MAPPING
logger = logging.getLogger('scrapers') logger = logging.getLogger('scrapers')
...@@ -80,14 +78,8 @@ class JsonResponse(ParseableResponse): ...@@ -80,14 +78,8 @@ class JsonResponse(ParseableResponse):
class RISResponse(ParseableResponse): class RISResponse(ParseableResponse):
class RIS(Ris):
PATTERN = '^[A-Z][A-Z0-9] -'
def __init__(self, lines):
super().__init__(lines, TAG_KEY_MAPPING)
def parse(self): def parse(self):
return self.RIS(self.readlines()).parse() return RISParser(self.readlines()).parse()
class ResponseTypes(BaseResponseTypes): class ResponseTypes(BaseResponseTypes):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment