fix import album
This commit is contained in:
parent
41e192f903
commit
dbab60c7dc
@ -141,7 +141,7 @@ class WPimport:
|
|||||||
|
|
||||||
def _getInfoAlbum(self, link):
|
def _getInfoAlbum(self, link):
|
||||||
if self._ssl_canalblog:
|
if self._ssl_canalblog:
|
||||||
link = link.replace("http", "https")
|
link = link.replace("http", "https").("httpss", "https")
|
||||||
self._logger.info("{0} : Info album : {1}".format(self._name, link))
|
self._logger.info("{0} : Info album : {1}".format(self._name, link))
|
||||||
link_o = urlparse(link)
|
link_o = urlparse(link)
|
||||||
if len(link_o.netloc) > 0:
|
if len(link_o.netloc) > 0:
|
||||||
@ -162,14 +162,16 @@ class WPimport:
|
|||||||
if os.path.exists("{0}/..{1}".format(self._directory, link_o)):
|
if os.path.exists("{0}/..{1}".format(self._directory, link_o)):
|
||||||
page_img = open("{0}/..{1}".format(self._directory, link_o), "r")
|
page_img = open("{0}/..{1}".format(self._directory, link_o), "r")
|
||||||
soup = BeautifulSoup(page_img, self._parser)
|
soup = BeautifulSoup(page_img, self._parser)
|
||||||
paragraph = soup.find("div", class_="albumbody").find("p")
|
paragraphs = soup.find("div", class_="albumbody").find_all("p")
|
||||||
self._logger.info("{0} get paragraph : {1}".format(self._name, paragraph))
|
for paragraph in paragraphs:
|
||||||
split_paragraph = str(paragraph).split("<br>")
|
self._logger.info("{0} get paragraph : {1}".format(self._name, paragraph))
|
||||||
self._logger.info("{0} length paragraph splitted : {1}".format(self._name, len(split_paragraph)))
|
split_paragraph = str(paragraph).split("<br>")
|
||||||
if len(split_paragraph) == 1:
|
self._logger.info("{0} length paragraph splitted : {1}".format(self._name, len(split_paragraph)))
|
||||||
split_paragraph = str(paragraph).split("<br/>")
|
if len(split_paragraph) == 1:
|
||||||
self._logger.info("{0} get paragraph splitted : {1}".format(self._name, split_paragraph))
|
split_paragraph = str(paragraph).split("<br/>")
|
||||||
author = split_paragraph[1].split(":")[1].replace(" ", "").lower()
|
self._logger.info("{0} get paragraph splitted : {1}".format(self._name, split_paragraph))
|
||||||
|
if len(split_paragraph) > 0:
|
||||||
|
author = split_paragraph[1].split(":")[1].replace(" ", "").lower()
|
||||||
return author
|
return author
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user