fix criterion

This commit is contained in:
j 2011-02-23 11:12:37 +01:00
parent 2fed0f2b7d
commit 2132510a8c

View file

@ -68,17 +68,17 @@ def getData(id):
def getIds(): def getIds():
ids = [] ids = []
html = readUrlUnicode("http://www.criterion.com/library/dvd") html = readUrlUnicode("http://www.criterion.com/library/expanded_view?m=dvd&p=1&pp=50&s=spine")
results = re.compile("page=(.*?)\"").findall(html) results = re.compile("\&p=(\d+)\&").findall(html)
pages = int(results[len(results) - 2]) pages = max(map(int, results))
for page in range(pages, 0, -1): for page in range(1, pages):
for id in getIdsByPage(page): for id in getIdsByPage(page):
ids.append(id) ids.append(id)
return map(lambda id: str(id), sorted(map(lambda id: int(id), set(ids)))) return map(lambda id: str(id), sorted(map(lambda id: int(id), set(ids))))
def getIdsByPage(page): def getIdsByPage(page):
ids = [] ids = []
html = readUrlUnicode("http://www.criterion.com/library/dvd?page=%s" % page) html = readUrlUnicode("http://www.criterion.com/library/expanded_view?m=dvd&p=%s&pp=50&s=spine" % page)
results = re.compile("films/(\d+)").findall(html) results = re.compile("films/(\d+)").findall(html)
for result in results: for result in results:
ids.append(result) ids.append(result)