Jump to content
vitor

DownVid — Download media from popular sources

Recommended Posts

There is not, enigma2k, although I agree it would sometimes be nice. This is an issue of implementation, above anything else; if there was a good way to do it, I’d definitely look into it.

Share this post


Link to post

I've stumbled upon another workflow that shows you the download progress. You may get an idea from there: http://www.alfredforum.com/topic/2680-search-download-and-install-mac-apps/

Unfortunately, that’s what I consider to not be a good way to do it. It might be fine when downloading a single application, but when downloading video after video (which I regularly do), having a GUI bar appear is really suboptimal and ugly. That is a solution I won’t pursue.

Share this post


Link to post

Update.

 

Some changes to the way additions are made to WatchList. Downloads are prepended, instead of appended, and are only added at the end of the download.

Share this post


Link to post

Update.

 

Added option to show download progress (dvp).

 

Also fixed a bug with showing the initial download message when saving to the desktop.

Share this post


Link to post

Update.

 

Added option to show download progress (dvp).

 

Also fixed a bug with showing the initial download message when saving to the desktop.

 

Is there any way to download more than 1 link at a time without having to wait for each one to finish?

Share this post


Link to post

Is there any way to download more than 1 link at a time without having to wait for each one to finish?

 

also, is there a way it keeps track of it when i'm going through several links and employing download? like i noticed that just after one finishes downloading, if i had ran it again during that period, the next one in the queue will start.. was wondering if it's a "running queue" and will continually keep downloading them on it's own or if i have to be patient and do each one at a time while keeping the page open? (also, can i close the page after downloading begins?) thanks vitor!

Share this post


Link to post

Just keep adding links normally. You don’t need to do anything else, it’ll keep a queue just fine.

Share this post


Link to post

Update.
 
Added option to restart downloads ( modifier in dvp). This is useful if the download gets stuck for some reason (like the network connection going down), and will add the download to the back of the queue.

Share this post


Link to post

This is a wonderful
But I want to download the video with a download manager such as folx or igetter
Is there a solution to send the video url to one of these apps? ?

Share this post


Link to post

Possibly. I won’t implement it, though, as that would complicate the interface disproportionally to the feature’s desirability.

Share this post


Link to post

Could you give me a hint on how to do it ??

and I will change it

My connection is very slow and I want to use Download Accelerator.

thanx

(Please excuse my poor English)

Share this post


Link to post

ghani1990 youtube-dl has a --get-url option that should get the direct url to the download file, instead of downloading it. In the Run Script node on the top right, there’s a getfile function you’ll need to change to accommodate this. It’s likely here that you should write your logic to open said url in your download accelerator.
 
I don’t use (or have any interest in) any of those download accelerators and they’re paid apps, so this is as far as I’ll go.

Share this post


Link to post

Update. OS X Services.

You can now add DownVid actions as OS X Services, by running “installdownvidservices” (if you ever want to remove them, simply delete them from the ~/Library/Services directory).

ctIgv51.png

What this means is wherever you find a URL, you’ll be able to right click it and start the download right from the context menu.

nV7zwvl.png

Share this post


Link to post

Apparently youtube doesn't know what *best* quality means.  Even though there was a 1080p version of a video it downloaded the 720p version:

format code extension resolution  note
139         m4a       audio only  DASH audio   49k , audio@ 48k (22050Hz), 581.15KiB (worst)
140         m4a       audio only  DASH audio  129k , audio@128k (44100Hz), 1.51MiB
171         webm      audio only  DASH audio  132k , audio@128k (44100Hz), 1.30MiB
172         webm      audio only  DASH audio  193k , audio@256k (44100Hz), 1.90MiB
141         m4a       audio only  DASH audio  255k , audio@256k (44100Hz), 2.99MiB
278         webm      256x144     DASH video   97k , webm container, VP9, video only, 593.79KiB
160         mp4       256x144     DASH video  121k , video only, 1.17MiB
242         webm      426x240     DASH video  215k , video only, 1.05MiB
133         mp4       426x240     DASH video  296k , video only, 2.63MiB
243         webm      640x360     DASH video  382k , video only, 1.89MiB
134         mp4       640x360     DASH video  354k , video only, 2.26MiB
244         webm      854x480     DASH video  614k , video only, 3.04MiB
135         mp4       854x480     DASH video  676k , video only, 4.67MiB
247         webm      1280x720    DASH video 1161k , video only, 5.82MiB
136         mp4       1280x720    DASH video 1221k , video only, 9.26MiB
248         webm      1920x1080   DASH video 2010k , video only, 10.77MiB
137         mp4       1920x1080   DASH video 2342k , video only, 18.47MiB
17          3gp       176x144
36          3gp       320x240
5           flv       400x240
43          webm      640x360
18          mp4       640x360
22          mp4       1280x720    (best)

