Skip to content

Instantly share code, notes, and snippets.

@empeje
Last active January 18, 2023 23:19
Show Gist options
  • Save empeje/c07864ddae5cd88001e8fb03a7aff3a5 to your computer and use it in GitHub Desktop.
Save empeje/c07864ddae5cd88001e8fb03a7aff3a5 to your computer and use it in GitHub Desktop.
RSS parser for Zapier

The python secret sauce to parse RSS using library available in Zapier Code

import requests
response = requests.get('https://newsletter.banklesshq.com/feed')
response.raise_for_status() # optional but good practice in case the call fails!

from xml.etree import ElementTree
root = ElementTree.fromstring(response.text)

content = ""

# Looks for all item elements under channel tag
for item in root.iterfind('channel/item'):
	title = item.findtext('title')
	description = item.findtext('description')
	date = item.findtext('pubDate')
	link = item.findtext('link')

	header = ('%s / %s / %s \n' %(title, date, description))
	content += header

output = { content: content }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment