Open shabegom opened 3 years ago
Here is a version with a few tweaks I made :)
#42SmartBlock Shakespeare
<%CONCAT:#,[,[Shakespeare]]%>
<%CONCAT:[,[>]] %><%JAVASCRIPTASYNC:```javascript
return await fetch('https://shakespeare-quote.glitch.me/')
.then(res => res.json())
.then(data => {
return `${data.quote}
\t— [[${data.play}]]`
})```%>
✂️ Copy of your #42SmartBlock from Roam
📋 Describe the SmartBlock
Fetches a random line from a random Shakespeare play
✅ Describe any prerequisites or dependencies that are required for this SmartBlock
I was surprised that there wasn't an existing method online to do this, so I wrote my own. It is essentially trying to guess a URL from Folger's Shakespeare database using a recursive function. Response time can be a bit slow if it doesn't get a hit in the first few tries. Please be patient
📷 Screenshot of your #42SmartBlock workflow/template from Roam
💡 Additional Info
You can see the full code in glitch. It's a very basic Express App: https://glitch.com/~shakespeare-quote