Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
31124cb
Create piped_libretube_playlists.py
thetechstoner May 14, 2025
b9abc31
Update README.md
thetechstoner May 14, 2025
9337f4e
Update README.md
thetechstoner May 14, 2025
cae34f3
Update README.md
thetechstoner May 14, 2025
d8a66a0
Update README.md
thetechstoner May 14, 2025
5145b9c
Update README.md
thetechstoner May 14, 2025
729d9c1
Update README.md
thetechstoner May 14, 2025
36723e5
Update README.md
thetechstoner May 14, 2025
948c906
Update README.md
thetechstoner May 14, 2025
bdbbde3
Update piped_libretube_playlists.py
thetechstoner May 14, 2025
0f67b70
Create playlists-convert-freetube
thetechstoner May 16, 2025
4cf0f73
Update playlists-convert-freetube
thetechstoner May 16, 2025
9d49132
Update playlists-convert-freetube
thetechstoner May 16, 2025
138efb5
Update README.md
thetechstoner May 16, 2025
b3d5b3b
Update piped_libretube_playlists.py
thetechstoner May 16, 2025
d6432ce
Update README.md
thetechstoner May 16, 2025
1494cf9
Create playlists-convert-freetube.py
thetechstoner May 16, 2025
672069b
Delete Script/playlists-convert-freetube
thetechstoner May 16, 2025
136c386
Update playlists-convert-freetube.py
thetechstoner May 16, 2025
4ffbca4
Delete Script/piped_libretube_playlists.py
thetechstoner May 16, 2025
65f7921
Add files via upload
thetechstoner May 16, 2025
cbde09b
Update README.md
thetechstoner May 16, 2025
61d7063
Update README.md
thetechstoner May 16, 2025
d83cfd0
Update README.md
thetechstoner May 16, 2025
39f4331
Update README.md
thetechstoner May 16, 2025
77317fd
Update README.md
thetechstoner May 16, 2025
9af0f15
Update README.md
thetechstoner May 16, 2025
bd6834e
Update README.md
thetechstoner May 16, 2025
5e15fc7
Update README.md
thetechstoner May 16, 2025
ef54d6f
Update README.md
thetechstoner May 16, 2025
664cc8c
Update README.md
thetechstoner May 16, 2025
2dd2719
Update README.md
thetechstoner May 16, 2025
2b612fd
Add files via upload
thetechstoner May 17, 2025
263ee49
Update README.md
thetechstoner May 17, 2025
a07b6f1
Update README.md
thetechstoner May 17, 2025
9391c0d
Update README.md
thetechstoner May 18, 2025
ccd54d4
Update README.md
thetechstoner May 18, 2025
88415d8
Create playlists-convert-freetube-to-piped.py
thetechstoner May 24, 2025
bb81c13
Update README.md
thetechstoner May 24, 2025
3e8fa77
Update README.md
thetechstoner May 24, 2025
fcf7352
Update README.md
thetechstoner May 24, 2025
918a12c
Update README.md
thetechstoner May 24, 2025
c3eb5ee
Update README.md
thetechstoner Oct 24, 2025
fa7bfe4
Update README.md
thetechstoner Oct 24, 2025
1832088
Update README.md
thetechstoner Oct 24, 2025
dc80b7d
Create playlists-convert-grayjay.py
thetechstoner Oct 26, 2025
143a770
Create playlists-convert-freetube-to-grayjay.py
thetechstoner Oct 26, 2025
2b4413b
Create playlists-convert-grayjay-to-freetube.py
thetechstoner Oct 26, 2025
3c49f5e
Update README.md
thetechstoner Oct 26, 2025
b988ce7
Update README.md
thetechstoner Oct 26, 2025
dd6bd0c
Update README.md
thetechstoner Oct 26, 2025
a0e13c9
Update README.md
thetechstoner Oct 26, 2025
494d927
Update README.md
thetechstoner Oct 26, 2025
671a6a0
Update README.md
thetechstoner Oct 27, 2025
c686eca
Delete Script/playlists-convert-freetube-to-grayjay.py
thetechstoner Oct 27, 2025
85f73bc
Delete Script/playlists-convert-grayjay-to-freetube.py
thetechstoner Oct 27, 2025
b9fca7c
Delete Script/playlists-convert-piped-to-freetube.py
thetechstoner Oct 27, 2025
f3f1309
Delete Script/playlists-convert-freetube-to-piped.py
thetechstoner Oct 27, 2025
5b8fc2b
Delete Script/playlists-convert-piped.py
thetechstoner Nov 6, 2025
a723f06
Delete Script/playlists-convert-grayjay.py
thetechstoner Nov 6, 2025
8ca5500
Delete Script/playlists-convert-freetube.py
thetechstoner Nov 6, 2025
c82851e
Update main.py local and remote playlists to playlists.csv
thetechstoner Nov 6, 2025
5ab8c0f
Add files via upload
thetechstoner Nov 6, 2025
ee15685
Add files via upload
thetechstoner Nov 6, 2025
3088abb
Add files via upload
thetechstoner Nov 6, 2025
c21c4a7
Update README.md
thetechstoner Nov 6, 2025
7244178
Update README.md
thetechstoner Nov 6, 2025
5799514
Update README.md
thetechstoner Nov 6, 2025
623fccc
Update README.md
thetechstoner Nov 6, 2025
c6573da
Update README.md
thetechstoner Nov 6, 2025
2102a55
Update README.md
thetechstoner Nov 6, 2025
81a351e
Update README.md
thetechstoner Nov 6, 2025
a447fdb
Update README.md
thetechstoner Nov 6, 2025
1df4bd7
Add files via upload
thetechstoner Nov 10, 2025
3359cfe
Update freetube-convert-playlists.py
thetechstoner Nov 11, 2025
1dfd5a7
Update playlists-convert-grayjay.py
thetechstoner Nov 12, 2025
02c9927
Update README.md
thetechstoner Nov 12, 2025
c0fb26e
Update README.md
thetechstoner Nov 12, 2025
9bcacf2
Update README.md
thetechstoner Nov 12, 2025
8709070
Add files via upload
thetechstoner Nov 12, 2025
184a16d
Update README.md
thetechstoner Nov 12, 2025
32cc685
Update playlists-convert-grayjay.py
thetechstoner Nov 13, 2025
bad0cf6
Update README.md
thetechstoner Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ When you create a playlist in NewPipe it is not saved as a YouTube playlist and

