fix import album

This commit is contained in:
Valentin CZERYBA 2023-09-11 23:20:22 +02:00
parent 41e192f903
commit dbab60c7dc

View File

@ -141,7 +141,7 @@ class WPimport:
def _getInfoAlbum(self, link):
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))
link_o = urlparse(link)
if len(link_o.netloc) > 0:
@ -162,13 +162,15 @@ class WPimport:
if os.path.exists("{0}/..{1}".format(self._directory, link_o)):
page_img = open("{0}/..{1}".format(self._directory, link_o), "r")
soup = BeautifulSoup(page_img, self._parser)
paragraph = soup.find("div", class_="albumbody").find("p")
paragraphs = soup.find("div", class_="albumbody").find_all("p")
for paragraph in paragraphs:
self._logger.info("{0} get paragraph : {1}".format(self._name, paragraph))
split_paragraph = str(paragraph).split("<br>")
self._logger.info("{0} length paragraph splitted : {1}".format(self._name, len(split_paragraph)))
if len(split_paragraph) == 1:
split_paragraph = str(paragraph).split("<br/>")
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