Coder Social home page Coder Social logo

whatsoup's People

Contributors

eddyharrington avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

whatsoup's Issues

anyone that has a good fork?

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".

Unable to locate element: {"method":"css selector","selector":"._3Tw1q"}

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

Message: no such element: Unable to locate element: {"method":"css selector","selector":"span"}

  • I ran into this issue on Windows as well as osx
  • My chrome version is 89.0.4389.82
  • Python version : Python 3.8.2
  • Here is the trace:
❯ 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

Update Selectors

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

Start script with an input argument to scrape only desired chat without loading up all users

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)

Not scraping the text

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

Language/locale differences from en-US will raise an exception at various points

Issue

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.

Temporary workaround

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.

Issue details

WhatSoup areas that depend on English language/locale:

  1. Identifying 'Search results' element after searching for a specific chat
  2. Loading all messages in a selected chat, has an xpath containing 'Message list'
  3. Finding sender when a message does not contain text, has a condition for 'Voice message'
  4. Determining if vCard/VCF media is in a message, has conditions for 'Message' and 'Add to a group'
  5. Date/time string formatting all expects in the format of MM/DD/YYYY HH:MM AM/PM but there are variations such as YYYY-MM-DD, A.M. / P.M., etc.

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

export list chat

Hi, can we save/export list chat live chat history?

the goal actualy to find unsaved contact from chat

TypeError: argument of type 'NoneType' is not iterable

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.