google-news-feed


Namegoogle-news-feed JSON
Version 1.1.0 PyPI version JSON
download
home_page
SummaryA simple python library to consume the google news rss feed
upload_time2023-06-02 15:52:45
maintainer
docs_urlNone
authorLukas Kreussel
requires_python>=3.10
licenseMIT License Copyright (c) 2022 LLukas22 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
VCS
bugtrack_url
requirements dateparser lxml beautifulsoup4 requests aiohttp
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Google-News-Feed
A simple python library to consume the google news rss feed.

Inspired by [pygooglenews](https://github.com/kotartemiy/pygooglenews) and implemented using [aiohttp](https://pypi.org/project/aiohttp/) and [lxml](https://pypi.org/project/lxml/).


## Installation
Via pip: <code>pip install google-news-feed</code>

## How to use
```python
from google_news_feed import GoogleNewsFeed

gnf = GoogleNewsFeed(language='en',country='US')
results = gnf.query("python")
print(results)
```
For more information about the query parameters see [here](https://newscatcherapi.com/blog/google-news-rss-search-parameters-the-missing-documentaiton).

### Get Top Headlines
```python
gnf = GoogleNewsFeed(language='en',country='US')
results = gnf.top_headlines()
```

### Query a specific topic
```python
gnf = GoogleNewsFeed(language='en',country='US')
results = gnf.query_topic("business")
```
For more topics see [here](https://newscatcherapi.com/blog/google-news-rss-search-parameters-the-missing-documentaiton).
### Accessing the results
The results are a list of NewsItems.
```python
result = gnf.query("python")[0]
print(result.title)
print(result.link)
print(result.pubDate)
print(result.description)
print(result.source)
```

## Handling internal links
Some links are internal to google news. To access the actual link to the news site the internal link has to be accessed and the redirect url is returned. To simplify this process the `resolve_internal_links` property can be set to True.
```python
gnf = GoogleNewsFeed(language='en',country='US',resolve_internal_links=True)
print(gnf.top_headlines()[0].link)
```
The resolution is handled asynchronously by default, but can be forced to be done synchronously via the `run_async` parameter.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "google-news-feed",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "",
    "author": "Lukas Kreussel",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/25/1a/e688e45aaab206b70547d8d8864a4e8382ed14854998941d6ba85ac16072/google_news_feed-1.1.0.tar.gz",
    "platform": null,
    "description": "# Google-News-Feed\nA simple python library to consume the google news rss feed.\n\nInspired by [pygooglenews](https://github.com/kotartemiy/pygooglenews) and implemented using [aiohttp](https://pypi.org/project/aiohttp/) and [lxml](https://pypi.org/project/lxml/).\n\n\n## Installation\nVia pip: <code>pip install google-news-feed</code>\n\n## How to use\n```python\nfrom google_news_feed import GoogleNewsFeed\n\ngnf = GoogleNewsFeed(language='en',country='US')\nresults = gnf.query(\"python\")\nprint(results)\n```\nFor more information about the query parameters see [here](https://newscatcherapi.com/blog/google-news-rss-search-parameters-the-missing-documentaiton).\n\n### Get Top Headlines\n```python\ngnf = GoogleNewsFeed(language='en',country='US')\nresults = gnf.top_headlines()\n```\n\n### Query a specific topic\n```python\ngnf = GoogleNewsFeed(language='en',country='US')\nresults = gnf.query_topic(\"business\")\n```\nFor more topics see [here](https://newscatcherapi.com/blog/google-news-rss-search-parameters-the-missing-documentaiton).\n### Accessing the results\nThe results are a list of NewsItems.\n```python\nresult = gnf.query(\"python\")[0]\nprint(result.title)\nprint(result.link)\nprint(result.pubDate)\nprint(result.description)\nprint(result.source)\n```\n\n## Handling internal links\nSome links are internal to google news. To access the actual link to the news site the internal link has to be accessed and the redirect url is returned. To simplify this process the `resolve_internal_links` property can be set to True.\n```python\ngnf = GoogleNewsFeed(language='en',country='US',resolve_internal_links=True)\nprint(gnf.top_headlines()[0].link)\n```\nThe resolution is handled asynchronously by default, but can be forced to be done synchronously via the `run_async` parameter.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 LLukas22  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": "A simple python library to consume the google news rss feed",
    "version": "1.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/LLukas22/Google-News-RSS/issues",
        "Homepage": "https://github.com/LLukas22/Google-News-RSS"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c5fc4780664bcfaf258a89357947e86cbe8c261c247be40463a248412c273e45",
                "md5": "d91006c15a1cfbac483b1e6284699ae2",
                "sha256": "add53b554b7f65a9d07936b714527e9711d30ec1bd3f903e611ba69ad8ec3add"
            },
            "downloads": -1,
            "filename": "google_news_feed-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d91006c15a1cfbac483b1e6284699ae2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 5773,
            "upload_time": "2023-06-02T15:52:43",
            "upload_time_iso_8601": "2023-06-02T15:52:43.480652Z",
            "url": "https://files.pythonhosted.org/packages/c5/fc/4780664bcfaf258a89357947e86cbe8c261c247be40463a248412c273e45/google_news_feed-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "251ae688e45aaab206b70547d8d8864a4e8382ed14854998941d6ba85ac16072",
                "md5": "c4085e7191e02877bba05cf62b1a4bf1",
                "sha256": "7d410faa62b019ec3ba02d50afe202432275c2f02d6bf30d53611cd9510fa415"
            },
            "downloads": -1,
            "filename": "google_news_feed-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c4085e7191e02877bba05cf62b1a4bf1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 7084,
            "upload_time": "2023-06-02T15:52:45",
            "upload_time_iso_8601": "2023-06-02T15:52:45.145352Z",
            "url": "https://files.pythonhosted.org/packages/25/1a/e688e45aaab206b70547d8d8864a4e8382ed14854998941d6ba85ac16072/google_news_feed-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-02 15:52:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LLukas22",
    "github_project": "Google-News-RSS",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "dateparser",
            "specs": [
                [
                    ">=",
                    "1.1.1"
                ]
            ]
        },
        {
            "name": "lxml",
            "specs": [
                [
                    ">=",
                    "4.9.0"
                ]
            ]
        },
        {
            "name": "beautifulsoup4",
            "specs": [
                [
                    ">=",
                    "4.12.2"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.31.0"
                ]
            ]
        },
        {
            "name": "aiohttp",
            "specs": [
                [
                    ">=",
                    "3.8.4"
                ]
            ]
        }
    ],
    "lcname": "google-news-feed"
}
        
Elapsed time: 0.06855s