sort subtitle parts
This commit is contained in:
parent
50e9f3e819
commit
afe518fc7d
1 changed files with 3 additions and 1 deletions
|
@ -69,10 +69,12 @@ def downloadSubtitleByID(opensubtitle_id):
|
||||||
data = read_url('http://www.opensubtitles.org/en/subtitles/%s' % opensubtitle_id)
|
data = read_url('http://www.opensubtitles.org/en/subtitles/%s' % opensubtitle_id)
|
||||||
soup = BeautifulSoup(data)
|
soup = BeautifulSoup(data)
|
||||||
srts = {}
|
srts = {}
|
||||||
|
c = 0
|
||||||
for a in soup('a', {'href': re.compile('download/file')}):
|
for a in soup('a', {'href': re.compile('download/file')}):
|
||||||
download_url = 'http://www.opensubtitles.org' + a['href']
|
download_url = 'http://www.opensubtitles.org' + a['href']
|
||||||
file_name = a.contents[-1].split('\n')[0].strip()
|
file_name = a.contents[-1].split('\n')[0].strip()
|
||||||
data = loadSrtUnicode(read_url(download_url))
|
data = loadSrtUnicode(read_url(download_url))
|
||||||
if data:
|
if data:
|
||||||
srts[file_name] = data
|
srts["%03d_%s" %(c, file_name)] = data
|
||||||
|
c += 1
|
||||||
return srts
|
return srts
|
||||||
|
|
Loading…
Reference in a new issue