Ejemplo n.º 1
0
def get_total_comment_each_posts(soup, all_id_posts, all_tag_a_contain_total_comments_each_post):

    find_which_post_have_comments = []
    all_total_comments_each_post = []

    for x in all_tag_a_contain_total_comments_each_post:
        find_which_post_have_comments.append(
            get_text(x))

    i = 0
    for x in all_id_posts:

        html_post = find(soup, "div", "id", x)
        html_content_post = get_text(html_post)

        check_post_have_comments = html_content_post.find("Comment")

        if check_post_have_comments != -1:
            all_total_comments_each_post.append(
                find_which_post_have_comments[i])
            i += 1
        else:
            all_total_comments_each_post.append('0')

    return all_total_comments_each_post
Ejemplo n.º 2
0
def get_all_content_posts(driver, all_id_posts):
    HOME(driver)
    all_content_posts = []
    for x in all_id_posts:
        while True:
            try:
                ele = driver.find_element_by_id(x)
                CLICK(driver, ele)

                soup = get_soup(driver)
                content_post = find(
                    soup, "div", "class", "_5pbx userContent _3576")
                all_content_posts.append(get_text(content_post))

                ESC(driver)
                break
            except Exception:
                pass
                END(driver)
    return all_content_posts
Ejemplo n.º 3
0
def get_text_from_html(tag_html):
    arr = []
    for x in tag_html:
        arr.append(get_text(x))
    return arr