I added this flag into the getfile method to get it to download a 1080p version:

 

-f 137/22/18/17 

Share this post


Link to post

meflou Open the Run Script node on the top right. Very near the end you’ll find a line that reads downdir="${HOME}/Desktop"; change it to downdir="${HOME}/Downloads". Alternatively, if you have WatchList and add to it via this workflow, it’ll default to that directory.

scottfwalter. Not sure if the fault lies with youtube-dl or youtube, on that one. It’s more likely the former’s fault, though, so you should open a bug report. This workflow simply uses the default (supposedly the best).

Edited by Vítor

Share this post


Link to post

meflou Open the Run Script node on the top right. Very near the end you’ll find a line that reads downdir="${HOME}/Desktop"; change it to downdir="${HOME}/Downloads". Alternatively, if you have WatchList and add to it via this workflow, it’ll default to that directory.

 

 

When I download any file it got the format nameofvideo.mp4.part so every time I have to delete .part to be able to read the video, how can I fix this?

Also I changed the path to downdir=" /Users/q/Downloads/Downloads/Videos" but still it download them to Downloads not to Videos under the folder downloads. Thank You!

Share this post


Link to post

When I download any file it got the format nameofvideo.mp4.part

That should be only temporary, until the video finishes downloading. That way you know the download hasn’t finished, and can even continue it later, if it interrupts for some reason.

 

Also I changed the path to downdir="/Users/q/Downloads/Downloads/Videos"

You have Downloads twice (…/Downloads/Downloads/…), there, don’t you mean downdir="${HOME}/Downloads/Videos"? You can use ${HOME} literally; it’ll know what it means.

To make sure the directory you want to download to exists, you can open a terminal and run mkdir -p <path_to_directory>.

Edited by Vítor

Share this post


Link to post

Fantastic workflow (not surprising really coming from you Vitor)...

 

I'm having an issue where I followed the steps to keep video & audio and it works. For some reason, it creates a second version of both the video & audio. For example, using the workflow, it downloaded a video called "Best DIY GoPro Mounts.mp4"... it also created another version entitled "Best DIY GoPro Mounts.f136.mp4". It does the same with the audio... two m4a versions one including .f141.m4a.

 

I just added --extract-audio --keep-video --quiet

 

The script I'm using for dv following the instructions...

export PATH="/usr/local/bin:$PATH"

# deal with special characters
export LANG=en_GB.UTF-8

IFS=$'\n'

# set notifications
notification() {
  ./_licensed/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier -title "DownVid" -message "${1}"
}

# update youtube-dl if it's more than 15 days old
if [[ $(find youtube-dl -mtime +15) ]]; then
  python youtube-dl --update
fi

gettitle() {
  # file location
  filename=$(python youtube-dl --no-playlist --extract-audio --keep-video --quiet --output "${downdir}/%(title)s.%(ext)s" --get-filename "${link}")

  # title
  title=$(basename ${filename%.*})

  # check if url is valid
  if [[ -z "${filename}" ]]; then
    notification "The url is invalid"
    exit 1
  else
    notification "Downloading “${title}”"
  fi
}

