Ejemplo n.º 1
0
def get_all_comment_in_all_en_posts_selected(
        driver, all_en_posts_selected, total_en_comment_each_en_posts,
        all_users_replied_en_comment_each_en_posts,
        all_content_en_comment_each_en_posts):
    for x in all_en_posts_selected:
        END(driver)
        check_post_appear = wait_find_id(driver, 10, x["id"])

        if check_post_appear:
            ele = driver.find_element_by_id(x["id"])
            print(ele.text)
            CLICK(driver, ele)

            if x["contain_comment"] != "0":
                END(driver)
                ele = driver.find_element_by_class_name("_4vn1")
                CLICK(driver, ele)

                open_all_tag_view(driver)
                open_all_tag_reply(driver)

                soup = get_soup(driver)
                tag_html_users = find_all(soup, "a", "class", "_6qw4")
                tag_html_replies = find_all(soup, "span", "class", "_3l3x")
                tag_html_users_replies = find_all(soup, "div", "class",
                                                  "_72vr")

                all_users_replied_recently_post = get_text_from_html(
                    tag_html_users)

                all_comments_replied_recently_post = get_text_from_html(
                    tag_html_replies)

                total_users_comments_on_recently_post = get_text_from_html(
                    tag_html_users_replies)

                all_en_comments_replied_recently_post = get_all_en_comments_replied_recently_post(
                    all_comments_replied_recently_post)

                total_en_users_comments_on_recently_post = get_total_en_users_comments_on_recently_post(
                    all_en_comments_replied_recently_post,
                    total_users_comments_on_recently_post)

                all_en_users_replied_recently_post = get_all_en_users_replied_recently_post(
                    total_en_users_comments_on_recently_post,
                    all_users_replied_recently_post)

                total_en_comment_each_en_posts.append(
                    len(all_en_comments_replied_recently_post))
                all_users_replied_en_comment_each_en_posts.append(
                    all_en_users_replied_recently_post)
                all_content_en_comment_each_en_posts.append(
                    all_en_comments_replied_recently_post)
                ESC(driver)

                END(driver)
            else:
                ESC(driver)

                END(driver)
Ejemplo n.º 2
0
def show_all_posts(driver):
    first_post = driver.find_elements_by_class_name("_6-e5")
    END(driver)
    last_post = driver.find_elements_by_class_name("_6-e5")

    while len(first_post) < len(last_post):
        first_post = driver.find_elements_by_class_name("_6-e5")
        END(driver)
        last_post = driver.find_elements_by_class_name("_6-e5")

    END(driver)
Ejemplo n.º 3
0
def open_all_tag_view(driver):
    while True:
        try:
            find_partial_link_text_click(driver, "View")
            END(driver)

        except Exception:
            pass
            break
Ejemplo n.º 4
0
def open_all_tag_reply(driver):
    while True:
        try:
            ele = driver.find_element_by_class_name("_4sxc _42ft")
            CLICK(driver, ele)
            END(driver)
        except Exception:
            pass
            break
Ejemplo n.º 5
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