diff --git a/scrapeit/opensubtitles.py b/scrapeit/opensubtitles.py index 7efc74e..0c8bfce 100644 --- a/scrapeit/opensubtitles.py +++ b/scrapeit/opensubtitles.py @@ -69,10 +69,12 @@ def downloadSubtitleByID(opensubtitle_id): data = read_url('http://www.opensubtitles.org/en/subtitles/%s' % opensubtitle_id) soup = BeautifulSoup(data) srts = {} + c = 0 for a in soup('a', {'href': re.compile('download/file')}): download_url = 'http://www.opensubtitles.org' + a['href'] file_name = a.contents[-1].split('\n')[0].strip() data = loadSrtUnicode(read_url(download_url)) if data: - srts[file_name] = data + srts["%03d_%s" %(c, file_name)] = data + c += 1 return srts