Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Option to combine -o and -g #9239
Comments
|
Could you give some concrete video links and your expected output? |
|
great idea & it does have links... does github not list the time that OP's post was edited? |
|
Well, no. Edits don't activate notifications and alerts either.. |
|
I think this can be easily achieved with a script: #!/bin/sh
youtube-dl -j "$@" | python -c '
import sys
import json
import os
for line in sys.stdin.readlines():
info = json.loads(line)
fname = info["_filename"]
dir = os.path.dirname(fname)
if dir and not os.path.exists(dir):
os.makedirs(dir)
with open(fname, "wt") as f:
f.write(info["url"])
'I don't find it hacky, although others may disagree. |
|
I am now using this script and it does exactly what I wanted. I forked the repository and was gonna make a PR with the required changes, but I don't know how to properly do this in the context of youtube-dl's workflow (it looks to me like a file is created in the same function as downloading something to it, and while I suppose I could probably make it download a pastebin of the url somehow, it seems, well, too hacky. How could this be integrated into the application in a more elegant way? |
What is the purpose of your issue?
Description of your issue, suggested solution and other information
I use Kodi Media Center for all my entertainment and media management. This program is capable of playing streaming video in many formats from an url written in a .strm file. I would like to use youtube-dl to output a playlist of music videos in a specific format (say,
'%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s'which will put playlist files into a common folder, but instead of actually downloading the video, just echo the url (as given by the-goption) into the file. I have actually accomplished this using a bash script which parses the output ofyoutube-dl --get-filename --get-urlbut it is a very hacky solution. Any chance this could become a feature?EDIT: To give an example, I would like to be able to run
youtube-dl -f best -g -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/playlist?list=PLY5f8vtstsfjedMi6VHRAeFV85Xc_VoKGand see afterwards a subdirectory in the working dir of youtube-dl, which is named by the title of the playlist (in this case, NateWantsToBattle Songs) and in that subfolder would be a number of files named according to their order in the playlist and title (in this case, one would be named "NateWantsToBattle Songs/01 - twenty one pilots - Stressed Out [NateWantsToBattle feat. ShueTube].mp4") and each file would contain only the plain-text url of the video as shown by -g (the example above would contain the url string shown here).