debug level comment
This commit is contained in:
parent
0e15e88f31
commit
bd8ac241c1
@ -226,6 +226,7 @@ class WPimport:
|
|||||||
## Check class name
|
## Check class name
|
||||||
|
|
||||||
def _hasClassName(self, tag, className):
|
def _hasClassName(self, tag, className):
|
||||||
|
print(tag["class"])
|
||||||
for i in tag["class"]:
|
for i in tag["class"]:
|
||||||
if i == className:
|
if i == className:
|
||||||
return True
|
return True
|
||||||
@ -243,8 +244,8 @@ class WPimport:
|
|||||||
|
|
||||||
def _getComment(self, comment):
|
def _getComment(self, comment):
|
||||||
comment_post = []
|
comment_post = []
|
||||||
for i in comment:
|
for i in range(0, len(comment)):
|
||||||
comment_div = find_all("div", class_="comment_item")[0]
|
comment_div = comment[i].find("div", class_="comment_item")
|
||||||
comment_item = comment_div.text.split("\n")
|
comment_item = comment_div.text.split("\n")
|
||||||
footer = comment_div.find_all("div", class_="itemfooter")
|
footer = comment_div.find_all("div", class_="itemfooter")
|
||||||
comment_author = footer[0].text.split(",")[0].replace("Posté par ", "")
|
comment_author = footer[0].text.split(",")[0].replace("Posté par ", "")
|
||||||
@ -256,15 +257,17 @@ class WPimport:
|
|||||||
comment_content = comment_content + "</p>"
|
comment_content = comment_content + "</p>"
|
||||||
parent = -1
|
parent = -1
|
||||||
parent_class = "level-1"
|
parent_class = "level-1"
|
||||||
if self._hasClassName(i, parent_class) is False:
|
print(self._hasClassName(comment[i], parent_class))
|
||||||
|
if self._hasClassName(comment[i], parent_class) is False:
|
||||||
block = False
|
block = False
|
||||||
className = self._getClassName(tag, "level-").split("-")
|
className = self._getClassName(comment[i], "level-").split("-")
|
||||||
level = 1
|
level = 1
|
||||||
if len(className) > 0:
|
if len(className) > 0:
|
||||||
level = int(className[1])
|
level = int(className[1])
|
||||||
for j in range(i-1, 0):
|
for j in range(i-1, 0):
|
||||||
if block is False:
|
if block is False:
|
||||||
levelName = "level-{0}".format(level - 1)
|
levelName = "level-{0}".format(level - 1)
|
||||||
|
print(levelName)
|
||||||
if self._hasClassName(comment[j], levelName):
|
if self._hasClassName(comment[j], levelName):
|
||||||
parent = j
|
parent = j
|
||||||
parent_class = levelName
|
parent_class = levelName
|
||||||
@ -334,6 +337,7 @@ class WPimport:
|
|||||||
list_img.append(new_img)
|
list_img.append(new_img)
|
||||||
|
|
||||||
comment_post = self._getComment(comment)
|
comment_post = self._getComment(comment)
|
||||||
|
exit(0)
|
||||||
|
|
||||||
a = itemfooter[0].find_all("a", {"rel": True})
|
a = itemfooter[0].find_all("a", {"rel": True})
|
||||||
for i in a:
|
for i in a:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user