youtube2zim


Nameyoutube2zim JSON
Version 3.3.0 PyPI version JSON
download
home_pageNone
SummaryMake ZIM file from a Youtube channel, user or playlist(s)
upload_time2024-12-05 14:12:54
maintainerNone
docs_urlNone
authorNone
requires_python<3.13,>=3.12
licenseGPL-3.0-or-later
keywords offline openzim youtube zim
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Youtube2zim
=============

[![CodeFactor](https://www.codefactor.io/repository/github/openzim/youtube/badge)](https://www.codefactor.io/repository/github/openzim/youtube)
[![Docker](https://ghcr-badge.egpl.dev/openzim/youtube/latest_tag?label=docker)](https://ghcr.io/openzim/youtube)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![PyPI version shields.io](https://img.shields.io/pypi/v/youtube2zim.svg)](https://pypi.org/project/youtube2zim/)

`youtube2zim` allows you to create a [ZIM file](https://openzim.org)
from a Youtube Channel/Username or one-or-more Playlists.

It downloads the videos (`webm` or `mp4` extension – optionally
recompress them in lower-quality, smaller size), the thumbnails, the
subtitles and the authors' profile pictures; It then produces JSON files containing content for the channel, playlists, and videos, which are used by the UI, which is a Vue.js application that needs to be compiled as a static website with Vite and is then embedded inside the ZIM.

`youtube2zim` adheres to openZIM's [Contribution Guidelines](https://github.com/openzim/overview/wiki/Contributing).

`youtube2zim` has implemented openZIM's [Python bootstrap, conventions and policies](https://github.com/openzim/_python-bootstrap/blob/main/docs/Policy.md) **v1.0.2**.

# Documentation

For more details / advanced usage than what is in this README, see the [Manual](https://github.com/openzim/youtube/wiki/Manual) and [FAQ/FEE](https://github.com/openzim/youtube/wiki/FAQ---FEE).

# Requirements

* [`ffmpeg`](https://ffmpeg.org/) for video transcoding.
* [`Yarn`](https://yarnpkg.com/getting-started/install) to install Javascript dependencies for the Vue.js UI.

# Installation

Here comes a few different ways to install `youtube2zim`.

## Virtualenv

`youtube2zim` is a Python3 software. If you are not using the [Docker](https://docker.com) image,
you are advised to use it in a [virtualenv](https://virtualenv.pypa.io) to avoid installing software
dependencies on your system. [Hatch](https://hatch.pypa.io/) is the proper tool to create the
virtualenv and install the software locally. Ensure to use proper Python version as well (see
pyproject.toml).

If you do not already have it on your system, install hatch to build the software and manage virtual
environments (you might be interested by our detailed
[Developer Setup](https://github.com/openzim/_python-bootstrap/blob/main/docs/Developer-Setup.md) as well,
especially regarding how to configure hatch globally for proper detection of its virtual environments
by Visual Studio Code).

``` bash
pip3 install hatch
```

Start a hatch shell: this will install software including dependencies in an isolated virtual environment.

``` bash
cd scraper
hatch shell
```

```bash
youtube2zim --help       # Display youtube2zim help
```

## Docker

```bash
docker run -v my_dir:/output ghcr.io/openzim/youtube youtube2zim --help
```

# Usage

`youtube2zim` uses Youtube API v3 to fetch data from Youtube. You thus need to provide an `API_KEY` to use the scraper.

To get an API Key:

1. Connect to [Google Developers Console](https://console.developers.google.com/apis)
2. Create a new _Project_ then Select it.
3. When asked, choose _Create Credentials_ and select the **API Key** type. ([Credentials page](https://console.developers.google.com/apis/credentials))

You can then create a ZIM from a singe channel / user / handle like `Vsauce`:

```bash
youtube2zim --api-key "<your-api-key>" --id "Vsauce" --name "tests_hi_avanti"
```

When scraping a channel, you must pass one single value in `--id` and it can be the handle, user, or even the corresponding technical ID (see [FAQ/FEE](https://github.com/openzim/youtube/wiki/FAQ---FEE) for more details).

Or you can create a ZIM from two playlists like `PL3rEvTTL-Jm8cBdskZoQaDTlDT4t7F6kp` and `PL3rEvTTL-Jm_OuyYpMfxtJW3Mcr9fFS2Z`:

```bash
youtube2zim --api-key "<your-api-key>" --id "PL3rEvTTL-Jm8cBdskZoQaDTlDT4t7F6kp,PL3rEvTTL-Jm_OuyYpMfxtJW3Mcr9fFS2Z" --name "tests_hi_avanti"
```

When scraping playlists, you can pass multiple playlist IDs separated by a comma in `--id`.

For more details / advanced usage, see the [Manual](https://github.com/openzim/youtube/wiki/Manual).

## Notes

* Your API_KEY is subject to usage quotas (10,000 requests/day by default). Be careful to not waste your quota, especially when scraping large channels.

# youtube2zim-playlists

`youtube2zim` produces a single ZIM file for a youtube request (`channel`, `user`, `handle`, `playlist`).

`youtube2zim-playlists` allows you to **automatically create one ZIM file per playlist** of a given channel or user instead.

This script is a wrapper around `youtube2zim` and is bundled with the main package.

## Usage

Sample usage:

```
youtube2zim-playlists --indiv-playlists --api-key XXX --id Vsauce --playlists-name="vsauce_en_playlist-{playlist_id}"
```

Those are the required arguments for `youtube2zim-playlists` but **you can also pass any regular `youtube2zim` argument**. Those will be forwarded to `youtube2zim` (which will be run independently for each playlist).

For more details / advanced usage, see the [Manual](https://github.com/openzim/youtube/wiki/Manual).

# Development

Before contributing be sure to check out the
[CONTRIBUTING.md](CONTRIBUTING.md) guidelines.

# License

[GPLv3](https://www.gnu.org/licenses/gpl-3.0) or later, see
[LICENSE](LICENSE) for more details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "youtube2zim",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.12",
    "maintainer_email": null,
    "keywords": "offline, openzim, youtube, zim",
    "author": null,
    "author_email": "openZIM <dev@openzim.org>",
    "download_url": "https://files.pythonhosted.org/packages/56/61/520d611dc007902e3d1058bcd9f2a05b574a88192742b61e671cb563ffac/youtube2zim-3.3.0.tar.gz",
    "platform": null,
    "description": "Youtube2zim\n=============\n\n[![CodeFactor](https://www.codefactor.io/repository/github/openzim/youtube/badge)](https://www.codefactor.io/repository/github/openzim/youtube)\n[![Docker](https://ghcr-badge.egpl.dev/openzim/youtube/latest_tag?label=docker)](https://ghcr.io/openzim/youtube)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![PyPI version shields.io](https://img.shields.io/pypi/v/youtube2zim.svg)](https://pypi.org/project/youtube2zim/)\n\n`youtube2zim` allows you to create a [ZIM file](https://openzim.org)\nfrom a Youtube Channel/Username or one-or-more Playlists.\n\nIt downloads the videos (`webm` or `mp4` extension \u2013 optionally\nrecompress them in lower-quality, smaller size), the thumbnails, the\nsubtitles and the authors' profile pictures; It then produces JSON files containing content for the channel, playlists, and videos, which are used by the UI, which is a Vue.js application that needs to be compiled as a static website with Vite and is then embedded inside the ZIM.\n\n`youtube2zim` adheres to openZIM's [Contribution Guidelines](https://github.com/openzim/overview/wiki/Contributing).\n\n`youtube2zim` has implemented openZIM's [Python bootstrap, conventions and policies](https://github.com/openzim/_python-bootstrap/blob/main/docs/Policy.md) **v1.0.2**.\n\n# Documentation\n\nFor more details / advanced usage than what is in this README, see the [Manual](https://github.com/openzim/youtube/wiki/Manual) and [FAQ/FEE](https://github.com/openzim/youtube/wiki/FAQ---FEE).\n\n#\u00a0Requirements\n\n* [`ffmpeg`](https://ffmpeg.org/) for video transcoding.\n* [`Yarn`](https://yarnpkg.com/getting-started/install) to install Javascript dependencies for the Vue.js UI.\n\n# Installation\n\nHere comes a few different ways to install `youtube2zim`.\n\n## Virtualenv\n\n`youtube2zim` is a Python3 software. If you are not using the [Docker](https://docker.com) image,\nyou are advised to use it in a [virtualenv](https://virtualenv.pypa.io) to avoid installing software\ndependencies on your system. [Hatch](https://hatch.pypa.io/) is the proper tool to create the\nvirtualenv and install the software locally. Ensure to use proper Python version as well (see\npyproject.toml).\n\nIf you do not already have it on your system, install hatch to build the software and manage virtual\nenvironments (you might be interested by our detailed\n[Developer Setup](https://github.com/openzim/_python-bootstrap/blob/main/docs/Developer-Setup.md) as well,\nespecially regarding how to configure hatch globally for proper detection of its virtual environments\nby Visual Studio Code).\n\n``` bash\npip3 install hatch\n```\n\nStart a hatch shell: this will install software including dependencies in an isolated virtual environment.\n\n``` bash\ncd scraper\nhatch shell\n```\n\n```bash\nyoutube2zim --help       # Display youtube2zim help\n```\n\n## Docker\n\n```bash\ndocker run -v my_dir:/output ghcr.io/openzim/youtube youtube2zim --help\n```\n\n# Usage\n\n`youtube2zim` uses Youtube API v3 to fetch data from Youtube. You thus need to provide an `API_KEY` to use the scraper.\n\nTo get an API Key:\n\n1. Connect to [Google Developers Console](https://console.developers.google.com/apis)\n2. Create a new _Project_ then Select it.\n3. When asked, choose _Create Credentials_ and select the **API Key** type. ([Credentials page](https://console.developers.google.com/apis/credentials))\n\nYou can then create a ZIM from a singe channel / user / handle like `Vsauce`:\n\n```bash\nyoutube2zim --api-key \"<your-api-key>\" --id \"Vsauce\" --name \"tests_hi_avanti\"\n```\n\nWhen scraping a channel, you must pass one single value in `--id` and it can be the handle, user, or even the corresponding technical ID (see [FAQ/FEE](https://github.com/openzim/youtube/wiki/FAQ---FEE) for more details).\n\nOr you can create a ZIM from two playlists like `PL3rEvTTL-Jm8cBdskZoQaDTlDT4t7F6kp` and `PL3rEvTTL-Jm_OuyYpMfxtJW3Mcr9fFS2Z`:\n\n```bash\nyoutube2zim --api-key \"<your-api-key>\" --id \"PL3rEvTTL-Jm8cBdskZoQaDTlDT4t7F6kp,PL3rEvTTL-Jm_OuyYpMfxtJW3Mcr9fFS2Z\" --name \"tests_hi_avanti\"\n```\n\nWhen scraping playlists, you can pass multiple playlist IDs separated by a comma in `--id`.\n\nFor more details / advanced usage, see the [Manual](https://github.com/openzim/youtube/wiki/Manual).\n\n## Notes\n\n* Your API_KEY is subject to usage quotas (10,000 requests/day by default). Be careful to not waste your quota, especially when scraping large channels.\n\n# youtube2zim-playlists\n\n`youtube2zim` produces a single ZIM file for a youtube request (`channel`, `user`, `handle`, `playlist`).\n\n`youtube2zim-playlists` allows you to **automatically create one ZIM file per playlist** of a given channel or user instead.\n\nThis script is a wrapper around `youtube2zim` and is bundled with the main package.\n\n## Usage\n\nSample usage:\n\n```\nyoutube2zim-playlists --indiv-playlists --api-key XXX --id Vsauce --playlists-name=\"vsauce_en_playlist-{playlist_id}\"\n```\n\nThose are the required arguments for `youtube2zim-playlists` but **you can also pass any regular `youtube2zim` argument**. Those will be forwarded to `youtube2zim` (which will be run independently for each playlist).\n\nFor more details / advanced usage, see the [Manual](https://github.com/openzim/youtube/wiki/Manual).\n\n# Development\n\nBefore contributing be sure to check out the\n[CONTRIBUTING.md](CONTRIBUTING.md) guidelines.\n\n# License\n\n[GPLv3](https://www.gnu.org/licenses/gpl-3.0) or later, see\n[LICENSE](LICENSE) for more details.\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "Make ZIM file from a Youtube channel, user or playlist(s)",
    "version": "3.3.0",
    "project_urls": {
        "Donate": "https://www.kiwix.org/en/support-us/",
        "Homepage": "https://www.kiwix.org"
    },
    "split_keywords": [
        "offline",
        " openzim",
        " youtube",
        " zim"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c016c0a5d08485b369325263cfa881a89001b3103071abfab56da5980ce9e46",
                "md5": "5e37b5cdb505cc43b083dd95b45ee204",
                "sha256": "2c14405fc7156a5a445f70d6db5294d0eacea77117354a8b84ce7bbea7e0f5e9"
            },
            "downloads": -1,
            "filename": "youtube2zim-3.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5e37b5cdb505cc43b083dd95b45ee204",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.12",
            "size": 29427,
            "upload_time": "2024-12-05T14:12:52",
            "upload_time_iso_8601": "2024-12-05T14:12:52.035310Z",
            "url": "https://files.pythonhosted.org/packages/0c/01/6c0a5d08485b369325263cfa881a89001b3103071abfab56da5980ce9e46/youtube2zim-3.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5661520d611dc007902e3d1058bcd9f2a05b574a88192742b61e671cb563ffac",
                "md5": "04a6f022d3b9ccdd33188364f84cc822",
                "sha256": "8fff1b3d1efa5bb80458092968127a93fb7a80e234c61939a9ed02e06c2c827e"
            },
            "downloads": -1,
            "filename": "youtube2zim-3.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "04a6f022d3b9ccdd33188364f84cc822",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.12",
            "size": 34576,
            "upload_time": "2024-12-05T14:12:54",
            "upload_time_iso_8601": "2024-12-05T14:12:54.059090Z",
            "url": "https://files.pythonhosted.org/packages/56/61/520d611dc007902e3d1058bcd9f2a05b574a88192742b61e671cb563ffac/youtube2zim-3.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-05 14:12:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "youtube2zim"
}
        
Elapsed time: 0.40955s