Extract links from playlists in multiple directories





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







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)










share|improve this question









New contributor




user946855 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • 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




















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)










share|improve this question









New contributor




user946855 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • 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
















0












0








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)










share|improve this question









New contributor




user946855 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












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






share|improve this question









New contributor




user946855 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




user946855 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 8 mins ago









Zanna

51.5k13141244




51.5k13141244






New contributor




user946855 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 13 hours ago









user946855user946855

1




1




New contributor




user946855 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user946855 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user946855 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • 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



















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












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.










draft saved

draft discarded


















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.










draft saved

draft discarded


















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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

GameSpot

日野市

Tu-95轟炸機