3 ms·
Any chance you're going to have an API? I'd love to have a random Dune quote in my email signature. =)
by HardwareLust 4y ago
Any chance you're going to have an API? I'd love to have a random Dune quote in my email signature. =)
- milancurcic 4y agoI'd prefer not maintaining a server. If I set it up, I'll post here. All the quotes are in a JSON file that's loaded in the browser, so you could download the relevant js file and parse out the quotes data JSON. I may make this JSON file available in a public repo but I'd like to get a permission from the copyright owner before I do that. Here's a Python snippet that will download the relevant js file with the quotes data: import bs4 import requests baseurl = 'https://dailydune.app' r = requests.get(baseurl) html = bs4.BeautifulSoup(r.content) scripts = html.find_all('script') for script in scripts: src = script.get('src') if src and '/js/app.' in src: break r = requests.get(baseurl + src) I didn't go as far to extract the quotes from the response body, but it shouldn't be too difficult.