Using the API

The API is an independient piece of code which you could use for your project or use interactively. For example

>>> from cuevanalib import cuevanaapi
>>> api = cuevanaapi.CuevanaAPI ()
>>> house = api.get_show ('house')
>>> house.plot
u'El doctor Gregory House, especialista en el tratamiento de enfermedades infecciosas, trabaja en un hospital universitario de Princetown, donde dirige una unidad especial encargada de pacientes afectados por dolencias extrañas y en la que colabora con un selecto grupo de aventajados ayudantes.'
>>> house7x1 = house.get_episode (7, 1)
>>> house7x1.title
'Now What?'
>>> house7x1.cast
['Hugh Laurie',
'Lisa Edelstein',
'Omar Epps',
'Jesse Spencer',
'Jennifer Morrison',
'Robert Sean Leonard',
'Olivia Wilde',
'Peter Jacobson']
>>> house7x1.sources
['http://www.megaupload.com/?d=DM58TA0J',
'http://www.filesonic.com/file/36841721/?',
'http://bitshare.com/?f=67z435xm',
'http://www.filefactory.com/file/caf85b9']
>>> house7x1.subs
{'ES': 'http://www.cuevana.tv/download_sub?file=s/sub/7888_ES.srt'}

API reference

A lib trying to work as Cuevana missing API

class cuevanalib.cuevanaapi.Content(url_or_cid, **kwargs)

A movie/episode base class.

cast
cid
director
duration
gender

Return sources in as a formatted string

get_pickle()

return a pickled representation with a hash appended

plot
producer
script
sources

Returns a list of links to the content

subs

A dictionary of urls to subtitles in .srt format with two letter uppercase code language as keys.

>>> print self.subs.keys()
    ('ES', 'EN')
title
url
year
class cuevanalib.cuevanaapi.CuevanaAPI(show_only=None)

Main class. The fun starts here

get_show(title, return_all=False)

Retrieve a show object by its title. If any show match title, returns None

return_all – if it’s False (default) returns the just most relevant
show match if it’s True, returns a list Show sorted by relevance
load_pickle(pickled)

Returns and object (Movie, Episode or Show), from a pickled string representation with checksum appended.

Use as the restore function of Content.get_pickle() and Show.get_pickle()

pickled – A pickled dumps with sha1 checksum appended

Returns:Movie, episode or Episode
Raises ::exc:ValueError – if hash not match
rss_movies()

Returns a list of last movies published, extrated from RSS feed

rss_series()

Returns a list of last show episodes published, extrated from RSS feed

search(q, cat='title')

Search content using cuevana’s search engine

q – the query string cat – type of search. Valid values are’title’ (default),

‘episode’, ‘actor’ or ‘director’
class cuevanalib.cuevanaapi.Episode(url_or_cid, **kwargs)

Show episode class

Should be instantiated via dispatch()

episode

Return the number of episode

filename(format='long', extension='srt')

Return a formatted string valid as filename to a renaming process

format could be ‘long’ or ‘short’

next

Return the next episode.

If it’s the last episode of the season returns the first one of the next season. If it’s the last episode available return None

pretty_title

return a the title and other info in a pretty way

New in version 0.2.

previous

Return the previous episode in the season

If it’s the first episode of a season returns the last one of the previous season. If it’s the first episode available return None

season

The season to which this episode belongs

Returns:int
show

Return the title of the show

show_object

return the Show() object to wich this episode belongs

thumbnail

return the url to a thumbnail of the box cover

class cuevanalib.cuevanaapi.Movie(url_or_cid, **kwargs)

Movie class.

Should be instanciated via dispatch()

filename(format='long', extension='srt')

return a string valid as filename to a renaming process

format could be ‘long’ or ‘short’

pretty_title

return a the title and other info in a pretty way

thumbnail

return the url to a thumbnail of the box cover

New in version 0.2.

exception cuevanalib.cuevanaapi.NotURLorCIDError
exception cuevanalib.cuevanaapi.NotValidSearchCategory
exception cuevanalib.cuevanaapi.NotValidURL
class cuevanalib.cuevanaapi.Show(url)

Show class

It’s a container of episodes.

cast

casting list, (in general) orderer by relevance

director

director/s list, (in general) orderer by relevance

gender
get_episode(season_or_both, episode=None)

Return one specific episode.

Valid parameter/s:

get_episode(‘s01e10’) get_episode(‘1x10’) get_episode(1, 10)

Deprecated since version 0.4: Use get_episodes() instead.

get_episodes(start, end='')

Return a list between both limits including them Example ‘s01e10’ - ‘s02e11’

If start has just one number, first episode is asummed If end has just number, last episode is asummed

New in version 0.4.

get_pickle()

return a pickled representation with a hash appendend

get_season(season)

Return a list of Episodes of the given season

Valid parameter:

get_season(‘s01’) get_season(‘temp1’) get_season(1)
plot

a short sinopsys of the show plot

producer
seasons

A list of episode lists [[ep1x1, ...], [ep2x1..], ..]

Deprecated since version 0.6: Use get_season() instead.

title

Title of the show

url

URL to this show. Sometimes this page is empty (a cuevana know bug)

exception cuevanalib.cuevanaapi.UnavailableError
cuevanalib.cuevanaapi.dispatch(url, **kwargs)

A dispatcher function that return the right object based on its URL

Optional keyword arguments: title and/or year

Table Of Contents

Previous topic

Introduction

This Page