class TestIndexItem(demiurge.Item): title = demiurge.TextField(selector='h1') items_following_link = demiurge.RelatedItem(TestItem, selector='a.link', attr='href') next_page = demiurge.RelatedItem('self', selector='a.next', attr='href') class Meta: base_url = 'http://localhost'
class Standings(demiurge.Item): rows = demiurge.RelatedItem(StandingsRow) class Meta: selector = 'div.posiciones table.table' encoding = 'utf-8' base_url = BASE_URL + 'posiciones.html'
class Relegation(demiurge.Item): rows = demiurge.RelatedItem(RelegationRow) class Meta: selector = 'div.descenso table.table' encoding = 'utf-8' base_url = BASE_URL + 'descenso.html'
class SteamCart(demiurge.Item): count = demiurge.TextField(selector='span#cart_item_count_value') subtotal = demiurge.TextField(selector='div#cart_price_total') balance = demiurge.TextField(selector='a#header_wallet_balance') cart_status_message = demiurge.TextField(selector='div.cart_status_message') cart_checkout_button = demiurge.AttributeValueField(selector='a.continue:eq(0)', attr='href') items = demiurge.RelatedItem(SteamCartItem, selector='div.cart_item_list')
class Round(demiurge.Item): _css_class = demiurge.AttributeValueField(attr='class') title = demiurge.TextField(selector='div.subHeader') matches = demiurge.RelatedItem(Match) class Meta: selector = 'div.fase div.fecha' encoding = 'utf-8' base_url = BASE_URL + 'fixture.html' @property def is_current(self): return 'show' in self._css_class
class GoogleShoppingItem (demiurge.Item): #url = demiurge.AttributeValueField (selector='td:eq(2) a:eq(1)', attr='href') #name = demiurge.TextField(selector='td:eq(2) a:eq(2)') #size = demiurge.TextField(selector='td:eq(3)') heading = demiurge.TextField(selector='.pslires h3') #'.pslmain h3') image = demiurge.AttributeValueField (selector='.pslires .psliimg img', attr='alt') link = demiurge.AttributeValueField (selector='.pslires h3 a', attr='href') price = demiurge.TextField(selector='.pslires div b:contains("$")') #'.pslline price') # best price, usually 30-40% lower than avg rows = demiurge.RelatedItem (ItemPriceDetailRow, selector=".pslires h3 a", attr="href") #main = demiurge.TextField(selector='.pslmain') class Meta: #selector = '.pslicont' #'table.maintable:gt(0) tr:gt(0)' selector = '.pslires' #'table.maintable:gt(0) tr:gt(0)' base_url = 'https://www.google.com' #'http://www.mininova.org'
class TestInnerItem(demiurge.Item): inner_items = demiurge.RelatedItem(TestItem) class Meta: base_url = 'http://localhost' selector = "div.section"
class SteamGiftInventory(demiurge.Item): gifts = demiurge.RelatedItem(SteamGift) class Meta: selector = 'div#tabcontent_pendinggifts'