eddyharrington / whatsoup Goto Github PK
View Code? Open in Web Editor NEWA web scraper that exports your entire WhatsApp chat history.
License: MIT License
A web scraper that exports your entire WhatsApp chat history.
License: MIT License
89.0.4389.82
Python 3.8.2
❯ python3 whatsoup.py
Success! WhatsApp finished loading and is ready.
Traceback (most recent call last):
File "whatsoup.py", line 1099, in <module>
main()
File "whatsoup.py", line 30, in main
chats = get_chats(driver)
File "whatsoup.py", line 212, in get_chats
last_chat_msg = last_chat_msg_element.find_element_by_tag_name(
File "/Users/xxx/opt/WhatSoup/env/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py", line 305, in find_element_by_tag_name
return self.find_element(by=By.TAG_NAME, value=name)
File "/Users/xxx/opt/WhatSoup/env/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py", line 658, in find_element
return self._execute(Command.FIND_CHILD_ELEMENT,
File "/Users/xxx/opt/WhatSoup/env/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "/Users/xxx/opt/WhatSoup/env/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/Users/xxx/opt/WhatSoup/env/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"span"}
(Session info: chrome=89.0.4389.82)
The script opens chrome and starts going through messages and crashes randomly at different messages.
Language is set to english
Although i have followed all the steps mentioned but still i am getting this error.
File "whatsoup.py", line 1104, in
main()
File "whatsoup.py", line 21, in main
driver = setup_selenium()
File "whatsoup.py", line 90, in setup_selenium
executable_path=DRIVER_PATH, options=options)
File "C:\Users\pk199\Desktop\final-project\Other\WhatsApp-Scrape\WhatSoup\env\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in init
self.service.start()
File "C:\Users\pk199\Desktop\final-project\Other\WhatsApp-Scrape\WhatSoup\env\lib\site-packages\selenium\webdriver\common\service.py", line 76,
in start
stdin=PIPE)
File "C:\Users\pk199\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 756, in init
restore_signals, start_new_session)
File "C:\Users\pk199\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1100, in _execute_child
args = list2cmdline(args)
File "C:\Users\pk199\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 511, in list2cmdline
needquote = (" " in arg) or ("\t" in arg) or not arg
TypeError: argument of type 'NoneType' is not iterable.
Hey, the selectors are changed a lot. I could just managed to update the xpath for Search button and Search box and it was running good until it did not able to find the aria label for message list.
Hope you will see it and take actions or help me to find the solution
Anyone that forked the project was able to solve the problems? My error says "executable_path has been deprecated, please pass in a Service object".
Hey there only one problem is that its doing all the thing but when i select csv or any format it creates the file but when i open the file i does not have any content please help me
Hi, can we save/export list chat live chat history?
the goal actualy to find unsaved contact from chat
Various exceptions are raised when WhatsApp settings are set to anything other than English because there are a few areas in WhatSoup that depend on English characters/words. The date/time formats for non-English settings are likely different as well and also need to be revised with a more flexible solution such as dateutil.
Set WhatsApp settings on the phone to use English as the language before running the script. It can be changed back after scraping/exporting a chat.
WhatSoup areas that depend on English language/locale:
Identifying search results
# Look for the unique class that holds 'Search results.'
WebDriverWait(driver, 5).until(expected_conditions.presence_of_element_located(
(By.XPATH, "//*[@id='pane-side']/div[1]/div/div[contains(@aria-label,'Search results.')]")))
Loading all messages
# Set focus to chat window (xpath == div element w/ aria-label set to 'Message list. Press right arrow key...')
message_list_element = driver.find_element_by_xpath(
"//*[@id='main']/div[3]/div/div/div[contains(@aria-label,'Message list')]")
Finding sender when a message does not contain text
# Last char in aria-label is always colon after the senders name
if span.get('aria-label') != 'Voice message':
return span.get('aria-label')[:-1]
Determining if vCard/VCF media is in a message
# Check if 'Message' is in the title (full title would be for example 'Message Bob Ross')
if 'Message' in button.get('title'):
# Next sibling should always be the 'Add to a group' button
if button.nextSibling:
if button.nextSibling.get('title') == 'Add to a group':
return True
I just copied the code, edited the Driver path and profile path. After that i tried to run it, but this error came out. Please help.
hello, i having a problem running it on Win
C:\Windows\system32>python C:\Users\Kanna\WhatSoup\whatsoup.py
[9512:4340:0227/163848.421:ERROR:upgrade_util_win.cc(73)] IProcessLauncher::LaunchCmdElevated failed; hr = 80004002
[9512:2152:0227/163848.451:ERROR:login_database.cc(654)] Password store database is too new, kCurrentVersionNumber=28, GetCompatibleVersionNumber=29
[9512:2152:0227/163848.451:ERROR:password_store_default.cc(39)] Could not create/open login database.
DevTools listening on ws://127.0.0.1:55297/devtools/browser/6e5e80ed-295c-4c29-85e4-45131568fd88
Success! WhatsApp finished loading and is ready.
Traceback (most recent call last):
File "C:\Users\Kanna\WhatSoup\whatsoup.py", line 1008, in
main()
File "C:\Users\Kanna\WhatSoup\whatsoup.py", line 29, in main
chats = get_chats(driver)
File "C:\Users\Kanna\WhatSoup\whatsoup.py", line 183, in get_chats
name_of_chat = selected_chat.find_element_by_class_name(
File "C:\Users\Kanna\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 398, in find_element_by_class_name
return self.find_element(by=By.CLASS_NAME, value=name)
File "C:\Users\Kanna\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 658, in find_element
return self._execute(Command.FIND_CHILD_ELEMENT,
File "C:\Users\Kanna\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Kanna\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Kanna\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"._3Tw1q"}
(Session info: chrome=87.0.4280.66)
It opens chrome and opens WhatsApp web, but it does nothing to the page itself
Hi, I was wondering if I could directly load a chat for desired user to scrape when I already know the name of person/group. I have a lot of old chats/groups etc and the scripts breakdown loading up the contacts mostly with exceptions
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"span"}
(Session info: chrome=90.0.4430.212)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.