Add html5lib to more BS4 calls, convert another place to BS4.

This commit is contained in:
Jim Miller
2015-10-22 18:16:30 -05:00
parent a5bc7bd757
commit b2238e10e7
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -57,7 +57,7 @@ def get_update_data(inputio,
if( relpath+item.getAttribute("href") == oldcoverhtmlhref ):
oldcoverhtmltype = item.getAttribute("media-type")
break
soup = bs.BeautifulSoup(oldcoverhtmldata.decode("utf-8"))
soup = bs.BeautifulSoup(oldcoverhtmldata.decode("utf-8"),"html5lib")
src = None
# first img or image tag.
imgs = soup.findAll('img')
@@ -208,7 +208,7 @@ def get_story_url_from_html(inputio,_is_good_url=None):
#print("---- item:%s"%item)
if( item.getAttribute("media-type") == "application/xhtml+xml" ):
filehref=relpath+item.getAttribute("href")
soup = bs.BeautifulSoup(epub.read(filehref).decode("utf-8"))
soup = bs.BeautifulSoup(epub.read(filehref).decode("utf-8"),"html5lib")
for link in soup.findAll('a',href=re.compile(r'^http.*')):
ahref=link['href']
#print("href:(%s)"%ahref)
+2 -2
View File
@@ -25,7 +25,7 @@ import urlparse
import logging
logger = logging.getLogger(__name__)
from BeautifulSoup import BeautifulSoup
from bs4 import BeautifulSoup
from gziphttp import GZipProcessor
import adapters
@@ -82,7 +82,7 @@ def get_urls_from_html(data,url=None,configuration=None,normalize=False,restrict
if not configuration:
configuration = Configuration("test1.com","EPUB")
soup = BeautifulSoup(data)
soup = BeautifulSoup(data,"html5lib")
if restrictsearch:
soup = soup.find(*restrictsearch)
#logger.debug("restrict search:%s"%soup)