diff options
author | Luo Jinghua <sunmoon1997@gmail.com> | 2010-11-16 09:11:44 +0800 |
---|---|---|
committer | Luo Jinghua <sunmoon1997@gmail.com> | 2010-11-16 09:11:44 +0800 |
commit | 1e18434c4a3536febd0b3beaabbb214f1128e7e3 (patch) | |
tree | 480fd9adc597fce332d8d3a16d69b556114a7834 | |
parent | c726428f151492ea4e535d9d48854e40b418f4f8 (diff) |
ppslist2: support movie searching
-rw-r--r-- | totem/plugin/ppslist2.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/totem/plugin/ppslist2.py b/totem/plugin/ppslist2.py index deef508..6961934 100644 --- a/totem/plugin/ppslist2.py +++ b/totem/plugin/ppslist2.py @@ -24,6 +24,7 @@ import BeautifulSoup GENERAS_URL = 'http://list1.ppstream.com/class/generas.xml.zip' SUB_URL = 'http://list1.pps.tv/class/%d.xml.zip' MOVIE_URL = 'http://list1.ppstv.com/schs/%d.xml.zip' +SEARCH_URL = 'http://listso.ppstream.com/search.php?acp=936&w=' CachePath = "/tmp/ppslist2" opener = urllib2.build_opener(urllib2cache.CacheHandler(CachePath)) @@ -479,7 +480,8 @@ def getMovieSubclassList(cls): return parseMovieSubclassList(cls, s) def parseMovieList(movie_id, s): - s = unpack_zip(s) + if s.find('xml') < 0: + s = unpack_zip(s) s = xmlgbk2utf8(s) dom = minidom.parseString(s) node = dom.getElementsByTagName('Chs') @@ -537,7 +539,11 @@ class PPSList: return s def searchMovieList(self, keyword, page_id = 0): - s = '' + try: + r = urllib2.urlopen(SEARCH_URL + urllib2.quote(keyword)) + except Exception, e: + return None + s = r.read() return s def parseMovieList(self, movie_class, s, page_id = 0): |