woob.capabilities.gallery

class BaseGallery(_id, title=NotLoaded, url=NotLoaded, cardinality=NotLoaded, date=NotLoaded, rating=NotLoaded, rating_max=NotLoaded, thumbnail=NotLoaded, thumbnail_url=None, nsfw=False)[source]

Bases: BaseObject

Represents a gallery.

This object has to be inherited to specify how to calculate the URL of the gallery from its ID.

Variables:
  • url – (str) url

  • title – (str) Title of gallery

  • description – (str) Description of gallery

  • cardinality – (int) Cardinality of gallery

  • date – (date, datetime) Date of gallery

  • rating – (float) Rating of this gallery

  • rating_max – (float) Max rating available

  • thumbnail – (Thumbnail) Thumbnail

classmethod id2url(_id)[source]

Overloaded in child classes provided by backends.

property page_url

Get URL to page of this gallery.

iter_image()[source]

Iter images.

class BaseImage(_id='', index=None, thumbnail=NotLoaded, url=NotLoaded, ext=NotLoaded, gallery=None)[source]

Bases: BaseImage

Base class for images.

Variables:
  • url – (str) url

  • title – (str) File title

  • ext – (str) File extension

  • mime_type – (str) MIME Type

  • author – (str) File author

  • description – (str) File description

  • date – (date, datetime) File publication date

  • last_update – (date, datetime) Last update or last modified date (default: Not available)

  • size – (int) File size in bytes (default: Not available)

  • rating – (int, float) Rating (default: Not available)

  • rating_max – (int, float) Maximum rating (default: Not available)

  • license – (str) License name

  • nsfw – (bool) Is this Not Safe For Work (default: False)

  • thumbnail – (Thumbnail) Thumbnail of the image

  • data – (bytes) Data of image

  • index – (int) Usually page number

  • gallery – (BaseGallery) Reference to the Gallery object

class CapGallery[source]

Bases: Capability

This capability represents the ability for a website backend to provide videos.

SEARCH_RELEVANCE = 0
SEARCH_RATING = 1
SEARCH_VIEWS = 2
SEARCH_DATE = 3
search_galleries(pattern, sortby=SEARCH_RELEVANCE)[source]

Iter results of a search on a pattern.

Parameters:
  • pattern (str) – pattern to search on

  • sortby (SEARCH_*) – sort by… (default: SEARCH_RELEVANCE)

Return type:

BaseGallery

Get gallery from an ID.

Parameters:

_id (str) – the gallery id. It can be a numeric ID, or a page url, or so.

Return type:

Gallery

Iterate images from a Gallery.

Return type:

iter(BaseImage)