Skip to main content

RSS feed generator for official game news from Hoyolab.

Project description

Hoyolab RSS Feeds

PyPI Python Version Tests Status Codecov Code style: black Checked with mypy

Generate RSS news feeds for games like Genshin Impact or Honkai Impact 3rd based on the official Hoyolab forum posts. The current available feed formats are Atom and JSON Feed. This feed generator is supposed to be run periodically by e.g. a cronjob.

There are some 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:

pip install hoyolab-rss-feeds

To get the latest development version, you can also install it directly from GitHub:

pip install git+https://github.com/c3kay/hoyolab-rss-feeds.git@master

Usage

CLI

You can run the application with:

hoyolab-rss-feeds

or via Python with:

python -m hoyolabrssfeeds

The first time, when the application is started, it will create a default TOML config file in your current working directory (./hoyolab-rss-feeds.toml) and will exit afterwards. You can specify a custom path for the config file via a parameter:

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

or equivalent:

python -m hoyolabrssfeeds -c path/to/config.toml

Library

It is also possible to generate the feeds directly from your Python application:

from hoyolabrssfeeds import FeedConfigLoader, GameFeed, GameFeedCollection, Game

async def generate_feeds():
    loader = FeedConfigLoader("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()

Configuration

In the TOML config file you can define for which games you want to create a feed and in which format they should be. A config file might look like this:

language = "de-de"
category_size = 15

[genshin]
feed.json.path = "path/to/genshin.json"
feed.json.url = "https://example.org/genshin.json"
title = "Genshin Impact News"
icon = "https://example.org/icon.png"

[honkai]
feed.json.path = "path/to/honkai.json"
feed.json.url = "https://example.org/honkai.json"
feed.atom.path = "path/to/honkai.xml"
feed.atom.url = "https://example.org/honkai.xml"
category_size = 5

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 only 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 can be overwritten by a game section.

The category_size entry defines the amount of feed items (default: 5) of a Hoyolab news category (Info, Event and Notices) for each feed. Therefore, the maximum size of a feed will be 3 * category_size.

Note: When using Windows file paths (like C:\\path\to\config.toml), you should use single quotes (') to avoid a misinterpretation of the backslashes by the TOML parser. More info about the TOML format can be found in the official documentation.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hoyolab-rss-feeds-2.1.1.tar.gz (22.5 kB view hashes)

Uploaded Source

Built Distribution

hoyolab_rss_feeds-2.1.1-py3-none-any.whl (16.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page