Name | imgscraper JSON |
Version |
0.3.0
JSON |
| download |
home_page | None |
Summary | Scans web pages for images |
upload_time | 2025-01-22 19:43:12 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | MIT License
Copyright (c) 2023 Dawid Szaniawski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. |
keywords |
api
automation
json
web
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[![Tests](https://github.com/dawid-szaniawski/imgscraper/actions/workflows/tox.yml/badge.svg)](https://github.com/dawid-szaniawski/imgscraper/actions/workflows/tox.yml)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/imgscraper)](https://pypi.org/project/imgscraper/)
[![PyPI](https://img.shields.io/pypi/v/imgscraper)](https://pypi.org/project/imgscraper/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/dawid-szaniawski/imgscraper/blob/master/LICENSE)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![codecov](https://codecov.io/github/dawid-szaniawski/imgscraper/branch/master/graph/badge.svg?token=hY7Nb5jGgi)](https://codecov.io/github/dawid-szaniawski/imgscraper)
[![CodeFactor](https://www.codefactor.io/repository/github/dawid-szaniawski/imgscraper/badge)](https://www.codefactor.io/repository/github/dawid-szaniawski/imgscraper)
# imgscraper: yet another web scraper
imgscraper is a simple library that allows you to retrieve image information from meme sites.
## Installation
To install _imgscraper_, you can use pip:
```bash
pip install imgscraper
```
_ImgScraper_ supports Python 3.10+
## Usage
```python
from imgscraper.scraper_constructor import create_scraper
img_scraper = create_scraper(
website_url="https://imagocms.webludus.pl/",
container_class="image-holder",
pagination_class="pagination"
)
img_scraper.start_sync()
print(img_scraper.synchronization_data)
```
Output:
```python
[
Image(
source="https://imagocms.webludus.pl/images/01/",
url_address="https://imagocms.webludus.pl/img/01.jpg",
title="String"
),
Image(
source="https://imagocms.webludus.pl/images/02/",
url_address="https://imagocms.webludus.pl/img/02.jpg",
title="String"
)
]
```
## Pages to scan and scraper
The user can specify how many subpages should be scraped and what tool the application should use.
```python
from imgscraper.scraper_constructor import create_scraper
img_scraper = create_scraper(
website_url="https://imagocms.webludus.pl/",
container_class="image-holder",
pagination_class="pagination",
pages_to_scan=1,
scraper="bs4"
)
```
## Last sync data
When starting the synchronization process, the user can provide data from the last synchronization (img.src).
If the application encounters a provided image, the process is terminated. All previously synced images are available.
```python
scraper.start_sync(
(
"https://imagocms.webludus.pl/img/01.jpg",
"https://imagocms.webludus.pl/img/02.jpg",
)
)
```
## Image Object
The Image object provides the ``.as_dict()`` method to turn it into a dictionary.
```python
img = Image(
source="https://imagocms.webludus.pl/images/01/",
url_address="https://imagocms.webludus.pl/img/01.jpg",
title="String"
).as_dict()
```
Output:
```python
img = {
"source": "https://imagocms.webludus.pl/images/01/",
"url_address": "https://imagocms.webludus.pl/img/01.jpg",
"title": "String"
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "imgscraper",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "api, automation, json, web",
"author": null,
"author_email": "Dawid Szaniawski <webluduspl@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c8/9e/4f2796000510e0198015ccbb24ff6c901d4abab1e6a04c3e274a77f1c76d/imgscraper-0.3.0.tar.gz",
"platform": null,
"description": "[![Tests](https://github.com/dawid-szaniawski/imgscraper/actions/workflows/tox.yml/badge.svg)](https://github.com/dawid-szaniawski/imgscraper/actions/workflows/tox.yml)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/imgscraper)](https://pypi.org/project/imgscraper/)\n[![PyPI](https://img.shields.io/pypi/v/imgscraper)](https://pypi.org/project/imgscraper/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/dawid-szaniawski/imgscraper/blob/master/LICENSE)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![codecov](https://codecov.io/github/dawid-szaniawski/imgscraper/branch/master/graph/badge.svg?token=hY7Nb5jGgi)](https://codecov.io/github/dawid-szaniawski/imgscraper)\n[![CodeFactor](https://www.codefactor.io/repository/github/dawid-szaniawski/imgscraper/badge)](https://www.codefactor.io/repository/github/dawid-szaniawski/imgscraper)\n\n# imgscraper: yet another web scraper\n\nimgscraper is a simple library that allows you to retrieve image information from meme sites.\n\n## Installation\n\nTo install _imgscraper_, you can use pip:\n\n```bash\npip install imgscraper\n```\n\n_ImgScraper_ supports Python 3.10+\n\n\n## Usage\n\n```python\nfrom imgscraper.scraper_constructor import create_scraper\n\nimg_scraper = create_scraper(\n website_url=\"https://imagocms.webludus.pl/\",\n container_class=\"image-holder\",\n pagination_class=\"pagination\"\n)\n\nimg_scraper.start_sync()\n\nprint(img_scraper.synchronization_data)\n```\n\nOutput:\n\n```python\n[\n Image(\n source=\"https://imagocms.webludus.pl/images/01/\",\n url_address=\"https://imagocms.webludus.pl/img/01.jpg\",\n title=\"String\"\n ),\n Image(\n source=\"https://imagocms.webludus.pl/images/02/\",\n url_address=\"https://imagocms.webludus.pl/img/02.jpg\",\n title=\"String\"\n )\n]\n```\n\n## Pages to scan and scraper\n\nThe user can specify how many subpages should be scraped and what tool the application should use.\n\n```python\nfrom imgscraper.scraper_constructor import create_scraper\n\nimg_scraper = create_scraper(\n website_url=\"https://imagocms.webludus.pl/\",\n container_class=\"image-holder\",\n pagination_class=\"pagination\",\n pages_to_scan=1,\n scraper=\"bs4\"\n)\n```\n\n## Last sync data\n\nWhen starting the synchronization process, the user can provide data from the last synchronization (img.src).\nIf the application encounters a provided image, the process is terminated. All previously synced images are available.\n\n```python\nscraper.start_sync(\n (\n \"https://imagocms.webludus.pl/img/01.jpg\",\n \"https://imagocms.webludus.pl/img/02.jpg\",\n )\n)\n```\n\n## Image Object\n\nThe Image object provides the ``.as_dict()`` method to turn it into a dictionary.\n\n```python\nimg = Image(\n source=\"https://imagocms.webludus.pl/images/01/\",\n url_address=\"https://imagocms.webludus.pl/img/01.jpg\",\n title=\"String\"\n).as_dict()\n```\n\nOutput:\n\n```python\nimg = {\n \"source\": \"https://imagocms.webludus.pl/images/01/\",\n \"url_address\": \"https://imagocms.webludus.pl/img/01.jpg\",\n \"title\": \"String\"\n}\n```\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2023 Dawid Szaniawski\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.",
"summary": "Scans web pages for images",
"version": "0.3.0",
"project_urls": {
"Source": "https://github.com/dawid-szaniawski/imgscraper"
},
"split_keywords": [
"api",
" automation",
" json",
" web"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a606998e1c5ee4023afecdd16bc3862cf9fca6f9db955db44ae29244d85aba91",
"md5": "401097150ae57328153ae5ed2c2a4077",
"sha256": "ede39317f923d77b5e19c3b70b4e830d1d60c4dc1c5ca665576e6398d3277f75"
},
"downloads": -1,
"filename": "imgscraper-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "401097150ae57328153ae5ed2c2a4077",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 10420,
"upload_time": "2025-01-22T19:43:11",
"upload_time_iso_8601": "2025-01-22T19:43:11.429834Z",
"url": "https://files.pythonhosted.org/packages/a6/06/998e1c5ee4023afecdd16bc3862cf9fca6f9db955db44ae29244d85aba91/imgscraper-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c89e4f2796000510e0198015ccbb24ff6c901d4abab1e6a04c3e274a77f1c76d",
"md5": "5bc556c076a7ed0ed778ae5f55f85958",
"sha256": "1676eb024116d67d96a50678c3d9353d2da258054f415be4292a0c10435008db"
},
"downloads": -1,
"filename": "imgscraper-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "5bc556c076a7ed0ed778ae5f55f85958",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 10802,
"upload_time": "2025-01-22T19:43:12",
"upload_time_iso_8601": "2025-01-22T19:43:12.476000Z",
"url": "https://files.pythonhosted.org/packages/c8/9e/4f2796000510e0198015ccbb24ff6c901d4abab1e6a04c3e274a77f1c76d/imgscraper-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-22 19:43:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dawid-szaniawski",
"github_project": "imgscraper",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "imgscraper"
}