Package: youtube2zim
Youtube2zimyoutube2zimallows you to create aZIM filefrom a Youtube Channel/Username or one-or-more Playlists.It downloads the video (webmormp4extension – optionnaly
recompress them in lower-quality, smaller size), the thumbnails, the
subtitles and the authors' profile pictures ; then, it create a static
HTML files folder of it before creating a ZIM off of it.Requirementsffmpegfor video transcoding (only used with--lower-quality).curlandunzipto install Javascript dependencies. Seeget_js_deps.shif you want to do it manually.InstallationHere comes a few different ways to installyoutube2zim.Virtualenvyoutube2zimis a Python3 software. If you are not using theDockerimage, you are advised to use it in avirtualenvto avoid installing software
dependences on your system.virtualenv-ppython3./# Create virtualenvsourcebin/activate# Activate the virtualenvpip3installyoutube2zim# Install dependenciesyoutube2zim--help# Display youtube2zim helpAt the end, calldeactivateto quit the virtual environment.Seepyproject.tomlfor the list of python dependencies.Dockerdockerrun-vmy_dir:/outputghcr.io/openzim/youtubeyoutube2zim--helpGlobally (on GNU/Linux)sudopip3install-Uyoutube2zimUsageyoutube2zimuses Youtube API v3 to fetch data from Youtube. You thus need to provide anAPI_KEYto use the scraper.To get an API:Connect toGoogle Developers ConsoleCreate a newProjectthen Select it.When asked, chooseCreate Credentialsand select theAPI Keytype. (Credentials page)youtube2zim--api-key"<your-api-key>"--typeuser--id"Vsauce"--name"vsauce"NotesYour API_KEY is subject to usage quotas (10,000 requests/day) so use--only_test_brandingwhen adjusting parameters and branding to notwaste your quota.If you encounter issues reading ZIM files created using this scraper, please take a look at theCompatibility Matrixbefore opening a ticket.youtube2zim-playlistsyoutube2zimproduces a single ZIM file for a youtube request (channel,user,playlist).youtube2zim-playlistsallows you to ** automatically create one ZIM file per playlist** of a given channel or user instead.This script is a wrapper aroundyoutube2zimand is bundled with the main package.The difference between a channel and a user is due to Youtube legacy. Some old users have to be searched as a user, while more recent ones have to be searched as a channel. Try your best bet, and if it fails try the ohter type.Usageyoutube2zim-playlists --helpSample usage:youtube2zim-playlists --indiv-playlists --api-key XXX --type user --id Vsauce --playlists-name="vsauce_en_playlist-{playlist_id}"Those are the required arguments foryoutube2zim-playlistsbutyou can also pass any regularyoutube2zimargument. Those will be forwarded toyoutube2zim(which will be run independently for each playlist).Specificities:--titleand--descriptionare mutually exclusive with--playlists-titleand--playlists-description.If using--titleor--description, all your playlists ZIMs will have the same, static metadata. This is rarely wanted.--playlists-titleand--playlists-descriptionallows you to dynamically customize them via some playlist-related variables:{title}: the playlist title{description}: the playlist description{slug}: slugified version of the playlist title{playlist_id}: playlist ID on youtube{creator_id}: playlist's owner channel/user ID.{creator_name}: playlist's owner channel/user name.You can omit them andyoutube2zimwill auto-generate those.youmust specify--playlists-name(supports variables listed above).--playlists-nameis used to set theNamemetadata of the ZIM (should be unique) and if not set separately, the output file name for the ZIM.--metadata-fromallows to specify a path or URL to a JSON file specifying custom static metadata for individual playlists. Format:{"<playlist-id>":{"name":"","zim-file":"","title":"","description":"","tags":"","creator":"","profile":"","banner":""}}All fields are optional and taken from command-line/default if not found.<playlist-id>represents the Youtube Playlist ID.If you feel the need for setting additional details in this file, chances are you should runyoutube2zimindependently for that playlist (still possible!)DevelopmentBefore contributing be sure to check out theCONTRIBUTING.mdguidelines.LicenseGPLv3or later, seeLICENSEfor more details.