add private method album
This commit is contained in:
parent
02f0c20bd0
commit
28b513e1b2
@ -54,6 +54,10 @@ class WPimport:
|
||||
articlebody = soup.find_all("div", class_="articlebody")
|
||||
if len(articlebody) > 0:
|
||||
self._addOrUpdatePost(soup)
|
||||
else:
|
||||
albumbody = soup.find_all("div", class_="albumbody")
|
||||
if len(albumbody) > 0:
|
||||
self._addOrUpdateAlbum(soup)
|
||||
else:
|
||||
self._addOrUpdateFeaturedMedia(soup)
|
||||
del webpage_content[first][second][i]
|
||||
@ -99,6 +103,10 @@ class WPimport:
|
||||
self._logger.debug("{0} : Number of article : {1}".format(self._name, len(articlebody)))
|
||||
if len(articlebody) > 0:
|
||||
self._addOrUpdatePost(soup)
|
||||
else:
|
||||
albumbody = soup.find_all("div", class_="albumbody")
|
||||
if len(albumbody) > 0:
|
||||
self._addOrUpdateAlbum(soup)
|
||||
else:
|
||||
self._addOrUpdateFeaturedMedia(soup)
|
||||
|
||||
@ -106,6 +114,9 @@ class WPimport:
|
||||
|
||||
# Private method
|
||||
|
||||
def _addOrUpdateAlbum(self, soup):
|
||||
self._logger.info("{0} : Add/Update Album".format(self._name))
|
||||
|
||||
def _fromFileTmp(self):
|
||||
try:
|
||||
with open("{0}/{1}.json".format(self._tmp, self._name)) as file:
|
||||
|
@ -86,8 +86,8 @@ class WPMenu:
|
||||
idMenu = {"id":0, "type":"", "link":""}
|
||||
soup = BeautifulSoup(content, self._parser)
|
||||
articletitle = soup.find("h2", class_="articletitle").get_text()
|
||||
if len(articletitle) > 0:
|
||||
articletitle = soup.find("h2").get_text()
|
||||
if len(articletitle) == 0:
|
||||
articletitle = soup.find("div", class_="albumbody").find("h2").get_text()
|
||||
exist = False
|
||||
for index in range(1,10):
|
||||
if exist is False:
|
||||
|
Loading…
x
Reference in New Issue
Block a user