mirror of
https://github.com/wassname/FanFicFare.git
synced 2026-09-09 11:14:08 +08:00
Add html5lib to more BS4 calls, convert another place to BS4.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user