[Stargazers over time](https://starchart.cc/Quasolaris/NewPipePlaylistExtractor)


### Note: To use script on Windows or Android please see instructions below
### Note: MacOS users, you can follow the Linux guide

Expand All @@ -28,7 +27,6 @@ When you create a playlist in NewPipe it is not saved as a YouTube playlist and
8. [GUI](https://github.com/Quasolaris/NewPipePlaylistExtractor#gui)
9. [Errors and Troubleshooting](https://github.com/Quasolaris/NewPipePlaylistExtractor#errors-and-troubleshooting)


## Features
- Download all playlists with chosen audio codec
- Downloads single playlist with chosen audio codec
Expand All @@ -37,7 +35,9 @@ When you create a playlist in NewPipe it is not saved as a YouTube playlist and
- Export playlists as a Markdown file
- Export playlists as a M3U8 file
- Output is coloured (Because colours are fun!)

- playlists.csv to freetube-playlists.db,grayjay-export.zip,playlists-piped.json or newpipedata.zip and back to playlists.csv
- only newpipe can bookmark remote playlists
- no local playlists private video support

## Codecs
The script supports the following codecs:
Expand All @@ -49,10 +49,11 @@ The script supports the following codecs:
- mp4

## Dependencies
- [pytubefix](https://pypi.org/project/pytubefix/) ``pip3 install pytubefix``
- [db-sqlite3](https://pypi.org/project/db-sqlite3/) ``pip3 install db-sqlite3``
- [pydub](https://pypi.org/project/pydub/) ``pip3 install pydub``
- [ffmpeg](https://ffmpeg.org/) ``sudo apt install ffmpeg``
- ``pip3 install pytubefix db-sqlite3 pydub audioop-lts yt_dlp``
- ``sudo apt install ffmpeg``
- [pytubefix](https://pypi.org/project/pytubefix/) [db-sqlite3](https://pypi.org/project/db-sqlite3/)
[pydub](https://pypi.org/project/pydub/)
[ffmpeg](https://ffmpeg.org/)
- The codec you want to download has to be installed on your machine

## Usage
Expand All @@ -64,8 +65,21 @@ The script supports the following codecs:
- Follow instructions
- To update playlists just repeat with new .db or .zip file. Already downloaded files will be ignored
- Enjoy your music!

The playlists get saved into the /Script/Playlists folder
- The playlists get saved into the /Script/Playlists folder
- *
- python3 freetube-convert-playlists.py freetube-playlists.db playlists.csv
- python3 piped-convert-playlists.py playlists-piped.json playlists.csv
- python3 grayjay-convert-playlists.py grayjay-export.zip playlists.csv
- python3 newpipe-convert-playlists.py newpipe.db playlists.csv
- python3 newpipe-convert-playlists.py NewPipeData.zip playlists.csv
- *
- python3 playlists-convert-freetube.py playlists.csv freetube-playlists.db
- python3 playlists-convert-piped.py playlists.csv playlists-piped.json
- python3 playlists-convert-grayjay.py Grayjay-Zip-Template.zip playlists.csv grayjay-export.zip
- python3 playlists-convert-newpipe.py NewPipeData-Zip-Template.zip playlists.csv NewPipeData.zip
- *
- python3 newpipedb-export-csv.py newpipe.db output-csv-folder
- python3 structure-overview-zip.py archive.zip structure-overview.txt

## Linux
Install the dependencies and you are good to go.
Expand Down
Binary file added Script/Grayjay-Zip-Template.zip
Binary file not shown.
Binary file added Script/NewPipeData-Zip-Template.zip
Binary file not shown.
54 changes: 54 additions & 0 deletions Script/freetube-convert-playlists.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env python3

# freetube-convert-playlists.py
#
# Read each playlist line from FreeTube's JSON lines db.
# Extract the video IDs and build YouTube watch URLs.
# Save as CSV with playlist name and a Python list string of URLs.
#
# Usage Example:
# python3 freetube-convert-playlists.py freetube-playlists.db playlists.csv
#
# - The first argument is the input freetube database file.
# - The second argument is the output playlists CSV file.

import json
import csv
import sys

def freetube_to_csv(in_db, out_csv):
with open(in_db, "r", encoding="utf-8") as f_in, \
open(out_csv, "w", newline="", encoding="utf-8") as f_out:
writer = csv.writer(f_out)
# No header to match CSV format

for line in f_in:
line = line.strip()
if not line:
continue
playlist = json.loads(line)
name = playlist.get("playlistName", "")
videos = playlist.get("videos", [])
urls = [video.get("videoId") and f"https://www.youtube.com/watch?v={video.get('videoId')}"
for video in videos if video.get("videoId")]

# Skip empty Favorites or Watch Later playlists
if name in ("Favorites", "Watch Later") and not urls:
continue

# Write playlist name and Python-style list string of video URLs
writer.writerow([name, str(urls)])

def main():
if len(sys.argv) < 3:
print("Usage: python3 freetube-convert-playlists.py freetube-playlists.db playlists.csv")
sys.exit(1)

in_db = sys.argv[1]
out_csv = sys.argv[2]

freetube_to_csv(in_db, out_csv)
print(f"Converted {in_db} to {out_csv}.")

if __name__ == "__main__":
main()
72 changes: 72 additions & 0 deletions Script/grayjay-convert-playlists.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env python3

# grayjay-convert-playlists.py
#
# extracts the zipped GrayJay export
# reads its playlists content and groups videos by playlist name
# writes to CSV matching playlist CSV format
#
# Usage Example:
# python3 grayjay-convert-playlists.py grayjay-export.zip playlists.csv
#
# - The first argument is the input grayjay-export ZIP archive.
# - The second argument is the output playlists CSV file.

import zipfile
import os
import json
import csv
import sys
import tempfile

def grayjay_zip_to_csv(zip_path, csv_path):
with tempfile.TemporaryDirectory() as tmpdir:
# Extract the zip
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(tmpdir)

# Path to playlists file inside unzipped folder
playlists_file = os.path.join(tmpdir, "stores", "Playlists")

# Read playlists entries
if not os.path.exists(playlists_file):
print(f"Error: Playlists file {playlists_file} not found in zip")
return

with open(playlists_file, "r", encoding="utf-8") as f:
playlists_data = json.load(f)

with open(csv_path, "w", newline="", encoding="utf-8") as csvfile:
writer = csv.writer(csvfile)
# No header row for consistency

# playlists_data is a list of strings each like "playlistname:::uuid\nurl"
# Group by playlist name into list of URLs
playlist_map = {}
for entry in playlists_data:
try:
header, url = entry.split("\n", 1)
# header format: playlistname:::uuid
playlist_name = header.split(":::")[0]
playlist_map.setdefault(playlist_name, []).append(url.strip())
except Exception as e:
print(f"Error parsing entry: {entry}, {e}")
continue

# Write each playlist as: name, Python list string of URLs
for pname, urls in playlist_map.items():
writer.writerow([pname, str(urls)])

def main():
if len(sys.argv) != 3:
print("Usage: python3 grayjay-convert-playlists.py grayjay-export.zip playlists.csv")
sys.exit(1)

zip_path = sys.argv[1]
csv_path = sys.argv[2]

grayjay_zip_to_csv(zip_path, csv_path)
print(f"Converted {zip_path} to {csv_path}")

if __name__ == "__main__":
main()
Loading