first commit
This commit is contained in:
commit
2494a08568
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
|
||||
!/main.py
|
||||
!/.gitignore
|
28
main.py
Executable file
28
main.py
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/python3
|
||||
import regex,json
|
||||
|
||||
playlists={"format":"Piped","version":1,"playlists":[]}
|
||||
|
||||
eingabe=""
|
||||
while not eingabe == "q":
|
||||
eingabe=input("('q' to quit)\nEnter the name of your playlist: ")
|
||||
if eingabe == "q":
|
||||
break
|
||||
|
||||
linkfile=open('links.txt', 'r')
|
||||
links=[]
|
||||
for link in linkfile.readlines():
|
||||
link=link.rstrip()
|
||||
if not regex.match('^http(s)?:\/\/(www\.youtube\.com\/watch\?v=|youtu\.be\/)[-\w]{10,}', link):
|
||||
print(f"SKIP: {link}")
|
||||
continue
|
||||
print(link)
|
||||
links.append(link)
|
||||
playlist={"name":eingabe,"type":"playlist","visibility":"private","videos":links}
|
||||
playlists["playlists"].append(playlist)
|
||||
print(f"Added: {eingabe}")
|
||||
linkfile.close()
|
||||
|
||||
playfile=open("playlists.json","w")
|
||||
playfile.write(str(json.dumps(playlists)))
|
||||
playfile.close
|
Loading…
Reference in a new issue