'Whatsoup a parsing python scrip

The problem is that it loads all the chats and then I give input to this by chat number and after that, it opens the chat and loads all the messages by scrolling up but the problem is that it doesn't paste the data when I give input for CSV, txt or HTML file it shows the file blank

Please see this

def scrape_chat(driver): '''Turns the chat into the soup and scrapes it for key export information: message sender, message date/time, message contents'''

print("Scraping messages...", end="\r")

# Make soup
soup = BeautifulSoup(driver.page_source, 'lxml')

# Get the 'Message list' element that is a container for all messages in the right chat pane
message_list = driver.find_element_by_xpath(
    '//*[@id="main"]/div[3]/div/div/div[2]').get_attribute('class')

# Search for and only keep HTML elements which contain actual messages
chat_messages = [
    msg for msg in soup.find("div", message_list).contents if 'message' in " ".join(msg.get('class'))]
chat_messages_count = len(chat_messages)

# Get users profile name
you = get_users_profile_name(chat_messages)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source