Coder Social home page Coder Social logo

jmgama / whatsapp-scraping Goto Github PK

View Code? Open in Web Editor NEW
108.0 15.0 66.0 47 KB

Python script to get WhatsApp iformation frrom WhatsApp Web

License: Apache License 2.0

Python 100.00%
whatsapp-web hacktoberfest selenium chrome firefox hacktoberfest2022 hacktoberfest-accepted hacktoberfest-accepted2022

whatsapp-scraping's Introduction

💬 WhatsApp-Scraping

Python script to get WhatsApp information from WhatsApp Web

Requirements

All the libraries that we are going to use are in the requirements.txt file. You can install it with PIP in the terminal with:

sudo pip install -r requirements.txt

In order to make this project work you need to have a profile in your browser where you already scanned the QR with your account then we are going to use that account for launching the Selenium driver.

Selenium

Selenium requires a driver to interface with the chosen browser. Firefox, for example, requires geckodriver, which needs to be installed before the below examples can be run. Make sure it’s in your PATH, e. g., place it in /usr/bin or /usr/local/bin.

Failure to observe this step will give you an error selenium.common.exceptions.WebDriverException: Message: ‘geckodriver’ executable needs to be in PATH.

Other supported browsers will have their own drivers available. Links to some of the more popular browser drivers follow.

For more information you can go to the Selenium Website at the installation section.

Chrome driver

Windows

For Windows we recommend that you download the Chrome driver and save it in your chrome directory (default path: C:\Program Files (x86)\Google\Chrome).

In the requirements.txt file you can set the path to the chrome driver DRIVER_PATH = C:\Program Files (x86)\Google\Chrome\chromedriver. With this configuration the script will know where to find the driver.

Settings

AT THIS MOMENT THE PROJECT ONLY WORKS WITH FIREFOX AND CHROME

Browser Profile FIREFOX_PATH

You need to setup your configuration in the settings.txt file. In this file you need to specify the profile of your browser where you already scan the QR whit your WhatsaApp account

For example we are using the default Firefox profile so we open Firefox and go to https://web.whatsapp.com/ then we scan our QR to login then we can close Firefox and go to search for our profile file that we have in /home/user/.mozilla/firefox/xxxxxxxx.default, now that we localized our file we add the direction to our settings.txt file in the FIREFOX_PATH

Browser Profile CHROME_PATH

For Chrome you can open Chrome browser, in the navigation bar you can go to chrome://version/ and copy the Profile path to set it in the settings.txt file in the BROWSER_PATH

whatsapp-scraping's People

Contributors

jmgama 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whatsapp-scraping's Issues

How to use it for windows?

i have downloaded your program but was unable to start it on windows 10
i am getting this error:
File "c:\Users\xxxxxxxxxxxxxxxxxx\Documents\Python\WhatsApp-Scraping-master\src\main.py", line 52, in
main()
File "c:\Users\xxxxxxxxxxxxxxxxxx\Documents\Python\WhatsApp-Scraping-master\src\main.py", line 34, in main
settings = load_settings()
File "c:\Users\xxxxxxxxxxxxxxxxxx\Documents\Python\WhatsApp-Scraping-master\src\main.py", line 15, in load_settings
browser = config_parser.get('config', 'BROWSER')
File "C:\Users\xxxxxxxxxxxxxxxxxx\AppData\Local\Programs\Python\Python39\lib\configparser.py", line 781, in get
d = self._unify_values(section, vars)
File "C:\Users\xxxxxxxxxxxxxxxxxx\AppData\Local\Programs\Python\Python39\lib\configparser.py", line 1149, in _unify_values
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'config'

iam also getting this error:
line 22, in init
self.driver.get(self.page)
AttributeError: 'NoneType' object has no attribute 'get'

Make a hierarchy file for the used components.

Context

Since the Whatsapp Web page is made with React, everytime they re-deploy, the class names changes and all the project fall apart. 💔

Requirement

A great idea from Naveen Prasanth was to make a file with the hierarchy of the components so we can make calibration and update the class names automatically when the application starts.

Example:

The left panel that has the chatters has the next hierarchy html/body/div/div/div/div/div/div/div/div/div/div

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.