knqyf263 / pet

Simple command-line snippet manager
MIT License
4.45k stars 224 forks source link

Inserting Youtube video URL as variable from clipboard puts unneccessary spaces in it #136

Closed tonyrulez closed 7 months ago

tonyrulez commented 4 years ago

I made the following snippet for Youtube-DL:

[[snippets]]
  description = "Download Youtube video"
  command = "youtube-dl -o '/home/tonyrulez/Youtube/%(upload_date)s - %(uploader)s - %(title)s.%(ext)s' <url>"
  output = ""

When I run this snippet and it asks for the url, I copy it from the browser, but it gets spaced out. What I copied: https://www.youtube.com/watch?v=dQw4w9WgXcQ How it gets pasted: https://www.youtube . c om / w a t c h ? v = d Q w 4 w 9 W g X c Q In result, youtube-dl does not recognise the url, more precisely it only recognises the first half, until the first space:

[generic] www: Requesting header
WARNING: Could not send HEAD request to https://www.youtube: <urlopen error [Errno -2] Name or service not known>
[generic] www: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [Errno -2] Name or service not known> (caused by URLError(gaierror(-2, 'Name or service not known'),))
exit status 1

Why is it stretching out the URL?

spaddex commented 4 years ago

Feels like this might be a dupe of #132?

tonyrulez commented 4 years ago

Yep, this might be the reason why the first couple characters don't get spaced out.

RamiAwar commented 7 months ago

Fixed!