pip installation (#1)
Co-authored-by: Aleksandr Tabakov <alex.daymon+gitlab@gmail.com>
+93 −15 · 7 files changed
-
.gitignore+3 −0 -
LICENSE+24 −0 -
README.md+4 −7 -
pyproject.toml+45 −0 -
src/yt_playlist_export/__init__.py+5 −0 -
src/yt_playlist_export/__main__.py+3 −0 -
yt-playlist-export.py => src/yt_playlist_export/yt_playlist_export.py+9 −8
@@ -1 +1,4 @@ .etc +__pycache__ +dist +venv @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to <http://unlicense.org/> @@ -4,15 +4,13 @@ yt-playlist-export is a tool that allows to export YouTube playlists, export You ## Installation -```bash -git clone https://github.com/daydiff/yt-playlist-export.git -cd yt-playlist-export -python3 -m pip install -r requirements.txt +```bash {"id":"01J4HFTRJ1CK76GD127E1R65GX"} +python3 -m pip install yt-playlist-export ``` ## Usage -```bash +```bash {"id":"01J4HFTRJ1CK76GD127F41SF28"} yt-playlist-export -h usage: yt-playlist-export [-h] [--browser BROWSER] [-f {csv,json}] [-o OUTPUT] [-v] playlist [playlist ...] @@ -33,13 +31,12 @@ optional arguments: ## Show case -```bash +```bash {"id":"01J4HFTRJ1CK76GD127FGZF1W0"} yt-playlist-export https://www.youtube.com/playlist\?list\=PL0XfG7TzasxNCl8a-SdyvSoazX1VYBweF -f csv -o test.csv ```  - ## Dependencies yt-playlist-export is using [yt-dlp](https://github.com/yt-dlp) under the hood. @@ -0,0 +1,45 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "yt-playlist-export" +version = "0.0.1" +authors = [ + { name="Aleksandr Tabakov", email="info@atabakoff.com" }, +] +description = "yt-playlist-export is a tiny Python tool that allows to export private YouTube playlists, export YouTube's \"Watch later\" list and export YouTube \"Liked videos\"" +readme = "README.md" +requires-python = ">=3.8" +keywords = [ + "youtube", + "youtube-playlist", + "youtube-playlist-backup", + "youtube-playlist-export ", +] +license = {file = "LICENSE"} +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: The Unlicense (Unlicense)", + "Operating System :: OS Independent", +] +dependencies = [ + "yt-dlp" +] + +[project.urls] +Homepage = "https://github.com/daydiff/yt-playlist-export" +Issues = "https://github.com/daydiff/yt-playlist-export/issues" + +[project.scripts] +yt-playlist-export = "yt_playlist_export:main" + + +[tool.hatch.build.targets.sdist] +include = [ + "/src", + "/.gitignore", # included by default, needed for auto-excludes + "/LICENSE", # included as license + "/pyproject.toml", # included by default + "/README.md", # included as readme +] @@ -0,0 +1,5 @@ +from .yt_playlist_export import main + +__all__ = [ + "main" +] @@ -0,0 +1,3 @@ +if __name__ == "__main__": + from yt_playlist_export import main + main() @@ -97,11 +97,12 @@ ydl_opts = { 'quiet': not verbose } -with yt_dlp.YoutubeDL(ydl_opts) as ydl: - info = ydl.extract_info(playlist, download=False) - # ydl.sanitize_info makes the info json-serializable - info_sanitized = ydl.sanitize_info(info) - if format == 'json': - print_json(info_sanitized) - else: - print_csv(info_sanitized) +def main(): + with yt_dlp.YoutubeDL(ydl_opts) as ydl: + info = ydl.extract_info(playlist, download=False) + # ydl.sanitize_info makes the info json-serializable + info_sanitized = ydl.sanitize_info(info) + if format == 'json': + print_json(info_sanitized) + else: + print_csv(info_sanitized)