Fix all source Exception handling
This commit is contained in:
@@ -99,26 +99,29 @@ def main(number):
|
|||||||
web = get_html(result1)
|
web = get_html(result1)
|
||||||
soup = BeautifulSoup(web, 'lxml')
|
soup = BeautifulSoup(web, 'lxml')
|
||||||
info = str(soup.find(attrs={'class': 'row movie'}))
|
info = str(soup.find(attrs={'class': 'row movie'}))
|
||||||
dic = {
|
try:
|
||||||
'actor': getActor(web),
|
dic = {
|
||||||
'title': getTitle(web).strip(getNum(web)),
|
'actor': getActor(web),
|
||||||
'studio': getStudio(info),
|
'title': getTitle(web).strip(getNum(web)),
|
||||||
'outline': '',#
|
'studio': getStudio(info),
|
||||||
'runtime': getRuntime(info),
|
'outline': '', #
|
||||||
'director': '', #
|
'runtime': getRuntime(info),
|
||||||
'release': getRelease(info),
|
'director': '', #
|
||||||
'number': getNum(info),
|
'release': getRelease(info),
|
||||||
'cover': getCover(web),
|
'number': getNum(info),
|
||||||
'cover_small': getCover_small(a),
|
'cover': getCover(web),
|
||||||
'imagecut': 3,
|
'cover_small': getCover_small(a),
|
||||||
'tag': getTag(web),
|
'imagecut': 3,
|
||||||
'label': getLabel(info),
|
'tag': getTag(web),
|
||||||
'year': getYear(getRelease(info)), # str(re.search('\d{4}',getRelease(a)).group()),
|
'label': getLabel(info),
|
||||||
'actor_photo': getActorPhoto(web),
|
'year': getYear(getRelease(info)), # str(re.search('\d{4}',getRelease(a)).group()),
|
||||||
'website': result1,
|
'actor_photo': getActorPhoto(web),
|
||||||
'source': 'avsox.py',
|
'website': result1,
|
||||||
'series': getSeries(info),
|
'source': 'avsox.py',
|
||||||
}
|
'series': getSeries(info),
|
||||||
|
}
|
||||||
|
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
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ def main(number: str) -> json:
|
|||||||
**data,
|
**data,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
dic = {}
|
dic = {"title": ""}
|
||||||
|
|
||||||
return json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'))
|
return json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'))
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ def parse_info(soup: BeautifulSoup) -> dict:
|
|||||||
"series": get_series(data_dic),
|
"series": get_series(data_dic),
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
return {}
|
return {"title": ""}
|
||||||
|
|
||||||
|
|
||||||
def get_bold_text(h: str) -> str:
|
def get_bold_text(h: str) -> str:
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ def main(number: str):
|
|||||||
"series": '',
|
"series": '',
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
dic = {}
|
dic = {"title": ""}
|
||||||
|
|
||||||
return json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'))
|
return json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user