Extracting URL, Author, Title and selected text from Safari or Instapaper

When reading an article or a blog, I’d like to be able to select a piece of text and create a draft containing Author, Title, URL, and that piece of text.

It doesn’t need to be all with the same app (ie not looking for a miraculous workflow, but if one exists…). I’ve tried a mix of workflow, Gladdys, and Drafts but nothing work…

Thanks!!

Unfortunately I don’t think it’s possible to get both the text on a web page and the details of the web page itself with Workflow/Shortcuts, so assuming you don’t mind copying the quote to your clipboard first and then sharing the web page this would work: https://workflow.is/workflows/03e56c1d0c0d452c87d81c29e2a7797f

Here’s a Wokflow that I think does what you want.

It expects to be passed a selection from Safari via the share sheet. It then pulls the selectcion, URL and page title from that input (magic variables being as awsome as ever). It uses the page URL to pull in article information which is where it will attempt to extrapolate the author assuming one is available.

Expand here for a screenshot of the workflow

The screenshot doesn’t show the whole content of the text action, but you get the idea about its content.

Expand here to take a look at it working

The original selection.

The output.

Hope that helps.

2 Likes

I learnt something new today. Great workflow!

Wow!! Thanks!! This is great and worked for the articles I’ve tested already. One failed but I think that’s because the author is part of the text rather then a property of the webpage.

Would you know why can run the workflow using the “share” circled in green but not when using the one in red?

Thanks again!!

@AFC, @sylumer’s workflow only takes in Safari webpages. The red circled share button would send what you’ve selected as text which wouldn’t allow you access to the url/author/etc.

1 Like

You could first copy the selected text, then use run workflow from the green share button.

That way you can use the “clipboard” variable in your workflow to insert it where you want…

1 Like

That would indeed explain it. Workflow’s article based actions are looking for specific items of data in the web page. If they don’t identify them or they aren’t available, then there will be unspecified data. Not quite a failure as much as a limitation.

If the post is on a platform you use regularly in this way you could probably parse the body (HTML) of the page and identify the author through use of regular expression matches. This could be used as an alternative way to populate the author on those occasions, but it effectively means you’re extending the get article details functionality with some additional actions.

If that sounds like overkill or being too complicated, consider adding in a prompt to query for the name of the author should one not be found. You could then substitute that in for the remainder of your workflow.

Indeed. Perhaps I should have been more specific in how to use the share sheet for this workflow, but it is basiclly how Safari in iOS works rather than something specific to this workflow.

Using the sharing button mentioned is exactly what this workflow uses without requiring the use of the clipboard. This means that you get retention of original clipboard content and quicker execution. Note that the OP specifically referenced use of Safari as one of the two options for utilisation at the start. therefore making use of Workflow’s built-in Safari functionality makes most sense.

1 Like

@dustinknopoff thank you for explaining the difference between the two. I didn’t know but now it’s clear!!

@sylumer again thank you for the workflow and explanation. I’ll pay around with Regex but that is not critical.

By any chance, would you now of any workflow that would do the same but in Instapaper rather than Safari? Also, instead of text selections it would be extract the articles highlights? (increasing the complexity here :wink: )

Thanks!!

I haven’t used Instapaper for many years. What does the share sheet actually export these days? All of the informaton you are after … or not?

There is an API, but I’m not convinced Workflow can authenticate to it.