hoyolab-rss-feeds


Namehoyolab-rss-feeds JSON
Version 2.4.1 PyPI version JSON
download
home_pageNone
SummaryRSS feed generator for official game news from Hoyolab.
upload_time2024-12-07 16:28:19
maintainerNone
docs_urlNone
authorc3kay
requires_python>=3.9
licenseMIT License
keywords hoyolab rss feed rss-generator jsonfeed atom genshin-impact honkai-impact zenless-zone-zero
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Hoyolab RSS Feeds

[![PyPI](https://img.shields.io/pypi/v/hoyolab-rss-feeds)](https://pypi.org/project/hoyolab-rss-feeds/)
[![Python Version](https://img.shields.io/pypi/pyversions/hoyolab-rss-feeds)](https://pypi.org/project/hoyolab-rss-feeds/)
[![Tests Status](https://img.shields.io/github/actions/workflow/status/c3kay/hoyolab-rss-feeds/build.yaml)](https://github.com/c3kay/hoyolab-rss-feeds/actions/workflows/build.yaml)
[![Codecov](https://img.shields.io/codecov/c/gh/c3kay/hoyolab-rss-feeds/master)](https://app.codecov.io/gh/c3kay/hoyolab-rss-feeds)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)

Generate RSS news feeds for Hoyoverse games like Genshin Impact or Honkai Starrail based
on the official [Hoyolab](https://www.hoyolab.com) forum posts. Available feed formats
are [Atom](https://datatracker.ietf.org/doc/html/rfc4287) and [JSON Feed](https://jsonfeed.org).
This application is supposed to run periodically by a cronjob for example.

There are some [feeds](https://c3kay.de/hoyolab-rss-feeds) already hosted by myself!

## Installation

You need at least Python 3.8 and the package manager Pip installed. You can then
install this package from PyPI with:

```shell
pip install hoyolab-rss-feeds
```

## Usage

### CLI

You can run the application like this:

```shell
hoyolab-rss-feeds
```

or as module:

```shell
python -m hoyolabrssfeeds
```

If no configuration can be found, the application will create a default config
in your current directory (`./hoyolab-rss-feeds.toml`) and will exit afterward.

You can specify a path for the config file with a parameter:

```shell
hoyolab-rss-feeds -c path/to/config.toml
```

### Module

It is also possible to generate the feeds via code:

```python
from pathlib import Path
from hoyolabrssfeeds import FeedConfigLoader, GameFeed, GameFeedCollection, Game

async def generate_feeds():
    loader = FeedConfigLoader(Path("path/to/config.toml"))
    
    # all games in config
    all_configs = await loader.get_all_feed_configs()
    feed_collection = GameFeedCollection.from_configs(all_configs)
    await feed_collection.create_feeds()
    
    # only a single game
    genshin_config = await loader.get_feed_config(Game.GENSHIN)
    genshin_feed = GameFeed.from_config(genshin_config)
    await genshin_feed.create_feed()
```

[Here](https://gist.github.com/c3kay/2cd9833ef1c527e210aebf7a866336ed)
you can find an example on how to create a feed without using the TOML config file.

## Configuration

In the TOML config file you can define for which games you want to create a feed
and in which format the feeds should be. Here is an example config:

```toml
language = "de-de"
category_size = 15

[genshin]
feed.json.path = "path/to/genshin.json"
feed.json.url = "https://example.org/genshin.json"
categories = ["Info", "Notices"]
category_size = 5
title = "Genshin Impact News"
icon = "https://example.org/icon.png"

[starrail]
feed.json.path = "path/to/starrail.json"
feed.json.url = "https://example.org/starrail.json"
feed.atom.path = "path/to/starrail.xml"
feed.atom.url = "https://example.org/starrail.xml"
```

A minimal configuration requires at least one game section with a `feed.<format>.path`
entry. Available feed formats are currently `json` and `atom`. You can either use
one format or both.

Entries defined at root level are considered default values and will apply to every
game section. The `feed` key can only be used in a game section. All other keys
can be defined at root level, and they can be overwritten by a game section.

The `categories` list defines the selected Hoyolab categories (*Info*, *Event* and
*Notices*) for this feed. If this entry is omitted, all categories are selected.
The `category_size` entry defines the amount of feed items (default: 5) of a category
for each feed. 

**Note:** When using Windows file paths (like `C:\\path\to\config.toml`), single quotes
should be used to avoid wrong auto-escaping of backslashes. More info about the TOML
format can be found in the [official documentation](https://toml.io/en/).

### Logging

Simple logs at level `INFO` are written to the terminal by default. If a file path is given
via parameter (`-l /path/to/out.log`), the logs are written to this file.

If the application is run via code, the logger must be 
[configured](https://docs.python.org/3.11/howto/logging.html#configuring-logging) separately. 
The application specific logger is available by:

```python
import logging
logger = logging.getLogger("hoyolabrssfeeds")
```

### Options

#### Games

| Game              | Section    |
|-------------------|------------|
| Genshin Impact    | `genshin`  |
| Honkai Impact 3rd | `honkai`   |
| Tears of Themis   | `themis`   |
| Honkai: Starrail  | `starrail` |
| Zenless Zone Zero | `zenless`  |

#### Languages

*English is the default language.*

| Language     | Code    |
|--------------|---------|
| German       | `de-de` |
| English      | `en-us` |
| Spanish      | `es-es` |
| French       | `fr-fr` |
| Indonesian   | `id-id` |
| Italian      | `it-it` |
| Japanese     | `ja-jp` |
| Korean       | `ko-kr` |
| Portuguese   | `pt-pt` |
| Russian      | `ru-ru` |
| Thai         | `th-th` |
| Turkish      | `tr-tr` |
| Vietnamese   | `vi-vn` |
| Chinese (CN) | `zh-cn` |
| Chinese (TW) | `zh-tw` |

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "hoyolab-rss-feeds",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "hoyolab, rss, feed, rss-generator, jsonfeed, atom, genshin-impact, honkai-impact, zenless-zone-zero",
    "author": "c3kay",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c5/0e/ab41a31f90da7e576f63d543ff6b6f2c3dd61ceefb5111987ae8938942d7/hoyolab_rss_feeds-2.4.1.tar.gz",
    "platform": null,
    "description": "# Hoyolab RSS Feeds\n\n[![PyPI](https://img.shields.io/pypi/v/hoyolab-rss-feeds)](https://pypi.org/project/hoyolab-rss-feeds/)\n[![Python Version](https://img.shields.io/pypi/pyversions/hoyolab-rss-feeds)](https://pypi.org/project/hoyolab-rss-feeds/)\n[![Tests Status](https://img.shields.io/github/actions/workflow/status/c3kay/hoyolab-rss-feeds/build.yaml)](https://github.com/c3kay/hoyolab-rss-feeds/actions/workflows/build.yaml)\n[![Codecov](https://img.shields.io/codecov/c/gh/c3kay/hoyolab-rss-feeds/master)](https://app.codecov.io/gh/c3kay/hoyolab-rss-feeds)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n\nGenerate RSS news feeds for Hoyoverse games like Genshin Impact or Honkai Starrail based\non the official [Hoyolab](https://www.hoyolab.com) forum posts. Available feed formats\nare [Atom](https://datatracker.ietf.org/doc/html/rfc4287) and [JSON Feed](https://jsonfeed.org).\nThis application is supposed to run periodically by a cronjob for example.\n\nThere are some [feeds](https://c3kay.de/hoyolab-rss-feeds) already hosted by myself!\n\n## Installation\n\nYou need at least Python 3.8 and the package manager Pip installed. You can then\ninstall this package from PyPI with:\n\n```shell\npip install hoyolab-rss-feeds\n```\n\n## Usage\n\n### CLI\n\nYou can run the application like this:\n\n```shell\nhoyolab-rss-feeds\n```\n\nor as module:\n\n```shell\npython -m hoyolabrssfeeds\n```\n\nIf no configuration can be found, the application will create a default config\nin your current directory (`./hoyolab-rss-feeds.toml`) and will exit afterward.\n\nYou can specify a path for the config file with a parameter:\n\n```shell\nhoyolab-rss-feeds -c path/to/config.toml\n```\n\n### Module\n\nIt is also possible to generate the feeds via code:\n\n```python\nfrom pathlib import Path\nfrom hoyolabrssfeeds import FeedConfigLoader, GameFeed, GameFeedCollection, Game\n\nasync def generate_feeds():\n    loader = FeedConfigLoader(Path(\"path/to/config.toml\"))\n    \n    # all games in config\n    all_configs = await loader.get_all_feed_configs()\n    feed_collection = GameFeedCollection.from_configs(all_configs)\n    await feed_collection.create_feeds()\n    \n    # only a single game\n    genshin_config = await loader.get_feed_config(Game.GENSHIN)\n    genshin_feed = GameFeed.from_config(genshin_config)\n    await genshin_feed.create_feed()\n```\n\n[Here](https://gist.github.com/c3kay/2cd9833ef1c527e210aebf7a866336ed)\nyou can find an example on how to create a feed without using the TOML config file.\n\n## Configuration\n\nIn the TOML config file you can define for which games you want to create a feed\nand in which format the feeds should be. Here is an example config:\n\n```toml\nlanguage = \"de-de\"\ncategory_size = 15\n\n[genshin]\nfeed.json.path = \"path/to/genshin.json\"\nfeed.json.url = \"https://example.org/genshin.json\"\ncategories = [\"Info\", \"Notices\"]\ncategory_size = 5\ntitle = \"Genshin Impact News\"\nicon = \"https://example.org/icon.png\"\n\n[starrail]\nfeed.json.path = \"path/to/starrail.json\"\nfeed.json.url = \"https://example.org/starrail.json\"\nfeed.atom.path = \"path/to/starrail.xml\"\nfeed.atom.url = \"https://example.org/starrail.xml\"\n```\n\nA minimal configuration requires at least one game section with a `feed.<format>.path`\nentry. Available feed formats are currently `json` and `atom`. You can either use\none format or both.\n\nEntries defined at root level are considered default values and will apply to every\ngame section. The `feed` key can only be used in a game section. All other keys\ncan be defined at root level, and they can be overwritten by a game section.\n\nThe `categories` list defines the selected Hoyolab categories (*Info*, *Event* and\n*Notices*) for this feed. If this entry is omitted, all categories are selected.\nThe `category_size` entry defines the amount of feed items (default: 5) of a category\nfor each feed. \n\n**Note:** When using Windows file paths (like `C:\\\\path\\to\\config.toml`), single quotes\nshould be used to avoid wrong auto-escaping of backslashes. More info about the TOML\nformat can be found in the [official documentation](https://toml.io/en/).\n\n### Logging\n\nSimple logs at level `INFO` are written to the terminal by default. If a file path is given\nvia parameter (`-l /path/to/out.log`), the logs are written to this file.\n\nIf the application is run via code, the logger must be \n[configured](https://docs.python.org/3.11/howto/logging.html#configuring-logging) separately. \nThe application specific logger is available by:\n\n```python\nimport logging\nlogger = logging.getLogger(\"hoyolabrssfeeds\")\n```\n\n### Options\n\n#### Games\n\n| Game              | Section    |\n|-------------------|------------|\n| Genshin Impact    | `genshin`  |\n| Honkai Impact 3rd | `honkai`   |\n| Tears of Themis   | `themis`   |\n| Honkai: Starrail  | `starrail` |\n| Zenless Zone Zero | `zenless`  |\n\n#### Languages\n\n*English is the default language.*\n\n| Language     | Code    |\n|--------------|---------|\n| German       | `de-de` |\n| English      | `en-us` |\n| Spanish      | `es-es` |\n| French       | `fr-fr` |\n| Indonesian   | `id-id` |\n| Italian      | `it-it` |\n| Japanese     | `ja-jp` |\n| Korean       | `ko-kr` |\n| Portuguese   | `pt-pt` |\n| Russian      | `ru-ru` |\n| Thai         | `th-th` |\n| Turkish      | `tr-tr` |\n| Vietnamese   | `vi-vn` |\n| Chinese (CN) | `zh-cn` |\n| Chinese (TW) | `zh-tw` |\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "RSS feed generator for official game news from Hoyolab.",
    "version": "2.4.1",
    "project_urls": {
        "Homepage": "https://c3kay.de/hoyolab-rss-feeds",
        "Repository": "https://github.com/c3kay/hoyolab-rss-feeds"
    },
    "split_keywords": [
        "hoyolab",
        " rss",
        " feed",
        " rss-generator",
        " jsonfeed",
        " atom",
        " genshin-impact",
        " honkai-impact",
        " zenless-zone-zero"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "de418db80cd22c19e326fb38affceb22f7d1fa0a67491e4cb6a0f9fbb6ec149a",
                "md5": "b9010c8a40d29407c4073c818d1b76b3",
                "sha256": "98d24adad13dee7af9bbcf44f7bc17a9187ba0cfceb4956d7fdb4ee15041daf8"
            },
            "downloads": -1,
            "filename": "hoyolab_rss_feeds-2.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b9010c8a40d29407c4073c818d1b76b3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 18061,
            "upload_time": "2024-12-07T16:28:17",
            "upload_time_iso_8601": "2024-12-07T16:28:17.675474Z",
            "url": "https://files.pythonhosted.org/packages/de/41/8db80cd22c19e326fb38affceb22f7d1fa0a67491e4cb6a0f9fbb6ec149a/hoyolab_rss_feeds-2.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c50eab41a31f90da7e576f63d543ff6b6f2c3dd61ceefb5111987ae8938942d7",
                "md5": "7840147b74f97670eced1294a05e6dde",
                "sha256": "3799308835a5045fa305463d1fe6d954986edb7d4f8c16a88d12245d7a61f2c4"
            },
            "downloads": -1,
            "filename": "hoyolab_rss_feeds-2.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "7840147b74f97670eced1294a05e6dde",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 25186,
            "upload_time": "2024-12-07T16:28:19",
            "upload_time_iso_8601": "2024-12-07T16:28:19.116162Z",
            "url": "https://files.pythonhosted.org/packages/c5/0e/ab41a31f90da7e576f63d543ff6b6f2c3dd61ceefb5111987ae8938942d7/hoyolab_rss_feeds-2.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-07 16:28:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "c3kay",
    "github_project": "hoyolab-rss-feeds",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "hoyolab-rss-feeds"
}
        
Elapsed time: 0.40361s