fix crash

This commit is contained in:
tianyu 2015-07-11 09:59:34 +08:00
parent 0c202b968f
commit ae00abcdb2
1 changed files with 10 additions and 7 deletions

View File

@ -54,17 +54,20 @@ for td, table in itertools.izip(td_list, table_list):
info_r = requests.get(info_url + str(u2torrent.id), cookies=cookies)
info_soup = BeautifulSoup(info_r.text)
try:
info_soup = BeautifulSoup(info_r.text)
info_name = info_soup.find("span", {'class': 'title'}, text="[name]").parent.find("span", {'class': 'value'})
u2torrent.folder = info_name.text
info_name = info_soup.find("span", {'class': 'title'}, text="[name]").parent.find("span", {'class': 'value'})
u2torrent.folder = info_name.text
u2torrent.name = u2torrent.title.split('][')[0].replace('[', '')
u2torrent.name = u2torrent.title.split('][')[0].replace('[', '')
print u2torrent.name + " : " + u2torrent.folder
print u2torrent.name + " : " + u2torrent.folder
torrents.append(json.JSONDecoder().decode(u2torrent.json()))
count += 1
torrents.append(json.JSONDecoder().decode(u2torrent.json()))
count += 1
except AttributeError:
print "Fetch folder name failed: " + u2torrent.title
time.sleep(3)
torrents_dict["count"] = count