forked from openlp/openlp
Fix BibleGateway code
Make BibleServer code more robust bzr-revno: 1212
This commit is contained in:
commit
658645cfc9
@ -208,7 +208,8 @@ class BGExtract(object):
|
|||||||
u'version': u'%s' % version})
|
u'version': u'%s' % version})
|
||||||
cleaner = [(re.compile(' |<br />|\'\+\''), lambda match: '')]
|
cleaner = [(re.compile(' |<br />|\'\+\''), lambda match: '')]
|
||||||
soup = get_soup_for_bible_ref(
|
soup = get_soup_for_bible_ref(
|
||||||
u'http://www.biblegateway.com/passage/?%s' % url_params, cleaner)
|
u'http://www.biblegateway.com/passage/?%s' % url_params,
|
||||||
|
cleaner=cleaner)
|
||||||
if not soup:
|
if not soup:
|
||||||
return None
|
return None
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
@ -269,11 +270,12 @@ class BSExtract(object):
|
|||||||
if not soup:
|
if not soup:
|
||||||
return None
|
return None
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
content = soup.find(u'div', u'content').find(u'div').findAll(u'div')
|
content = soup.find(u'div', u'content')
|
||||||
if not content:
|
if not content:
|
||||||
log.exception(u'No verses found in the Bibleserver response.')
|
log.exception(u'No verses found in the Bibleserver response.')
|
||||||
send_error_message(u'parse')
|
send_error_message(u'parse')
|
||||||
return None
|
return None
|
||||||
|
content = content.find(u'div').findAll(u'div')
|
||||||
verse_number = re.compile(r'v(\d{1,2})(\d{3})(\d{3}) verse')
|
verse_number = re.compile(r'v(\d{1,2})(\d{3})(\d{3}) verse')
|
||||||
verses = {}
|
verses = {}
|
||||||
for verse in content:
|
for verse in content:
|
||||||
|
Loading…
Reference in New Issue
Block a user