updated docs (#10)
+36 −2 · 2 files changed
-
README.md+35 −2 -
src/yt_playlist_export/yt_playlist_export.py+1 −0
@@ -12,7 +12,7 @@ python3 -m pip install yt-playlist-export ```bash {"id":"01J4HFTRJ1CK76GD127F41SF28"} yt-playlist-export -h -usage: yt-playlist-export [-h] [--browser BROWSER] [-f {csv,json}] [-o OUTPUT] [-v] playlist [playlist ...] +usage: yt-playlist-export [-h] [--browser BROWSER] [--cookies COOKIES] [-f {csv,json}] [-o OUTPUT] [-v] playlist [playlist ...] yt-playlist-export exports YouTube playlists to JSON or CSV @@ -22,6 +22,7 @@ positional arguments: optional arguments: -h, --help show this help message and exit --browser BROWSER browser where you logged in to YouTube + --cookies COOKIES absolute path to a Netscape formatted cookie file -f {csv,json}, --format {csv,json} output's format -o OUTPUT, --output OUTPUT @@ -29,10 +30,42 @@ optional arguments: -v, --verbose verbose ``` +### Use case: Exporting public playlist + +```bash +yt-playlist-export -f csv -o test.csv https://www.youtube.com/playlist?list=PLO4kDC0EWkeCnf8PBRk7XDPhrzmAxHLah +``` + +### Use case: Exporting using cookies from default browser (firefox) + +```bash +yt-playlist-export -f csv -o test.csv https://www.youtube.com/playlist?list=PLO4kDC0EWkeCnf8PBRk7XDPhrzmAxHLah +``` + +### Use case: Exporting using Chrome browser + +At the moment of writing this supported browsers are: firefox, safari, brave, chrome, chromium, edge, opera, vivaldi, whale. + +For the `--browser` agrument one can also pass `BROWSER[+KEYRING][:PROFILE][::CONTAINER]` as it's described in [yt-dlp](https://github.com/yt-dlp/yt-dlp) documentation. +Check out `--cookies-from-browser` option in yt-dlp documentation to understand how it works. + +```bash +yt-playlist-export --browser chrome -f csv -o test.csv https://www.youtube.com/playlist?list=PLO4kDC0EWkeCnf8PBRk7XDPhrzmAxHLah +``` + +### Use case: Exporting using cookie file + +The cookie file must be in a Netscape format. You can follow [this guide](https://github.com/yt-dlp/yt-dlp/issues/10927) and use [this extension](https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc) for Chrome. + +```bash +yt-playlist-export --cookies /home/daydiff/cookie.txt -f csv -o test.csv https://www.youtube.com/playlist?list=PLO4kDC0EWkeCnf8PBRk7XDPhrzmAxHLah +``` + + ## Show case ```bash {"id":"01J4HFTRJ1CK76GD127FGZF1W0"} -yt-playlist-export https://www.youtube.com/playlist\?list\=PL0XfG7TzasxNCl8a-SdyvSoazX1VYBweF -f csv -o test.csv +yt-playlist-export https://www.youtube.com/playlist?list=PLO4kDC0EWkeCnf8PBRk7XDPhrzmAxHLah ```  @@ -93,6 +93,7 @@ def print_json(info: any): f.write(json.dumps(info)) def parse_browser_arg(cookiesfrombrowser): + # taken from yt-dlp: https://github.com/yt-dlp/yt-dlp/blob/6ca23ffaa4663cb552f937f0b1e9769b66db11bd/yt_dlp/__init__.py#L382-L402 if cookiesfrombrowser: container = None mobj = re.fullmatch(r'''(?x)