On Feb 17, Sébastien Ragons <srag...@gmail.com> wrote:

> i try to create a new parser to get the picture of the movie in
> big format.

Hi!
This is a subject more suited for the imdbpy-devel mailing list;
anyway: see the reply to your other message.

> I wonder if you have to add a key to the dictionary of the movie
> to store the datas of the parser.

No, the keys are added by the parsers: the Movie class doesn't know
which keys it can/can't store (it knows about some aliases so that
the user can access some data using more "natural" names, but that's
all [1])

> For example how does work DOMHTMLKeywordsParser: It use keywords
> label but there is no key keywords.

Beware that the 'label' argument of the Extractor class is here only
to give a name to the Extractor instance (for debug purposes).
Once the extractor has selected a DOM subset of the HTML using the 'path'
argument, it extracts the attributes defined in the 'attrs' argument.

In this case, the result will be a dictionary where the 'keywords' key
will be a list ('multi is True') of values fetched using the 'path'
definition (_this_ path is applied to every DOM selected by the
'path' of the Extractor).

After that, every returned value is post-processed by 'postprocess'.

Keeping in mind that here I'm going with my memory, the output of
the parser should be something like:
  {'data': {'keywords': ['keyword1', 'keyword2', 'keyword3', ...]} }

The content of the 'data' key is then merged with the current
content of the Movie (or other object) instance we're working on.
This is done by the 'update' method of the imdb.IMDb class (this
class is the superclass of IMDbHTTPAccessSystem and other classes).


HTH,

+++
[1] in fact it also knows which keys can contain _textual_ references to
    other movies/persons/characters: it's internally used to nicely print
    these strings, but this is an advanced topic.
-- 
Davide Alberani <davide.alber...@gmail.com> [GPG KeyID: 0x465BFD47]
http://www.mimante.net/

------------------------------------------------------------------------------
Download Intel&reg; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs 
proactively, and fine-tune applications for parallel performance. 
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Imdbpy-help mailing list
Imdbpy-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-help

Reply via email to