gpaste get as STDIN for youtube-dl

1

I'm still fairly new to linux. I've been a user for about 2 months. I understand how to do basic pipings with grep and write STDOUT to text files.

I'm trying to do something similar with my clipboard utility gpaste. I'd like to use the text that I copy URL info from my gui browser and paste it into a terminal command. The next step would be to learn how to scrape this information automatically and run it through similar manipulations, but let's not get ahead of ourselves.

My process, I open gpaste ui and copy the youtube url in question. It gets entered into gpaste history. When I enter gpaste get [#] the correct entry is returned, great.

However when I attempt to manipulate that data in another application, like youtube-dl, I run into the error "gpaste is not a recognizable url."

Here's what I've tried:

youtube-dl | gpaste 0
gpaste get [#] | youtube-dl

Not very creative, I know, but what the hey...

Any suggestions?

Andrew

Posted 2015-09-29T13:39:25.837

Reputation: 145

Answers

1

Are you sure youtube-dl can read from stdin? If so your second example should work.

Try youtube-dl $(gpaste get [#])

To make sure $(gpaste get [#]) returns what you expect you can first do echo $(gpaste get [#])

Nifle

Posted 2015-09-29T13:39:25.837

Reputation: 31 337

that worked! Great! Thanks!

So whats the deal with the $()? What am I telling bash whenever I do that? – Andrew – 2015-09-29T20:56:39.877

1@AndÚ echo $(whatever commands you want) means that bash executes whatever is between the (..) and what it returns is used as an argument to echo. So if whatever commands you want should print out Hello AndÚ the result woud be echo Hello AndÚ – Nifle – 2015-09-30T08:32:13.843