getfile() {
  progressfile="/tmp/downvidprogress"

  python youtube-dl --no-playlist --extract-audio --keep-video --quiet --newline --output "${downdir}/%(title)s.%(ext)s" "${link}" > "${progressfile}"

  # add metadata
  xmlencodedurl=$(echo "${link}" | perl -MHTML::Entities -CS -pe'$_ = encode_entities($_, q{&<>"'\''})')
  xattr -w com.apple.metadata:kMDItemWhereFroms '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><array><string>'"${xmlencodedurl}"'</string></array></plist>' "${filename}"

  rm "${progressfile}"
}

# download
printf "{query}" > "/tmp/downvidcurrentquery"

if [[ "{query}" == "addToWatchList"* ]]; then
  link=$(cat "$(echo {query} | sed 's/addToWatchList //')")
  downdir="${HOME}/Downloads"
  gettitle
  getfile
  osascript -e "tell application \"Alfred 2\" to run trigger \"add_to_watchlist\" in workflow \"com.vitorgalvao.alfred.watchlist\" with argument \"${filename}\""
else
  link="$(cat {query})"
  downdir="${HOME}/Desktop"
  gettitle
  getfile
fi

notification "Downloaded “${title}”"

Share this post


Link to post

 

Fantastic workflow (not surprising really coming from you Vitor)...

 

I'm having an issue where I followed the steps to keep video & audio and it works. For some reason, it creates a second version of both the video & audio. For example, using the workflow, it downloaded a video called "Best DIY GoPro Mounts.mp4"... it also created another version entitled "Best DIY GoPro Mounts.f136.mp4". It does the same with the audio... two m4a versions one including .f141.m4a.

 

I just added --extract-audio --keep-video --quiet

 

The script I'm using for dv following the instructions...

export PATH="/usr/local/bin:$PATH"

# deal with special characters
export LANG=en_GB.UTF-8

IFS=$'\n'

# set notifications
notification() {
  ./_licensed/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier -title "DownVid" -message "${1}"
}

# update youtube-dl if it's more than 15 days old
if [[ $(find youtube-dl -mtime +15) ]]; then
  python youtube-dl --update
fi

gettitle() {
  # file location
  filename=$(python youtube-dl --no-playlist --extract-audio --keep-video --quiet --output "${downdir}/%(title)s.%(ext)s" --get-filename "${link}")

  # title
  title=$(basename ${filename%.*})

  # check if url is valid
  if [[ -z "${filename}" ]]; then
    notification "The url is invalid"
    exit 1
  else
    notification "Downloading “${title}”"
  fi
}

getfile() {
  progressfile="/tmp/downvidprogress"

  python youtube-dl --no-playlist --extract-audio --keep-video --quiet --newline --output "${downdir}/%(title)s.%(ext)s" "${link}" > "${progressfile}"

  # add metadata
  xmlencodedurl=$(echo "${link}" | perl -MHTML::Entities -CS -pe'$_ = encode_entities($_, q{&<>"'\''})')
  xattr -w com.apple.metadata:kMDItemWhereFroms '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><array><string>'"${xmlencodedurl}"'</string></array></plist>' "${filename}"

  rm "${progressfile}"
}

# download
printf "{query}" > "/tmp/downvidcurrentquery"

if [[ "{query}" == "addToWatchList"* ]]; then
  link=$(cat "$(echo {query} | sed 's/addToWatchList //')")
  downdir="${HOME}/Downloads"
  gettitle
  getfile
  osascript -e "tell application \"Alfred 2\" to run trigger \"add_to_watchlist\" in workflow \"com.vitorgalvao.alfred.watchlist\" with argument \"${filename}\""
else
  link="$(cat {query})"
  downdir="${HOME}/Desktop"
  gettitle
  getfile
fi

notification "Downloaded “${title}”"

 

Per Scott's suggestion, adding -f 137/22/18/17 to the workflow got rid of the numbered versions and the workflow is now working correctly.

Share this post


Link to post

Fantastic workflow (not surprising really coming from you Vitor)...

Thank you for the kind words.

Per Scott's suggestion, adding -f 137/22/18/17 to the workflow got rid of the numbered versions and the workflow is now working correctly.

Glad you got it working. I took the chance to update the instructions, as they were slightly out-of-date.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×