insert #6

Merged
v4l3n71n merged 60 commits from insert into master 2023-04-11 21:29:54 +00:00
Showing only changes of commit 5768b37cd1 - Show all commits

View File

@ -15,14 +15,15 @@ class WPimport:
def fromFile(self, files):
for file in files.split(","):
with open(file, 'r') as f:
content = f.read()
soup = BeautifulSoup(content, 'html.parser')
articlebody = soup.find_all("div", class_="articlebody")
if len(articlebody) > 0:
self._addOrUpdatePost(soup)
else:
self._addOrUpdateFeaturedMedia(soup)
if os.path.exists(file):
with open(file, 'r') as f:
content = f.read()
soup = BeautifulSoup(content, 'html.parser')
articlebody = soup.find_all("div", class_="articlebody")
if len(articlebody) > 0:
self._addOrUpdatePost(soup)
else:
self._addOrUpdateFeaturedMedia(soup)
# Private method