RSS feed generator for official game news from Hoyolab.
Project description
Hoyolab RSS Feeds
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
Built Distribution
Hashes for hoyolab_rss_feeds-2.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fec8902e2c7171a7085b03c88aa31611f87474e38865ad0cf449cf68ef2364be |
|
MD5 | fd212c39d403a661f9d48698a302abd5 |
|
BLAKE2b-256 | 2abc99665b321bc116901456fb96010a70dca22a4e44cbeaa2b5425799c0a089 |