This is untested, because I don’t have any files handy to test it on; it will only work if the first section of the URL is always https://consent.youtube.com/ml?continue=
which I assume will be the case; otherwise you’d need to adjust the condition in the rule. The script will cut the URL at the first =
so would work with any URL which needed to be cut at that point.
This is the embedded script:
on performSmartRule(theRecords)
tell application id "DNtp"
repeat with theRecord in theRecords
set theURL to URL of theRecord
set thePos to offset of "=" in theURL
set thePos to thePos + 1
set theURL to texts thePos thru -1 of theURL
set URL of theRecord to theURL
end repeat
end tell
end performSmartRule
Once you have changed the URL of one of your bookmarks, you could try running the script called _Set Name To Title Of Web Page from the Script/Rename menu in DT. If that changes the title of your bookmark in the fashion you want, that script could easily be integrated into the little script I wrote, meaning you would get what you wanted with one simple smart rule
If that does work, then this should do the whole trick:
-- 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
repeat with theRecord in theRecords
set theURL to URL of theRecord
set thePos to offset of "=" in theURL
set thePos to thePos + 1
set theURL to texts thePos thru -1 of 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
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end tell
end performSmartRule
@cgrunenberg Criss, I’m assuming it is ok to take parts of your scripts and integrate them in new ones, so long as the source is recognised?