Does it make a difference:
- whether you’re signed in to YouTube or not
- whether you’re using the YouTube app or not
Just thinking aloud, really
Does it make a difference:
Just thinking aloud, really
Yes, I wanted to use it in the smart rule as shown below, but pasting the script contents didn’t work.
Not for me. It seems that recent YouTube changes completely ruined sharing YouTube URLs. This applies to most apps I tried. Apple Notes, Messages, …
There are no previews possible any longer in Messages for instance.
In Notes, it looks like this:
Given that these apps don’t have anything to do with your login details / cookies from the browser or the YouTube app, my guess is that this can only be fixed by YouTube.
On iPad, doing Share, Copy link and then pasting to DT seems to work
I’ll edit it for you later on; basically it just needs changing from selection to rule - I’m just not at my Mac
This should work (tested once on a URL with an appropriate smart rule, worked):
-- Set name to title of web page
-- Created by Christian Grunenberg Mon Apr 26 2004.
-- Copyright (c) 2004-2019. All rights reserved.
-- adapted for Smart Rule by Blanc with kind permission
on performSmartRule(this_selection)
tell application id "DNtp"
try
set this_count to count of this_selection
if this_count > 0 then
show progress indicator "Renaming" steps this_count
repeat with this_item in this_selection
set this_type to the type of this_item
set this_source to missing value
step progress indicator (name of this_item) as string
if this_type is equal to html or this_type is equal to webarchive then
set this_source to source of this_item
else if this_type is equal to bookmark then
set this_URL to the URL of this_item
if this_URL is not "" then set this_source to download markup from this_URL
end if
if this_source is not missing value then
set this_title to get title of this_source
if this_title is not missing value and this_title is not "" then set the name of this_item to this_title
end if
end repeat
hide progress indicator
end if
on error error_message number error_number
hide progress indicator
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end tell
end performSmartRule
Pls post back whether the rule runs as it should. Cheers.
That works perfectly. Thank you Blanc!
You’re most welcome - very pleasing
Hi Blanc,
Thanks for looking into this…I wanted to add I’m still unable to solve the problem with youtube bookmarks coming from my iPad…
Here’s the “info” original utube bookmark as it displays on the iPad, and I can see the part of the url I want after the consent prefix (below)…
However after it now appears as a synced file on my Mac, “Get Info” shows the prefix only remains! (see below)
I can’t fathom how syncing from iPad to Mac has lost the url?
Sadly, because of the truncated url, I now can’t use the excellent script
It’s the full URL but DEVONthink’s Inspector displays it in a way that one can think it’s cut. Select the URL field and move down via mouse or arrow key to see the whole URL.
@cgrunenberg Seeing both Inspectors side by side in @carl99’s post I wonder why DEVONthink wraps the URL and DEVONthink To Go doesn’t. Is this a macOS limitation?
In the Info inspector the URL field is automatically resized but in the Info popover that’s not the case but the URL field should probably be truncated not wrapped. Changed.
CAN ANYONE SPOT THE issue with the “rename utube” script - it fails for me (Blanc?)
…basically nothing happens except detection of the ‘web internet location’ files, leaving behind the pesky url spam I still can’t get rid of.
First thanks to pete31 - I can see the inspector url now.
Also, in connection with the script “rename utube” I can see the url easily in DT list form (below)
Now back to the issue at hand, here’s the full context in case anyone can solve:
1. Here is where I apply “rename utube” :
2. Here are details of my script settings (the script although not fully shown, is a copy paste from “Blanc” 4 days ago )
Much appreciated if anyone can find why “rename utube” is not stripping the url spam, as up against a saving utube videos wall, with DT now.
AH Thank you - my fault for not reading it fully. I simply copied what I thought was the latest interation
Pls let me know if it works for you - I wasn’t able to test, because I don’t have any appropriate files handy. Pls test on one or two files rather than hundreds If you were going to use this on a very large number of files, I think I’d add the step counter and the possibility to cancel the rule. I can’t do that today, but do let me know if you think that would be handy.
Hi Blanc,
It does strip the consent part of the prefix, however the issue is slightly more subtle (as it still doesn’t work for me)… the wanted unique part of the url appears to be stuck in the middle between percentage marks:
[Before you continue to YouTube](https://consent.youtube.com/ml?continue=https://m.youtube.com/watch?v%3D7hGqlEpvODw%26feature%3Dyoutu.be&m=1&gl=GB&hl=en-GB&pc=yt&uxe=23983172&src=1)
[Before you continue to YouTube](https://m.youtube.com/watch?v%3D7hGqlEpvODw%26feature%3Dyoutu.be&m=1&gl=GB&hl=en-GB&pc=yt&uxe=23983172&src=1)
However, and I didn’t understand this before, it doesn’t give me a link to the video…
‘https://youtu.be/7hGqlEpvODw’
So my conclusion ignoring the title header [ ] for the moment, is the active part to save for the bookmark is only “7hGqlEpvODw” which is stuck within “%” gloop
This looks like it would need more string processing than originally thought…
(a) So removal of prefix before as in “…%”
(b) And removal of the suffix after as in “%…”
(c) Then add the string that remains at the end of “https://youtu.be/”
What do you think?
Assuming the format is always the same, that’s easy (and I’ve added the progress stepper and cancel button):
-- includes sections from C. Grunenberg: Set name to title of web page
-- those sections Copyright C. Grunenberg
on performSmartRule(theRecords)
tell application id "DNtp"
try
show progress indicator "Converting Youtube URLs" cancel button 1 steps count of theRecords
repeat with theRecord in theRecords
if cancelled progress then error number -128
step progress indicator (name of theRecord) as string
set theURL to URL of theRecord
set thePos to (offset of "%3D" in theURL) + 3
set theURL to texts thePos thru -1 of theURL
set thePos to (offset of "%" in theURL) - 1
set theURL to texts 1 thru thePos of theURL
set theURL to "https://youtu.be/" & theURL
set URL of theRecord to theURL
-- © C. Grunenberg
set this_source to download markup from theURL
if this_source is not missing value then
set this_title to get title of this_source
if this_title is not missing value and this_title is not "" then set the name of theRecord to this_title
end if
-- end
end repeat
on error error_message number error_number
hide progress indicator
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
hide progress indicator
end tell
end performSmartRule
With the specific link which you posted, this script works for me, converting a bookmark with that link to a bookmark called “Public Lecture—Water: The Strangest Liquid - YouTube” and linking to “https://youtu.be/7hGqlEpvODw”. If it doesn’t work reliably for you, you’d need to post some more links so we can see if there is a (different) pattern.
Blanc - that’s PERFECT !!!
It now works for me
You are a star!
I’ll try throughout today now - in answer to your previous question, I don’t have many bookmarks in hand as it didn’t work before… But will certainly stretch more today, and checkout the stepper (thanks!)
I’m also surprised others haven’t been calling for this from earlier, but maybe my DT video bookmarking activities are rarer than I think…
I’ve never even heard of consent.youtube.com
.
Appears as Clip to DEVONThink url prefix totally reliably under these conditions
(1) UK iPad running IoS 14.5,
(2) Safari
(3) DEVONThink To Go 3 20Mar 2021,
(4) So far, on all tested occasions (including from youtube.com) when viewing video on part of page and then “Clip to DEVONThink” (ie the only circumstance I can clip)
Different results your side?