fix WPImport from URL

This commit is contained in:
Valentin CZERYBA 2023-04-10 11:05:32 +02:00
parent e74dfc2b73
commit ed78f22f2e

View File

@ -15,9 +15,10 @@ class WPimport:
# Public method # Public method
def fromUrl(self, webpage): def fromUrl(self, webpage):
for page in webpage: for i in range(0, len(webpage)):
r = requests.get(page) r = requests.get(webpage[i])
if r.status_code == 200: if r.status_code == 200:
self._logger.info("({0}/{1} : Page en cours d'import : {2}".format(i+1, len(webpage), webpage[i]))
soup = BeautifulSoup(r.content, self._parser) soup = BeautifulSoup(r.content, self._parser)
articlebody = soup.find_all("div", class_="articlebody") articlebody = soup.find_all("div", class_="articlebody")
if len(articlebody) > 0: if len(articlebody) > 0: