Re: [Imdbpy-help] Searching for movies <= '21' return empty list

2012-09-09 Thread Davide Alberani
On Sun, Sep 9, 2012 at 12:59 PM, Cody Fuller  wrote:
>
 ia.search_movie('21')
> []
 ia.search_movie('22')
> [,  id:0134847[ht
> tp] title:_Pitch Black (2000)_>,  Death
>
> Am I using this incorrectly or is this a bug?

It seems to be a bug related to handling of queries that return too much
results.
Adding loggingLevel='debug' to the arguments of imdb.IMDb(), you get
the following:
2012-09-09 16:15:32,677 DEBUG [imdbpy]
/home/da/hg/imdbpy/imdbpy/imdb/_logging.py:45: set logging threshold
to "DEBUG"
2012-09-09 16:15:32,722 DEBUG [imdbpy.parser.http]
/home/da/hg/imdbpy/imdbpy/imdb/parser/http/__init__.py:442: fetching
url http://akas.imdb.com/find?q=21&s=tt&mx=20 (size: -1)
2012-09-09 16:15:34,247 DEBUG [imdbpy.parser.http]
/home/da/hg/imdbpy/imdbpy/imdb/parser/http/__init__.py:442: fetching
url http://akas.imdb.com/find?q=21&ls=tt&lm=0 (size: 141312)
[]

Meaning that it does the "normal" query (q=21&s=tt&mx=20) but in the result page
the "Your search returned more than" string is found, meaning that the query was
too generic (at least some time ago, no results were shown at all, in
this page).
So, IMDbPY tries again with q=21&ls=tt&lm=0 limiting the data received on the
connection (using the Range http header to avoid the download of a
multi-megabytes
page, just to show the first X results).
Now... why parsing the fetched page results in an empty list?

Increasing the fetched bytes seems to fix it *sometimes*... I guess it
has something
to do with the truncated html that we get, but so far I was unable to
fix it adding tags
to make i better...

Hmmm... ideas? :-P
Maybe we can just use the results of the first fetched page, if it always
have results in it, now...

-- 
Davide Alberani   [PGP KeyID: 0x465BFD47]
http://www.mimante.net/

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Imdbpy-help mailing list
Imdbpy-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-help


[Imdbpy-help] Searching for movies <= '21' return empty list

2012-09-09 Thread Cody Fuller
Example:

>>> import imdb
>>> ia = imdb.IMDb()
>>> ia.search_movie('21')
[]
>>> ia.search_movie('22')
[, , --
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Imdbpy-help mailing list
Imdbpy-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-help