Sure, I’m happy to share what I have. Here’s a screenshot of the Workflow – I’m pretty new to using the app and I’m not sure if there’s a way to share that isn’t public like we can do on the action directory.
Here’s a simple script I created to demonstrate how easy it is.
Simple Web Scraper using html2text
Many parameters can be adjusted as needed
(or use "Run Script" option in Workflow)
# Read passed-in url and get html
url = sys.argv
with urllib.request.urlopen(url) as response:
html = response.read().decode('utf-8')
# Set html2text options and get text
h = html2text.HTML2Text()
h.body_width = 0 # Don't wrap text
h.inline_links = False # Reference-style MD links
md = h.handle(html)
mdEscaped = urllib.parse.quote(md)
xurl = 'drafts5://x-callback-url/create?text=' + mdEscaped
Pythonista comes with a version of html2text included, so you can see if this does what you want out of the box. I actually downloaded the current version of the module into site-packages, but I’m not sure how much of a difference there is. I had a specific project for which I needed HTML to Markdown conversion, so I had to make some tweaks.
If you don’t want to pull from a url, you could easily modify the script to accept the HTML directly. I hope this helps!