ShareShortcuts

Summarize Article

twilsonco
Fork “Summarize Article”

Built something new on top of this Shortcut? Share it as a fork: it becomes a Shortcut of your own, which you manage, and both pages link to each other so twilsonco gets credit.

  1. 1Get the Shortcut and change it in the Shortcuts app. Give it a name of its own.
  2. 2Share it from the Shortcuts app and copy the iCloud link.
  3. 3Come back here, paste the link and describe what is different, e.g. “Added a step that uses Apple Intelligence to personalise the text.”
Downloads
26K
Saved
1
Actions
70
Category
Productivity
Version
1.0
Language
EN

Summarize an article from a website using Google Gemini Pro

Share a url from Safari/Chrome/etc and have Google Gemini Pro summarize it in natural language. Because Gemini has a 30k token input cap, this works for very long articles.

Uses the "Gemini via API" shortcut.

What's New

Version 1.0

First release

Version History
1.0 Feb 9, 2024

First release

What it does

70 actions
  1. Comment
    Summarize article with Google Gemini Pro Tim Wilson, January 2024 Summarizes an article from a website using the “Gemini via API” shortcut. https://routinehub.co/shortcut/17624/
  2. Comment
    Check for shortcut updates
  3. Nothing
  4. Comment
    【Auto-Update Routine】 Checks For Latest Shortcut Version ↳ https://routinehub.co/shortcut/16590/
  5. Dictionary
  6. Get Dictionary Value
  7. If
  8. Get IP Address
  9. If
  10. Get Contents of URL
    https://routinehub.co/api/v1/shortcuts/…/versions/latest
  11. If
  12. Split Text
  13. Repeat with Each
  14. Calculate Expression
  15. Set Variable
    Latest Version
  16. Split Text
  17. Repeat with Each
  18. Calculate Expression
  19. Set Variable
    Current Version
  20. If
  21. Choose from Menu
    New Version: … Release: … Whats New: "…"
  22. Choose from Menu
    Update → Result (Version)
  23. Expand URL
  24. Replace Text
  25. Open URLs
  26. Stop This Shortcut
  27. Choose from Menu
    Skip (Info (Version))
  28. Comment
    【Auto-Update Routine Ends Here】 Support → https://www.reddit.com/r/shortcuts/comments/18j4f9p/ 【⚙️】 Convert Semantic Number to Decimals ↳ https://routinehub.co/shortcut/16589/
  29. Nothing
  30. Comment
    Begin dependency check (using “Check-install dependencies (v1)” by Tim Wilson: https://routinehub.co/shortcut/17694/) Dictionary of dependencies, where each: * Key is the name fo the shortcut (used to check if install, so much match perfectly), and …
  31. Dictionary
  32. Get My Shortcuts
  33. Repeat with Each
  34. Filter Files
  35. If
  36. Show Result
  37. Get Dictionary Value
  38. Set Variable
    URL
  39. Match Text
  40. If
  41. Get Contents of URL
    https://routinehub.co/api/v1/shortcuts/…/versions/latest
  42. Expand URL
  43. Set Variable
    URL
  44. Replace Text
  45. Open URLs
  46. Stop This Shortcut
  47. Nothing
  48. Comment
    End dependency check
  49. Set Variable
    InputURL
  50. Get Device Details
  51. If
  52. Get Article using Safari Reader
  53. If
  54. Get Article Detail
  55. Get Article Detail
  56. Get Article Detail
  57. Text
  58. If
  59. Get Contents of Web Page
  60. If
  61. Get Contents of URL
    …
  62. Count
  63. If
  64. Text
  65. Dictionary
  66. Run Shortcut
    Gemini via API
  67. Show Result
  68. If
  69. Text
  70. Show Result

View as code
Beta

Every action of this Shortcut written out as Cherri, a programming language for Shortcuts. Great for learning how it works.

#include 'actions/web'
#include 'actions/network'
#define color teal
#define glyph newsArticle

/*
Summarize article with Google Gemini Pro
Tim Wilson, January 2024

Summarizes an article from a website using the “Gemini via API” shortcut. https://routinehub.co/shortcut/17624/
*/
// Check for shortcut updates

nothing()
/*
【Auto-Update Routine】
Checks For Latest Shortcut Version
↳ https://routinehub.co/shortcut/16590/
*/
const Info = {
	"Author": "twilsonco",
	"RoutineHub ID": 17676,
	"Version": "1.1.0",
	"Version Check": true
}
const True = getValue(Info, "Version Check")

if True == "Yes" {
	const CurrentIPAddress = getExternalIP("IPv4")
	if CurrentIPAddress {
		const Result = downloadURL("https://routinehub.co/api/v1/shortcuts/{Info['RoutineHub ID']}/versions/latest")
		if Result contains "success" {
			const SplitText = splitText(Result['Version'], ".")
			for _ in SplitText {
				@LatestVersion = ((1/1000)^@RepeatIndex)*@RepeatItem+@LatestVersion
			}
			const SplitText1 = splitText(Info['Version'], ".")
			for _ in SplitText1 {
				@CurrentVersion = ((1/1000)^@RepeatIndex)*@RepeatItem+@CurrentVersion
			}
			if @LatestVersion > @CurrentVersion {
				menu "New Version: {Result['Version']}\nRelease: {Result['Release']}\nWhats New: \"{Result['Notes']}\"" {
				item "Update → {Result['Version']}":
					expandURL(Result['URL'])
					const UpdatedText = replaceText("https://www.icloud.com/", "shortcuts://", false)
					openURL(UpdatedText)
					stop()
				item "Skip ({Info['Version']})":
				}
			}
		}
	}
}
/*
【Auto-Update Routine Ends Here】
Support → https://www.reddit.com/r/shortcuts/comments/18j4f9p/

【⚙️】
Convert Semantic Number to Decimals
↳ https://routinehub.co/shortcut/16589/
*/
nothing()
/*
Begin dependency check
(using “Check-install dependencies (v1)” by Tim Wilson: https://routinehub.co/shortcut/17694/)

Dictionary of dependencies, where each:
* Key is the name fo the shortcut (used to check if install, so much match perfectly), and each value is either:
  * The RoutineHub ID (number), or
  * The URL (text type; iCloud link to shortcut or some other URL)
*/
const DependencyDict = {
	"Gemini via API": 17624
}
const FullShortcutList = getShortcuts()

for _ in DependencyDict['Keys'] {
	const Files = filterFiles(FullShortcutList, 1, "Last Modified Date", "Latest First")
	if !Files {
		show("This shortcut depends on the \"{@RepeatItem}\" shortcut, which was not found (by name) in your installed Shortcuts. Contiunue to install it now, then try this Shortcut again.")
		@URL = DependencyDict[@RepeatItem]
		const Matches = containsText(DependencyValue, "^[0-9]+$")
		if Matches {
			const Result1 = downloadURL("https://routinehub.co/api/v1/shortcuts/{DependencyValue}/versions/latest")
			expandURL(Result1['URL'])
			@URL
		}
		const UpdatedText1 = replaceText("https://www.icloud.com/", "shortcuts://", @URL, false)
		openURL(UpdatedText1)
		stop()
	}
}
nothing()
// End dependency check

@InputURL = ShortcutInput
const DeviceModel = getDeviceDetail("Device Model")

if DeviceModel != "Mac" {
	const Article = getArticle(@InputURL)
	if Article {
		getArticleDetail(Article, "Title")
		getArticleDetail(Article, "Author")
		getArticleDetail(Article, "Body")
	} else {
		getWebpageContents(@InputURL)
	}
} else {
	downloadURL(@InputURL)
}
const Count = count(IfResult, "Words")

if Count > 10 {
	const Dictionary = {
		"disablelogging": 1,
		"prompt": "{}"
	}
	run("Gemini via API", Dictionary)
	show(['output'])
} else {
	show()
}
Open in Cherri Playground Decompiled with cherri 2.3.0 (GPL-2.0). May need small fixes before it compiles.

Ratings & Reviews

Write a Review
–
out of 5
★★★★★
★★★★
★★★
★★
★
0 ratings

No reviews yet. Be the first to share what you think!

Advertisement

More by twilsonco

See All

You Might Also Like

See All
Advertisement