Dynamic web scraper specifically designed for AnsularJS websites that runs at specified time intervals and notifies you about specific updates on the site
Project description
😁 Welcome!!
Contents
- 😁 Welcome!!
- Contents
- 🌐 Dynamic Web Scraper
- 💡 Use case examples
- ✨ Features
- 📦 Installation
- 📲 Usage
- ✏ Manual Installation
- ❌ Common errors
- 👥 Contributing
🌐 Dynamic Web Scraper
💻 Windows and Linux compatible. 💻
This is a dynamic web scraper specifically designed for websites that have to wait for certain elements to load (such as AngularJS). It runs at specified time intervals. This can be used to monitor when a new element is added to the website instead of having to manually refresh it.
Instead of looking at the source, it waits until all elements are loaded to retrieve the results by using selenium and a Firefox driver.
Whenever a new element is discovered, it will notify you and save it to a file so that it doesn't notify you again for that same element in the future.
💡 Use case examples
This is useful, for example to notify you when a certain keyword is found on a website, such as:
- New job on a job board
- New product on an online store
- New article on a blog post
- ...
✨ Features
- Automated Scraping: Runs at user-defined intervals, extracting data without manual input.
- Notification System: Notifies users via Windows notifications when new data is found.
- Robust Parsing: Utilizes customizable search strings and regular expressions for data extraction.
📦 Installation
(Go below for manual installation.)
From PyPI
Requirements:
pip
# or recommended
pipx
pipx
is optional but recommended, you can use pip
instead.
pipx
:
pipx install dynamic-scraper
pip
:
pipx install dynamic-scraper
You can also clone the repository and install:
git clone https://github.com/P-ict0/Dynamic-Web-Scraper.git
cd Dynamic-Web-Scraper
python -m pip install .
📲 Usage
For help:
dynamic-scraper --help
General usage:
dynamic-scraper -u "https://www.example.com" -s "search this text"
Also see common errors if you encounter any issues with the browser.
Options
Option | Short Form | Requirement | Default | Description |
---|---|---|---|---|
--url |
-u |
Required | None | The URL of the webpage from which to fetch data. |
--search_string |
-s |
Required | None | The string you want to search for within the webpage. |
--regex |
-r |
Optional | search_string |
The regular expression pattern used to store the results nicely. |
--interval |
-i |
Optional | 5 |
The interval in minutes at which the script should run repeatedly. |
--json_path |
-j |
Optional | data/results.json |
The file path where the found results will be saved as JSON. |
--use-previous |
-p |
Optional | False |
Use results from previous runs, if present. |
--no-headless |
None | Optional | None | Disable headless mode for the webdriver and run maximized. |
--verbose |
-v |
Optional | WARNING |
Increase verbosity level (-v , -vv , etc.). INFO for -v , DEBUG for -vv . |
--quiet |
-q |
Optional | None | Suppress all notifications, only get output in the console. |
--locator-type |
-t |
Optional | xpath |
Type of locator to wait for the element to load. Options include various HTML attribute types. |
--locator-value |
-l |
Optional | //section[@class='list-item ng-scope'] |
Value of the locator to search for. |
✏ Manual Installation
git clone https://github.com/P-ict0/AngularJS-Dynamic-Web-Scraper.git
Recommended to use a virtual environment:
python3 -m venv venv
source venv/bin/activate # Linux
venv\Scripts\activate # Windows
pip install -r requirements.txt
You can now run:
python src/web_scraper/scraper.py [args]
❌ Common errors
You may also need to install the latest geckodriver from here and add it to your PATH.
👥 Contributing
Contributions are welcome! Please fork the repository and submit a pull request with your suggested changes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dynamic_scraper-0.4.1.tar.gz
.
File metadata
- Download URL: dynamic_scraper-0.4.1.tar.gz
- Upload date:
- Size: 47.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3bbc2070c9ffc4793f7331db201decdfdd75a173ba92724bce66706962c3d75 |
|
MD5 | 0c86d9f32e24501ea8ce58767de3755f |
|
BLAKE2b-256 | 902d7ff43719c35b27e8d0f20906bf5fbb3bf0eda2cf23a67395aefb3e64e0e5 |
File details
Details for the file dynamic_scraper-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: dynamic_scraper-0.4.1-py3-none-any.whl
- Upload date:
- Size: 36.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84e4ef20ce368e87973acc467a5387dc11b112f6d68c33b9f89bd935dda396f0 |
|
MD5 | 6a2be63450ccfe27666db267b2276704 |
|
BLAKE2b-256 | 8410195b59bff5ff5298021bd41769a3212bb90186e7cf6392dd38155a218542 |