예제 #1
0
 def getLOMEducational(self, response):
     educational = LomBase.getLOMEducational(self, response)
     educational.add_value(
         'description',
         HTMLParser().unescape(
             self.get('acf.short_text', json=response.meta['item'])))
     return educational
예제 #2
0
    def getLOMEducational(self, response):
        response.selector.remove_namespaces()
        record = response.xpath('//OAI-PMH/GetRecord/record')

        educational = LomBase.getLOMEducational(response)
        #TODO put in general description
        educational.add_value(
            'description',
            record.xpath('metadata/lom/general/description/string//text()').
            extract_first())
        tarString = record.xpath(
            'metadata/lom/educational/typicalAgeRange/string//text()'
        ).extract_first()
        if tarString:
            tar = LomAgeRangeItemLoader()
            tarSplitted = tarString.split('-')
            if len(tarSplitted) > 1:
                tar.add_value('fromRange', tarSplitted[0])
                tar.add_value('toRange', tarSplitted[1])
                educational.add_value('typicalAgeRange', tar.load_item())
            else:
                self.logger.info('unknown agerange %s', tarString)
        educational.add_value(
            'language',
            record.xpath(
                'metadata/lom/educational/language//text()').extract_first())
        return educational
예제 #3
0
 def getLOMEducational(self, response):
   educational = LomBase.getLOMEducational(self, response)
   desc = response.meta['item'].xpath('beschreibung//text()').get().strip()
   # dirty cleaning of invalid descriptions
   # not perfect yet, these objects also appear inside the content
   if not desc.startswith('swiffyobject_'):
     educational.add_value('description', HTMLParser().unescape(desc))
   return educational
예제 #4
0
 def getLOMEducational(self, response):
     educational = LomBase.getLOMEducational(self, response)
     description = response.meta['item'].xpath('description//text()').get()
     if not description:
         description = response.meta['item'].xpath(
             '//*[name()="summary"]//text()').get()
     educational.add_value('description', description)
     return educational
예제 #5
0
 def getLOMEducational(self, response):
     educational = LomBase.getLOMEducational(self, response)
     educational.add_value(
         'description',
         self.getLRMI('description', 'about', response=response))
     educational.add_value(
         'learningResourceType',
         self.getLRMI('learningResourceType', response=response))
     educational.add_value('typicalLearningTime',
                           self.getLRMI('timeRequired', response=response))
     return educational
 def getLOMEducational(self, response):
     educational = LomBase.getLOMEducational(self, response)
     tar_from = self.getProperty("ccm:educationaltypicalagerange_from",
                                 response)
     tar_to = self.getProperty("ccm:educationaltypicalagerange_to",
                               response)
     if tar_from and tar_to:
         range = LomAgeRangeItemLoader()
         range.add_value("from", tar_from)
         range.add_value("to", tar_to)
         educational.add_value("typicalAgeRange", range.load_item())
     return educational
예제 #7
0
    def getLOMEducational(self, response):
        educational = LomBase.getLOMEducational(self, response)

        educational.add_value(
            'description',
            response.xpath('/data/beschreibung/text()').get())

        bildungsebene = response.xpath('/data/bildungsebene/text()').get()
        if bildungsebene is not None:
            educational.add_value('intendedEndUserRole',
                                  bildungsebene.split(';'))

        return educational
예제 #8
0
 def getLOMEducational(self, response):
     educational = LomBase.getLOMEducational(self, response)
     description = '\n'.join(
         list(
             filter(
                 lambda x: x,
                 map(
                     lambda x: x.strip(),
                     response.xpath(
                         '//*[@id="ContentModuleApp"]//*[@content-module-type="inlinetext"]//p//text()'
                     ).getall())))).strip()
     educational.add_value('description', description)
     return educational
예제 #9
0
 def getLOMEducational(self, response):
     educational = LomBase.getLOMEducational(self, response)
     tar = LomAgeRangeItemLoader()
     response.meta["row"][CSVBase.COLUMN_TYPICAL_AGE_RANGE_TO]["text"]
     tar.add_value(
         "fromRange",
         response.meta["row"][CSVBase.COLUMN_TYPICAL_AGE_RANGE_FROM]
         ["text"],
     )
     tar.add_value(
         "toRange",
         response.meta["row"][CSVBase.COLUMN_TYPICAL_AGE_RANGE_TO]["text"])
     educational.add_value("typicalAgeRange", tar.load_item())
     return educational
예제 #10
0
  def getLOMEducational(self, response):
    educational = LomBase.getLOMEducational(self, response)
    if response.meta['item']['description'] != '':
      educational.add_value('description', response.meta['item']['description'])
    else:
      html = self.getUrlData(response.url)['html']
      data = Selector(text=html).xpath('//ul[contains(@class,"worksheet-pages")]//text()').getall()
      cutoff = 4
      if len(data)>cutoff:
        for i in range(cutoff):
          del data[0]

      text = ' '.join(data)
      text = text[:1000]
      educational.add_value('description', text)
    return educational
예제 #11
0
    def getLOMEducational(self, response):
        response.selector.remove_namespaces()
        record = response.xpath("//OAI-PMH/GetRecord/record")

        educational = LomBase.getLOMEducational(response)

        tarString = record.xpath(
            "metadata/lom/educational/typicalAgeRange/string//text()"
        ).extract_first()
        if tarString:
            tar = LomAgeRangeItemLoader()
            tarSplitted = tarString.split("-")
            if len(tarSplitted) > 1:
                tar.add_value("fromRange", tarSplitted[0])
                tar.add_value("toRange", tarSplitted[1])
                educational.add_value("typicalAgeRange", tar.load_item())
            else:
                self.logger.info("unknown agerange %s", tarString)
        educational.add_value(
            "language",
            record.xpath(
                "metadata/lom/educational/language//text()").extract_first(),
        )
        return educational
예제 #12
0
 def getLOMEducational(self, response):
   educational = LomBase.getLOMEducational(self, response)
   educational.add_value('description', self.get('description', response = response))
   return educational
예제 #13
0
 def getLOMEducational(self, response):
     educational = LomBase.getLOMEducational(self, response)
     educational.add_value(
         "typicalLearningTime", self.getLRMI("timeRequired", response=response)
     )
     return educational
 def getLOMEducational(self, response):
     educational = LomBase.getLOMEducational(self, response)
     # educational.add_value('typicalLearningTime', self.get('timeRequired'))
     return educational