Extract links from playlists in multiple directories
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
In a directory I have about 80 directories; in each there is a file containing a link to a YouTube playlist which corresponds to the directory name. I simply want to extract the links to the videos that are in each playlist and put them in a file in the corresponding directory.
To extract links from a playlist:
youtube-dl -j --flat-playlist" URL "| jq -r '.id' | sed 's _ ^ _ https: //youtu.be/_'> Lplaylist
The result of this command is assigned to the Lplaylist
file.
The URL is contained in a file in each directory. I simply want to replace it with a command that takes the first line of it (I used the command cut but it does not work: youtube-dl -j --flat-playlist <
cat playlist | head -n 1| jq -r '.id' | sed 's _ ^ _ https://youtu.be/_'> Lplaylist && sed 's / $ /" /' Lplaylist> temp && sed -e's / ^ / youtube-dl "/ 'temp> file.sh
: /)
My goal is:
- In each directory labeled by playlist name, take the first line of the file named ** playlist ** that has the same name in all the directories, and run the command to extract the links from the playlist videos.
Thank you so much and I hope that I was not very long.
My last attempt was as follows:
youtube-dl -j --flat-playlist < `cat playlist | head -n 1` | jq -r '.id' | sed 's_^_https://youtu.be/_' > Lplaylist && sed 's/$/"/' Lplaylist > temp && sed -e 's/^/youtube-dl "/' temp > file.sh
(Translated with Google translate. The original text is viewable in the revision history)
command-line text-processing youtube-dl
New contributor
add a comment |
In a directory I have about 80 directories; in each there is a file containing a link to a YouTube playlist which corresponds to the directory name. I simply want to extract the links to the videos that are in each playlist and put them in a file in the corresponding directory.
To extract links from a playlist:
youtube-dl -j --flat-playlist" URL "| jq -r '.id' | sed 's _ ^ _ https: //youtu.be/_'> Lplaylist
The result of this command is assigned to the Lplaylist
file.
The URL is contained in a file in each directory. I simply want to replace it with a command that takes the first line of it (I used the command cut but it does not work: youtube-dl -j --flat-playlist <
cat playlist | head -n 1| jq -r '.id' | sed 's _ ^ _ https://youtu.be/_'> Lplaylist && sed 's / $ /" /' Lplaylist> temp && sed -e's / ^ / youtube-dl "/ 'temp> file.sh
: /)
My goal is:
- In each directory labeled by playlist name, take the first line of the file named ** playlist ** that has the same name in all the directories, and run the command to extract the links from the playlist videos.
Thank you so much and I hope that I was not very long.
My last attempt was as follows:
youtube-dl -j --flat-playlist < `cat playlist | head -n 1` | jq -r '.id' | sed 's_^_https://youtu.be/_' > Lplaylist && sed 's/$/"/' Lplaylist > temp && sed -e 's/^/youtube-dl "/' temp > file.sh
(Translated with Google translate. The original text is viewable in the revision history)
command-line text-processing youtube-dl
New contributor
merci j'ai trouve un solition : for d in ./*/ ; do (cd "$d" && youtube-dl -j --flat-playlisthead -1 playlist
| jq -r '.id' | sed 's_^_youtube-dl "youtu.be/_' > file && sed 's/$/"/' file > file.sh && rm file); done
– user946855
11 hours ago
add a comment |
In a directory I have about 80 directories; in each there is a file containing a link to a YouTube playlist which corresponds to the directory name. I simply want to extract the links to the videos that are in each playlist and put them in a file in the corresponding directory.
To extract links from a playlist:
youtube-dl -j --flat-playlist" URL "| jq -r '.id' | sed 's _ ^ _ https: //youtu.be/_'> Lplaylist
The result of this command is assigned to the Lplaylist
file.
The URL is contained in a file in each directory. I simply want to replace it with a command that takes the first line of it (I used the command cut but it does not work: youtube-dl -j --flat-playlist <
cat playlist | head -n 1| jq -r '.id' | sed 's _ ^ _ https://youtu.be/_'> Lplaylist && sed 's / $ /" /' Lplaylist> temp && sed -e's / ^ / youtube-dl "/ 'temp> file.sh
: /)
My goal is:
- In each directory labeled by playlist name, take the first line of the file named ** playlist ** that has the same name in all the directories, and run the command to extract the links from the playlist videos.
Thank you so much and I hope that I was not very long.
My last attempt was as follows:
youtube-dl -j --flat-playlist < `cat playlist | head -n 1` | jq -r '.id' | sed 's_^_https://youtu.be/_' > Lplaylist && sed 's/$/"/' Lplaylist > temp && sed -e 's/^/youtube-dl "/' temp > file.sh
(Translated with Google translate. The original text is viewable in the revision history)
command-line text-processing youtube-dl
New contributor
In a directory I have about 80 directories; in each there is a file containing a link to a YouTube playlist which corresponds to the directory name. I simply want to extract the links to the videos that are in each playlist and put them in a file in the corresponding directory.
To extract links from a playlist:
youtube-dl -j --flat-playlist" URL "| jq -r '.id' | sed 's _ ^ _ https: //youtu.be/_'> Lplaylist
The result of this command is assigned to the Lplaylist
file.
The URL is contained in a file in each directory. I simply want to replace it with a command that takes the first line of it (I used the command cut but it does not work: youtube-dl -j --flat-playlist <
cat playlist | head -n 1| jq -r '.id' | sed 's _ ^ _ https://youtu.be/_'> Lplaylist && sed 's / $ /" /' Lplaylist> temp && sed -e's / ^ / youtube-dl "/ 'temp> file.sh
: /)
My goal is:
- In each directory labeled by playlist name, take the first line of the file named ** playlist ** that has the same name in all the directories, and run the command to extract the links from the playlist videos.
Thank you so much and I hope that I was not very long.
My last attempt was as follows:
youtube-dl -j --flat-playlist < `cat playlist | head -n 1` | jq -r '.id' | sed 's_^_https://youtu.be/_' > Lplaylist && sed 's/$/"/' Lplaylist > temp && sed -e 's/^/youtube-dl "/' temp > file.sh
(Translated with Google translate. The original text is viewable in the revision history)
command-line text-processing youtube-dl
command-line text-processing youtube-dl
New contributor
New contributor
edited 8 mins ago
Zanna
51.5k13141244
51.5k13141244
New contributor
asked 13 hours ago
user946855user946855
1
1
New contributor
New contributor
merci j'ai trouve un solition : for d in ./*/ ; do (cd "$d" && youtube-dl -j --flat-playlisthead -1 playlist
| jq -r '.id' | sed 's_^_youtube-dl "youtu.be/_' > file && sed 's/$/"/' file > file.sh && rm file); done
– user946855
11 hours ago
add a comment |
merci j'ai trouve un solition : for d in ./*/ ; do (cd "$d" && youtube-dl -j --flat-playlisthead -1 playlist
| jq -r '.id' | sed 's_^_youtube-dl "youtu.be/_' > file && sed 's/$/"/' file > file.sh && rm file); done
– user946855
11 hours ago
merci j'ai trouve un solition : for d in ./*/ ; do (cd "$d" && youtube-dl -j --flat-playlist
head -1 playlist
| jq -r '.id' | sed 's_^_youtube-dl "youtu.be/_' > file && sed 's/$/"/' file > file.sh && rm file); done– user946855
11 hours ago
merci j'ai trouve un solition : for d in ./*/ ; do (cd "$d" && youtube-dl -j --flat-playlist
head -1 playlist
| jq -r '.id' | sed 's_^_youtube-dl "youtu.be/_' > file && sed 's/$/"/' file > file.sh && rm file); done– user946855
11 hours ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
user946855 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1135541%2fextract-links-from-playlists-in-multiple-directories%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
user946855 is a new contributor. Be nice, and check out our Code of Conduct.
user946855 is a new contributor. Be nice, and check out our Code of Conduct.
user946855 is a new contributor. Be nice, and check out our Code of Conduct.
user946855 is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1135541%2fextract-links-from-playlists-in-multiple-directories%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
merci j'ai trouve un solition : for d in ./*/ ; do (cd "$d" && youtube-dl -j --flat-playlist
head -1 playlist
| jq -r '.id' | sed 's_^_youtube-dl "youtu.be/_' > file && sed 's/$/"/' file > file.sh && rm file); done– user946855
11 hours ago