Editorial Workflows

Get Quote

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Type a few words from a quote and an author's last name to pull the quote from GoodReads.

If no text is selected, it will use the current line.
If there are no results on GoodReads, it will run a Google Search on the In-App Browser.

I like to use the workflow inline by using the abbreviation "gqt". You can also select text and send it to the workflow using a shortcut key via a keyboard or manually tapping it.

Shared by: pursuitofefficiency

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
No Text Selected - Select Line ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
1
…End If
Selected Text ?
Entire Line(s)
ON
Empty Selection Output
  • No Output
  • All Text
  • Closest Word
Folded Text
  • Include
  • Replace with:
URL Escape ?
Set Variable ?
Variable Name
userQuote
Value
Input
Generate Text ?
Text
https://www.goodreads.com/search?utf8=%E2%9C%93&q=userQuote&search_type=quotes
Set Variable ?
Variable Name
fullLink
Value
Input
BS4 generate dictionary ?
Source Code
#coding: utf-8
import workflow
from bs4 import BeautifulSoup
import requests
import console
import re

fullLink = workflow.get_variable('fullLink')

r = requests.get(fullLink)

data = r.text

soup = BeautifulSoup(data)

source = {}

quote_soup = soup.find("div", {"class": "quoteText"})

def cleanhtml(raw_html):
  cleanr = re.compile('<.*?>')
  cleantext = re.sub(cleanr, '', raw_html)
  return cleantext

quote_soup_string = cleanhtml(str(quote_soup))

workflow.set_output(quote_soup_string)
Remove Whitespace ?
  • Trim leading/trailing whitespace
  • Remove empty lines
Find / Replace ?
Find
\s
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
Set Variable ?
Variable Name
originalResult
Value
Input
Find / Replace ?
Find
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
-
Generate Text ?
Text
> Input [[More Results](fullLink)]
Set Variable ?
Variable Name
fullOutput
Value
Input
If… ?
Run the block if
originalResult
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
None
Replace Selected Text ?
Replacement Text
Input
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
Google selection ?
Run the block if
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Show HUD ?
HUD Text
No result found
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
If… ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Search Web ?
Search for
Selected Text
…End If
If… ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
1
Search Web ?
Search for
Selected Text
…End If
…End If