newspaper-scraper


Namenewspaper-scraper JSON
Version 0.2.1 PyPI version JSON
download
home_page
SummaryThe all-in-one Python package for seamless newspaper article indexing, scraping, and processing – supports public and premium content!
upload_time2023-05-17 02:53:19
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT License Copyright (c) 2023 Lukas Trippe 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 newspaper article scraper index process nlp wrapper
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Newspaper-Scraper  
  
##### The all-in-one Python package for seamless newspaper article indexing, scraping, and processing – supports public and premium content!
  
## Intro  
While tools like [newspaper3k](https://newspaper.readthedocs.io/en/latest/) and [goose3](https://github.com/goose3/goose3) can be used for extracting articles from news websites, they need a dedicated article url for older articles and do not support paywall content. This package aims to solve these issues by providing a unified interface for indexing, extracting and processing articles from newspapers.  
1. Indexing: Index articles from a newspaper website using the [beautifulsoup](https://beautiful-soup-4.readthedocs.io/en/latest/) package for public articles and [selenium](https://selenium-python.readthedocs.io/) for paywall content.  
2. Extraction: Extract article content using the [goose3](https://github.com/goose3/goose3) package.  
3. Processing: Process articles for nlp features using the [spaCy](https://spacy.io/) package.  
  
The indexing functionality is based on a dedicated file for each newspaper. A few newspapers are already supported, but it is easy to add new ones.  
  
### Supported Newspapers  
| Logo | Newspaper                                        | Country | Time span  | Number of articles |  
| ----------------------------------------------------------------------------------------------------------------------------------------------- |--------------------------------------------------| ------- |------------| --------------- |  
| <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Der_Spiegel_2022_logo.svg/640px-Der_Spiegel_2022_logo.svg.png" height="70"> | [Der Spiegel](https://www.spiegel.de/)           | Germany | Since 2000 | tbd |  
| <img src="https://upload.wikimedia.org/wikipedia/commons/0/0a/Die_Welt_Logo_2015.png" height="70"> | [Die Welt](https://www.welt.de/)                 | Germany | Since 2000 | tbd  
| <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/Logo_BILD.svg/1920px-Logo_BILD.svg.png" height="70"> | [Bild](https://www.bild.de/)                     | Germany | Since 2006 | tbd |  
| <img src="https://upload.wikimedia.org/wikipedia/commons/6/60/Die_Zeit-Logo-Bremen.svg" height="70"> | [Die Zeit](https://www.zeit.de/)                 | Germany | Since 1946 | tbd |   
| <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Handelsblatt_201x_logo.svg/2880px-Handelsblatt_201x_logo.svg.png" height="70"> | [Handelsblatt](https://www.handelsblatt.com/)    | Germany | Since 2003 | tbd | 
| <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/1d/Tagesspiegel_%282022-11-29%29.svg/2880px-Tagesspiegel_%282022-11-29%29.svg.png" height="70"> | [Der Tagesspiegel](https://www.tagesspiegel.de/) | Germany | Since 2000 | tbd |
| <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/S%C3%BCddeutsche_Zeitung_Logo.svg/2880px-S%C3%BCddeutsche_Zeitung_Logo.svg.png" height="70"> | [Süddeutsche Zeitung](https://www.sueddeutsche.de/)    | Germany | Since 2001 | tbd |

## Setup  
It is recommended to install the package in an dedicated Python environment.  
To install the package via pip, run the following command:  
  
```bash  
pip install newspaper-scraper
```  
  
To also include the nlp extraction functionality (via [spaCy](https://spacy.io/)), run the following command:  
  
```bash  
pip install newspaper-scraper[nlp]
```  
  
## Usage  
To index, extract and process all public and premium articles from [Der Spiegel](https://www.spiegel.de/), published in August 2021, run the following code:  
  
```python  
import newspaper_scraper as nps  
from credentials import username, password  
  
with nps.Spiegel(db_file='articles.db') as news:
    news.index_articles_by_date_range('2021-08-01', '2021-08-31')  
    news.scrape_public_articles()
    news.scrape_premium_articles(username=username, password=password)  
    news.nlp()
```  
  
This will create a sqlite database file called `articles.db` in the current working directory. The database contains the following tables:  
- `tblArticlesIndexed`: Contains all indexed articles with their scraping/ processing status and whether they are public or premium content.  
- `tblArticlesScraped`: Contains metadata for all parsed articles, provided by goose3.  
- `tblArticlesProcessed`: Contains nlp features of the cleaned article text, provided by spaCy.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "newspaper-scraper",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "newspaper,article,scraper,index,process,nlp,wrapper",
    "author": "",
    "author_email": "Lukas Trippe <lkstrp@pm.me>",
    "download_url": "https://files.pythonhosted.org/packages/e1/2d/592a27f65aba43a1efd4e2861e1418f112aac5ad7241dd0d6b82ceaa0627/newspaper_scraper-0.2.1.tar.gz",
    "platform": null,
    "description": "# Newspaper-Scraper  \n  \n##### The all-in-one Python package for seamless newspaper article indexing, scraping, and processing \u2013 supports public and premium content!\n  \n## Intro  \nWhile tools like [newspaper3k](https://newspaper.readthedocs.io/en/latest/) and [goose3](https://github.com/goose3/goose3) can be used for extracting articles from news websites, they need a dedicated article url for older articles and do not support paywall content. This package aims to solve these issues by providing a unified interface for indexing, extracting and processing articles from newspapers.  \n1. Indexing: Index articles from a newspaper website using the [beautifulsoup](https://beautiful-soup-4.readthedocs.io/en/latest/) package for public articles and [selenium](https://selenium-python.readthedocs.io/) for paywall content.  \n2. Extraction: Extract article content using the [goose3](https://github.com/goose3/goose3) package.  \n3. Processing: Process articles for nlp features using the [spaCy](https://spacy.io/) package.  \n  \nThe indexing functionality is based on a dedicated file for each newspaper. A few newspapers are already supported, but it is easy to add new ones.  \n  \n### Supported Newspapers  \n| Logo | Newspaper                                        | Country | Time span  | Number of articles |  \n| ----------------------------------------------------------------------------------------------------------------------------------------------- |--------------------------------------------------| ------- |------------| --------------- |  \n| <img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Der_Spiegel_2022_logo.svg/640px-Der_Spiegel_2022_logo.svg.png\" height=\"70\"> | [Der Spiegel](https://www.spiegel.de/)           | Germany | Since 2000 | tbd |  \n| <img src=\"https://upload.wikimedia.org/wikipedia/commons/0/0a/Die_Welt_Logo_2015.png\" height=\"70\"> | [Die Welt](https://www.welt.de/)                 | Germany | Since 2000 | tbd  \n| <img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/Logo_BILD.svg/1920px-Logo_BILD.svg.png\" height=\"70\"> | [Bild](https://www.bild.de/)                     | Germany | Since 2006 | tbd |  \n| <img src=\"https://upload.wikimedia.org/wikipedia/commons/6/60/Die_Zeit-Logo-Bremen.svg\" height=\"70\"> | [Die Zeit](https://www.zeit.de/)                 | Germany | Since 1946 | tbd |   \n| <img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Handelsblatt_201x_logo.svg/2880px-Handelsblatt_201x_logo.svg.png\" height=\"70\"> | [Handelsblatt](https://www.handelsblatt.com/)    | Germany | Since 2003 | tbd | \n| <img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/1/1d/Tagesspiegel_%282022-11-29%29.svg/2880px-Tagesspiegel_%282022-11-29%29.svg.png\" height=\"70\"> | [Der Tagesspiegel](https://www.tagesspiegel.de/) | Germany | Since 2000 | tbd |\n| <img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/S%C3%BCddeutsche_Zeitung_Logo.svg/2880px-S%C3%BCddeutsche_Zeitung_Logo.svg.png\" height=\"70\"> | [S\u00fcddeutsche Zeitung](https://www.sueddeutsche.de/)    | Germany | Since 2001 | tbd |\n\n## Setup  \nIt is recommended to install the package in an dedicated Python environment.  \nTo install the package via pip, run the following command:  \n  \n```bash  \npip install newspaper-scraper\n```  \n  \nTo also include the nlp extraction functionality (via [spaCy](https://spacy.io/)), run the following command:  \n  \n```bash  \npip install newspaper-scraper[nlp]\n```  \n  \n## Usage  \nTo index, extract and process all public and premium articles from [Der Spiegel](https://www.spiegel.de/), published in August 2021, run the following code:  \n  \n```python  \nimport newspaper_scraper as nps  \nfrom credentials import username, password  \n  \nwith nps.Spiegel(db_file='articles.db') as news:\n    news.index_articles_by_date_range('2021-08-01', '2021-08-31')  \n    news.scrape_public_articles()\n    news.scrape_premium_articles(username=username, password=password)  \n    news.nlp()\n```  \n  \nThis will create a sqlite database file called `articles.db` in the current working directory. The database contains the following tables:  \n- `tblArticlesIndexed`: Contains all indexed articles with their scraping/ processing status and whether they are public or premium content.  \n- `tblArticlesScraped`: Contains metadata for all parsed articles, provided by goose3.  \n- `tblArticlesProcessed`: Contains nlp features of the cleaned article text, provided by spaCy.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Lukas Trippe  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. ",
    "summary": "The all-in-one Python package for seamless newspaper article indexing, scraping, and processing \u2013 supports public and premium content!",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/lkstrp/newspaper-scraper"
    },
    "split_keywords": [
        "newspaper",
        "article",
        "scraper",
        "index",
        "process",
        "nlp",
        "wrapper"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "186ffa7e82dbee757fd9322e4e09fbb1d99b968ea8c9f5786067253e4d7d9c67",
                "md5": "0e3ceaee99e8ad910cd83e236bb214b0",
                "sha256": "a2d956af0272b67ee0bab7f3630d97767a04d9d4c8f2cf5fb0be31f163bffc39"
            },
            "downloads": -1,
            "filename": "newspaper_scraper-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0e3ceaee99e8ad910cd83e236bb214b0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 31484,
            "upload_time": "2023-05-17T02:53:14",
            "upload_time_iso_8601": "2023-05-17T02:53:14.623532Z",
            "url": "https://files.pythonhosted.org/packages/18/6f/fa7e82dbee757fd9322e4e09fbb1d99b968ea8c9f5786067253e4d7d9c67/newspaper_scraper-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e12d592a27f65aba43a1efd4e2861e1418f112aac5ad7241dd0d6b82ceaa0627",
                "md5": "75ebfbff77ee307a6b0bcf0818c23795",
                "sha256": "4fd8ada2a5e714b2b09b5872f92032b6136a0c918d33d3e5f5e6e54c306392f4"
            },
            "downloads": -1,
            "filename": "newspaper_scraper-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "75ebfbff77ee307a6b0bcf0818c23795",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 21691,
            "upload_time": "2023-05-17T02:53:19",
            "upload_time_iso_8601": "2023-05-17T02:53:19.682530Z",
            "url": "https://files.pythonhosted.org/packages/e1/2d/592a27f65aba43a1efd4e2861e1418f112aac5ad7241dd0d6b82ceaa0627/newspaper_scraper-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-17 02:53:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lkstrp",
    "github_project": "newspaper-scraper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "newspaper-scraper"
}
        
Elapsed time: 0.19712s