ben.cz scrapper

This module is used to download last 100 books published by ben.cz.

harvester.scrappers.ben_cz.URL = 'http://shop.ben.cz/Produkty.aspx?lang=cz&nak=BEN+-+technick%u00e1+literatura'

Base url of the eshop.

harvester.scrappers.ben_cz._get_last_td(el)[source]

Return last <td> found in el DOM.

Parameters:el (obj) – dhtmlparser.HTMLElement instance.
Returns:obj – HTMLElement instance if found, or None if there are no <td> tags.
harvester.scrappers.ben_cz._get_td_or_none(details, ID)[source]

Get <tr> tag with given ID and return content of the last <td> tag from <tr> root.

Parameters:
  • details (obj) – dhtmlparser.HTMLElement instance.
  • ID (str) – id property of the <tr> tag.
Returns:

str – Content of the last <td> as strign.

harvester.scrappers.ben_cz._parse_title(dom, details)[source]

Parse title/name of the book.

Parameters:
  • dom (obj) – HTMLElement containing whole HTML page.
  • details (obj) – HTMLElement containing slice of the page with details.
Returns:

str – Book’s title.

Raises:

AssertionError – If title not found.

harvester.scrappers.ben_cz._parse_authors(details)[source]

Parse authors of the book.

Parameters:details (obj) – HTMLElement containing slice of the page with details.
Returns:list – List of structures.Author objects. Blank if no author found.
harvester.scrappers.ben_cz._parse_publisher(details)[source]

Parse publisher of the book.

Parameters:details (obj) – HTMLElement containing slice of the page with details.
Returns:str/None – Publisher’s name as string or None if not found.
harvester.scrappers.ben_cz._parse_price(details)[source]

Parse price of the book.

Parameters:details (obj) – HTMLElement containing slice of the page with details.
Returns:str/None – Price as string with currency or None if not found.
harvester.scrappers.ben_cz._parse_pages_binding(details)[source]

Parse number of pages and binding of the book.

Parameters:details (obj) – HTMLElement containing slice of the page with details.
Returns:(pages, binding) – Tuple with two string or two None.
harvester.scrappers.ben_cz._parse_ISBN_EAN(details)[source]

Parse ISBN and EAN.

Parameters:details (obj) – HTMLElement containing slice of the page with details.
Returns:(ISBN, EAN) – Tuple with two string or two None.
harvester.scrappers.ben_cz._parse_edition(details)[source]

Parse edition (vydání) of the book.

Parameters:details (obj) – HTMLElement containing slice of the page with details.
Returns:str/None – Edition as string with currency or None if not found.
harvester.scrappers.ben_cz._parse_description(details)[source]

Parse description of the book.

Parameters:details (obj) – HTMLElement containing slice of the page with details.
Returns:str/None – Details as string with currency or None if not found.
harvester.scrappers.ben_cz._process_book(book_url)[source]

Parse available informations about book from the book details page.

Parameters:book_url (str) – Absolute URL of the book.
Returns:objstructures.Publication instance with book details.
harvester.scrappers.ben_cz.get_publications()[source]

Get list of publication offered by ben.cz.

Returns:list – List of structures.Publication objects.
harvester.scrappers.ben_cz.self_test()[source]

Perform basic selftest.

Returns:True – When everything is ok.
Raises:AssertionError – When there is some problem.

Previous topic

edeposit_harvester_test.py

Next topic

cpress.cz scrapper

This Page