use youtube name for file

This commit is contained in:
dechert 2023-01-17 11:37:48 +01:00
parent 4ecce63c83
commit 8a0c9d5539
2 changed files with 20 additions and 4 deletions

View File

@ -1,12 +1,26 @@
# yt2podcast
## Automation
## API Approach
- paste URL into web UI
- trigger download via youtube dl Material API
- upload downloaded file via PodcastGenerator
- https://podcasts.swaghausen.de/admin/episodes_upload.php
- PHP SessId
- OR script to Edit Feed.xml and create xml associated with mp3
## File based approach
- paste URL into web UI
- trigger download via youtube-dl python library
### Using Podcast Generator
- downloaded file is copied to Podcast generator folder / folder is mounted as docker volume
- script to Edit Feed.xml and create xml associated with mp3
### Use Python Library to generate RSS Feed
https://github.com/lkiesow/python-feedgen
- Serve xml file via same Flask app?
admin
test123

View File

@ -7,20 +7,22 @@ from flask import render_template
def call_youtubedl(url):
print(url)
download_audio(url, "first_test")
download_audio(url)
# thread = Thread(args=(, ))
thread = threading.Thread(target=download_audio, args=(url, "first_test"), daemon=True)
thread.start()
thread.join()
# loading screen based on https://github.com/Aycn0/flask_loading_screen
# data = "test"
# return render_template('success.html', passed_data=data)
# print("thread finished...exiting")
def download_audio(url, name):
def download_audio(url):
ydl_opts = {
'format': 'bestaudio/best',
'outtmpl': f'/output/{name}.mp3', # Template for output names
'outtmpl': f'/output/%(title)s.mp3', # Template for output names. Needed to change the file extension
'noplaylist': True, # Download only the video, if the URL refers to a video and a playlist
'continue_dl': True, # Force resume of partially downloaded files. By default, youtube-dl will resume downloads if possible
'postprocessors': [{