Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save siliconvallaeys/feeb51ecae25684a11d24cad868984bf to your computer and use it in GitHub Desktop.
Save siliconvallaeys/feeb51ecae25684a11d24cad868984bf to your computer and use it in GitHub Desktop.
Use this Python code in Zapier to extract action items from the meeting transcript in Fireflies
from bs4 import BeautifulSoup
import re
from html import unescape
html = input_data.get('items', '') or ''
html = unescape(html)
def normalize_lines(text: str):
text = re.sub(r'<\s*br\s*/?\s*>', '\n', text, flags=re.IGNORECASE)
text = re.sub(r'<[^>]+>', '', text)
text = re.sub(r'\r\n?|\u2028|\u2029', '\n', text)
return [ln.strip() for ln in text.split('\n') if ln.strip()]
def normalize_cmp(s: str) -> str:
return re.sub(r'\W+', '', s or '').lower()
items = []
soup = BeautifulSoup(html, "html.parser")
for b in soup.find_all('b'):
owner = b.get_text(strip=True)
owner_norm = normalize_cmp(owner)
chunk_parts = []
for sib in b.next_siblings:
if getattr(sib, 'name', None) == 'b':
break
if hasattr(sib, 'get_text'):
chunk_parts.append(sib.get_text(separator='\n'))
else:
chunk_parts.append(str(sib))
chunk = ''.join(chunk_parts)
for line in normalize_lines(chunk):
if normalize_cmp(line) == owner_norm:
continue
items.append({"owner": owner, "task": line})
# Zapier will treat this list as multiple line items
output = {"items": items}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment