Skip to content

Instantly share code, notes, and snippets.

@matiasb
Created September 8, 2014 13:49
Show Gist options
  • Save matiasb/af71fcaf08ba8962e31a to your computer and use it in GitHub Desktop.
Save matiasb/af71fcaf08ba8962e31a to your computer and use it in GitHub Desktop.
UNC digesto via demiurge
from demiurge import Item, TextField, AttributeValueField, RelatedItem
class Documento(Item):
area = TextField(selector="#breadcrumbs-2 a")
tipo = TextField(selector="#parent-fieldname-kind")
titulo = TextField(selector="#parent-fieldname-title")
numero = TextField(selector='#parent-fieldname-number')
descripcion = TextField(selector="#parent-fieldname-description")
pdf = AttributeValueField(selector="#archetypes-fieldname-file span a", attr='href')
emisor = TextField(selector="span#parent-fieldname-kind")
fecha = TextField(selector="#parent-fieldname-date")
expedientes = TextField(selector="#archetypes-fieldname-dossierNumber span:gt(0)")
class Meta:
selector = '#portal-column-content'
class IndexEntry(Item):
titulo = TextField(selector='a.url')
detalle = RelatedItem(Documento, selector='a.url', attr='href')
class Meta:
selector = 'span.summary'
class Index(Item):
documentos = RelatedItem(IndexEntry, selector='div#content-core')
class Meta:
base_url = 'http://www.digesto.unc.edu.ar/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment