https://github.com/animenosekai/japanterebi-xmltv
Easily create XMLTV files
https://github.com/animenosekai/japanterebi-xmltv
epg japanterebi tv xmltv
Last synced: 4 months ago
JSON representation
Easily create XMLTV files
- Host: GitHub
- URL: https://github.com/animenosekai/japanterebi-xmltv
- Owner: Animenosekai
- License: mit
- Created: 2024-03-21T21:55:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-18T09:19:04.000Z (4 months ago)
- Last Synced: 2025-07-18T09:26:45.113Z (4 months ago)
- Topics: epg, japanterebi, tv, xmltv
- Language: Python
- Homepage: https://animenosekai.github.io/japanterebi-xmltv/guide.xml
- Size: 5.19 GB
- Stars: 43
- Watchers: 4
- Forks: 6
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# japanterebi-xmltv

Easily create XMLTV files.
***Plan your watching journey!***
[](https://github.com/Animenosekai/japanterebi-xmltv/actions/workflows/update.yaml)
[](https://github.com/Animenosekai/japanterebi-xmltv/blob/master/LICENSE)
[](https://github.com/Animenosekai/japanterebi-xmltv)



## Usage
### API
You can use the [https://animenosekai.github.io/japanterebi-xmltv/guide.xml](https://animenosekai.github.io/japanterebi-xmltv/guide.xml) URL as an XMLTV source in any compatible software.
This pre-built XMLTV file contains EPG data for channels from Japan or with Japanese audio.
This file is updated every hour using [GitHub Actions](https://github.com/Animenosekai/japanterebi-xmltv/actions/workflows/update.yaml).
But you can also build your own XMLTV file using the different scripts provided in this repository.
### Pre-requisites
The different programs located in the [`scripts`](./scripts/) directory require Python 3.7 to run correctly.
The dependencies are listed in the `requirements.txt` file. You can install them by running:
```bash
python -m pip install -r requirements.txt --upgrade
```
It is recommended to use `git` to have the most up-to-date data from the upstream `iptv-org` database.
If you are cloning the repository using `git`, it is recommended to use the `--depth 1` option to only clone the latest commit, which will save you some bandwidth and disk space.
```bash
git clone --depth 1 https://github.com/Animenosekai/japanterebi-xmltv.git
```
### Scripts
#### Filter
The [`filter.py`](./scripts/filter.py) script filters the different channels from the [`iptv-org/database`](https://github.com/iptv-org/database) repository.
To download the repository, you can run the following command:
```bash
git clone --depth 1 -b main https://github.com/iptv-org/database.git
```
##### CLI
You can run the script with the following command:
```bash
python scripts/filter.py --channels --feeds
```
- [`database/data/channels.csv`](https://github.com/iptv-org/database/blob/master/data/channels.csv) is the path to the channels CSV file from the [`iptv-org/database`](https://github.com/iptv-org/database) repository.
- [`database/data/feeds.csv`](https://github.com/iptv-org/database/blob/master/data/feeds.csv) is the path to the feeds CSV file from the [`iptv-org/database`](https://github.com/iptv-org/database) repository.
You can specify :
- `--language` to filter the channels by language
- `--country` to filter the channels by country
- `--category` to filter the channels by category
You can use those options multiple times to filter the channels by multiple criteria.
The different filters add up, and a union is made between the different filters.
You can also directly use the `--add` or `--remove` options to add or remove channels IDs from the list.
Here is an example output :
```json
[
{
"id": "ABEMAAnime.jp",
"name": "ABEMA Anime",
"alt_names": [
"ABEMAアニメ"
],
"network": null,
"owners": [
"CyberAgent"
],
"country": "JP",
"subdivision": null,
"city": "Shibuya-ku",
"categories": [
"animation",
"kids"
],
"is_nsfw": false,
"launched": 1522533600.0,
"closed": null,
"replaced_by": null,
"website": "https://abema.tv/now-on-air/abema-anime?lang=en",
"logo": "https://image.p-c2-x.abema-tv.com/image/channels/abema-anime/logo.png?height=96&quality=75&version=20200413&width=256",
"feeds": [
"SD"
],
"has_main_feed": true
}
]
```
Here is the command used in the workflow:
##### Python
You can also use the script as a Python module. It provides a way to convert the CSV file to a list of [`Channel`](./scripts/model.py) objects, which can easily be manipulated.
#### Fetcher
The [`fetcher.py`](./scripts/fetcher.py) gathers the different EPG sites which can be used to create the final EPG.
You need to download the [`iptv-org/epg`](https://github.com/iptv-org/epg) repository to get the different EPG sites first.
```bash
git clone --depth 1 -b master https://github.com/iptv-org/epg.git
```
Then you can run the script with the following command:
```bash
python scripts/fetcher.py --input --sites epg/sites
```
The [`input_path.json`](./channels.json) file should contain the list of channels you want to fetch. It should be generated by the [`filter.py`](#filter) script.
Here is the command used in the workflow:
The output is an [XML file](./japanterebi.channels.xml) which can be used with the `grab` command from the [`iptv-org/epg`](https://github.com/iptv-org/epg) repository.
```bash
npm run grab -- --channels=
```
#### Fixer
Because sometimes the EPG sites return non-escaped `&` characters, the [`fix.py`](./scripts/fix.py) script fixes the XML file by correctly escaping those characters.
You can run the script with the following command:
```bash
python scripts/fix.py --input
```
Here is the command used in the workflow:
#### Merger
Because the `grab` command gathers information from different EPG sites, the final EPG has multiple redundant entries.
The [`merger.py`](./scripts/merger.py) script merges the different EPG entries into a single one.
You can run the script with the following command:
```bash
python scripts/merger.py --input
```
The [`input_path.xml`](./guide.xml) file should be the output of the `grab` command, or an equivalent XMLTV-formatted file.
Here is the command used in the workflow:
#### Minifier
The [`minify.py`](./scripts/minify.py) script simply minfies the XMLTV file.
You can run the script with the following command:
```bash
python scripts/minify.py --input
```
> [!NOTE]
> Note that it just removes empty lines for now.
Here is the command used in the workflow: