This is the script I came up with earlier today and works for me:
on performSmartRule(theRecords)
tell application id "DNtp"
repeat with theRecord in theRecords
do shell script "/usr/local/bin/youtube-dl -o '~/Library/Application Support/DEVONthink 3/Inbox/%(title)s.%(ext)s' " & URL of theRecord
end repeat
end tell
end performSmartRule
Sure can. That is on my work computer, so reproduced it here:
Looks at an RSS feed I have for one of the playlists I watch on YouTube. If the URL has YouTube in it, it uses that script on the files, and moves them to the trash now that I have the movie downloaded in my inbox.
thanks @jrickmd this did the the trick however I am not sure what the problem was actually. I thought I tried every combination with and without âquoted formâ.
@pete31 thanks for the tip on how to debug however I am not sure if I have the best workflow.
I have a smartrule in DT with the script I am developing and everytime I change something I run it to test it in DT. However it seems that DT is caching the scripts and I did not find any way to reload it so I have to close and reopen DT everytime when I update the script which is very cumbersome.
There must be a better way right?
Now I just need to find a way to save the outcome not to the global inbox but to a specific inbox of another db. It looks like the global inbox is special in terms of âeasy accessâ
But this would still mean that youtube-dl is saving to the global Inbox and then I would move the file right?
Isnât there a way that youtube-dl can directly save to one specific db inbox?
There is some controversy online about YouTube-dl and the support given to it. I only read about this when my YouTube-dl downloads got to be VERY slow. Some thought that YouTube was blocking it. This is now the shell script line I use after installing a fork of YouTube-dl called yt-dlpâŚ
If you guys want something faster than youtube-dl, try yt-dlp.
It has date formatting that makes things really niceâŚ
For example, hereâs my script: yt-dlp -U 'https://channel or playlist or video' -o '%(uploader)s (%(uploader_id)s)/%(upload_date>%Y-%m-%d %a %b)s YT %(title).150s - (%(duration>%Hh%Mm%Ss)s) [%(resolution)s] [%(id)s]' --write-auto-sub --convert-subs=srt --write-description --write-info-json -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4'
2022-07-30 Sat Jul YT VideoTitle - (00h36m51s) [1920x1030] [ASxSbOj6nJP]
The date is sortable by YYYY-MM-DD
I like to know the date and month (for searching): Sat Jul
I trim the title to 150 characters and this allows me to be able to do those crazy long titles of videos on Twitter, for example (you can use a twitter url or other video service instead of youtube)
I add the YT prefix in this case, but you can remove that if you wish or make a macro that uses YT, TW, etc if you want the original source siteâŚ
The script above also downloads the video description and transcript and json details for each video all with the same nice formatting. Furthermore it puts the videos into the proper channel directory so that you donât have to figure that out later.