def getLOMLifecycle(self, response: Response) -> items.LomLifecycleItemloader: lifecycle = LomBase.getLOMLifecycle(self, response) lifecycle.add_value("role", "author") lifecycle.add_value("organization", response.meta["item"]["snippet"]["channelTitle"]) lifecycle.add_value("url", self.getChannelUrl(response)) return lifecycle
def getLOMLifecycle(self, response: Response) -> items.LomLifecycleItemloader: lifecycle = LomBase.getLOMLifecycle(self, response) lifecycle.add_value("role", "author") lifecycle.add_value("firstName", self.static_values["author"]["first_name"]) lifecycle.add_value("lastName", self.static_values["author"]["last_name"]) lifecycle.add_value("url", self.url) return lifecycle
def getLOMLifecycle(self, response: Response) -> items.LomLifecycleItemloader: lifecycle = LomBase.getLOMLifecycle(self, response) name = response.meta["item"].xpath("@author").get().split(' ') lifecycle.add_value("role", "author") if len(name) == 2: lifecycle.add_value("firstName", name[0]) lifecycle.add_value("lastName", name[1]) else: lifecycle.add_value("organization", " ".join(name)) return lifecycle
def getLOMLifecycle(self, response): lifecycle = LomBase.getLOMLifecycle(self, response) for role in EduSharingConstants.LIFECYCLE_ROLES_MAPPING.keys(): entry = self.getProperty("ccm:lifecyclecontributer_" + role, response) if entry and entry[0]: # TODO: we currently only support one author per role vcard = vobject.readOne(entry[0]) if hasattr(vcard, "n"): given = vcard.n.value.given family = vcard.n.value.family lifecycle.add_value("role", role) lifecycle.add_value("firstName", given) lifecycle.add_value("lastName", family) return lifecycle
def getLOMLifecycle(self, response): response.selector.remove_namespaces() record = response.xpath('//OAI-PMH/GetRecord/record') role = record.xpath( 'metadata/lom/lifeCycle/contribute/role/value//text()' ).extract_first() lifecycle = LomBase.getLOMLifecycle(response) lifecycle.add_value('role', role) entity = record.xpath( 'metadata/lom/lifeCycle/contribute/entity//text()').extract_first( ) if entity: vcard = vobject.readOne(entity) given = vcard.n.value.given family = vcard.n.value.family lifecycle.add_value('firstName', given) lifecycle.add_value('lastName', family) return lifecycle
def getLOMLifecycle(self, response): response.selector.remove_namespaces() record = response.xpath("//OAI-PMH/GetRecord/record") role = record.xpath( "metadata/lom/lifeCycle/contribute/role/value//text()" ).extract_first() lifecycle = LomBase.getLOMLifecycle(response) entity = record.xpath( "metadata/lom/lifeCycle/contribute/entity//text()").extract_first( ) if entity: vcard = vobject.readOne(entity) if hasattr(vcard, "n"): given = vcard.n.value.given family = vcard.n.value.family lifecycle.add_value("role", role) lifecycle.add_value("firstName", given) lifecycle.add_value("lastName", family) return lifecycle