Fix mgstage source error Exception handling
This commit is contained in:
@@ -114,6 +114,7 @@ def main(number2):
|
|||||||
a = str(soup.find(attrs={'class': 'detail_data'})).replace('\n ','').replace(' ','').replace('\n ','').replace('\n ','')
|
a = str(soup.find(attrs={'class': 'detail_data'})).replace('\n ','').replace(' ','').replace('\n ','').replace('\n ','')
|
||||||
b = str(soup.find(attrs={'id': 'introduction'})).replace('\n ','').replace(' ','').replace('\n ','').replace('\n ','')
|
b = str(soup.find(attrs={'id': 'introduction'})).replace('\n ','').replace(' ','').replace('\n ','').replace('\n ','')
|
||||||
#print(b)
|
#print(b)
|
||||||
|
try:
|
||||||
dic = {
|
dic = {
|
||||||
'title': getTitle(htmlcode).replace("\\n", '').replace(' ', ''),
|
'title': getTitle(htmlcode).replace("\\n", '').replace(' ', ''),
|
||||||
'studio': getStudio(a),
|
'studio': getStudio(a),
|
||||||
@@ -134,9 +135,11 @@ def main(number2):
|
|||||||
'source': 'mgstage.py',
|
'source': 'mgstage.py',
|
||||||
'series': getSeries(a),
|
'series': getSeries(a),
|
||||||
}
|
}
|
||||||
|
except:
|
||||||
|
dic = {"title": ""}
|
||||||
|
|
||||||
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
||||||
return js
|
return js
|
||||||
#print(htmlcode)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(main('SIRO-4149'))
|
print(main('SIRO-4149'))
|
||||||
|
|||||||
Reference in New Issue
Block a user