Basic usage
Get a random quote
curl "https://quotes.jepcd.com/quotes"
Get multiple quotes
curl "https://quotes.jepcd.com/quotes/5"
You can request up to 10 quotes at a time. Requests for more than 10 will be capped at 10.
Filtering examples
Get quotes from a specific show
curl "https://quotes.jepcd.com/quotes?show=friends"
Get short quotes only
curl "https://quotes.jepcd.com/quotes?short=true"
Combine filters
curl "https://quotes.jepcd.com/quotes/3?show=the%20office&short=true"
Real-world use cases
Quote of the day widget
Display a random quote on your website that refreshes daily:// Fetch and cache a quote for 24 hours
async function getDailyQuote() {
const cached = localStorage.getItem('dailyQuote');
const cacheDate = localStorage.getItem('quoteDate');
const today = new Date().toDateString();
if (cached && cacheDate === today) {
return JSON.parse(cached);
}
const response = await fetch('https://quotes.jepcd.com/quotes?short=true');
const quote = await response.json();
localStorage.setItem('dailyQuote', JSON.stringify(quote));
localStorage.setItem('quoteDate', today);
return quote;
}
// Display the quote
getDailyQuote().then(quote => {
document.getElementById('quote-text').textContent = quote.text;
document.getElementById('quote-character').textContent =
`— ${quote.character}, ${quote.show}`;
});
Slack bot
Create a Slack bot that posts random TV quotes:const { WebClient } = require('@slack/web-api');
const fetch = require('node-fetch');
const slack = new WebClient(process.env.SLACK_TOKEN);
async function postRandomQuote(channel) {
const response = await fetch('https://quotes.jepcd.com/quotes');
const quote = await response.json();
await slack.chat.postMessage({
channel: channel,
text: `*${quote.character}* (${quote.show})\n> ${quote.text}`
});
}
// Post every hour
setInterval(() => postRandomQuote('#general'), 60 * 60 * 1000);
Discord bot
A Discord bot that responds to commands with TV quotes:const { Client, GatewayIntentBits } = require('discord.js');
const fetch = require('node-fetch');
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
});
client.on('messageCreate', async message => {
if (message.content === '!quote') {
const response = await fetch('https://quotes.jepcd.com/quotes');
const quote = await response.json();
message.reply(`**${quote.character}** (${quote.show})\n> ${quote.text}`);
}
// Quote from specific show
if (message.content.startsWith('!quote ')) {
const show = message.content.slice(7);
const url = `https://quotes.jepcd.com/quotes?show=${encodeURIComponent(show)}`;
try {
const response = await fetch(url);
if (response.ok) {
const quote = await response.json();
message.reply(`**${quote.character}** (${quote.show})\n> ${quote.text}`);
} else {
message.reply(`Couldn't find quotes for "${show}"`);
}
} catch (error) {
message.reply('Error fetching quote!');
}
}
});
client.login(process.env.DISCORD_TOKEN);
CLI tool
A simple command-line tool to fetch quotes:import requests
import sys
import argparse
def get_quote(show=None, short=False, count=1):
url = f"https://quotes.jepcd.com/quotes/{count}" if count > 1 else "https://quotes.jepcd.com/quotes"
params = {}
if show:
params['show'] = show
if short:
params['short'] = 'true'
response = requests.get(url, params=params)
if response.status_code == 200:
return response.json()
else:
print(f"Error: {response.text}", file=sys.stderr)
sys.exit(1)
def main():
parser = argparse.ArgumentParser(description='Get random TV show quotes')
parser.add_argument('-s', '--show', help='Filter by TV show name')
parser.add_argument('-n', '--number', type=int, default=1, help='Number of quotes (max 10)')
parser.add_argument('--short', action='store_true', help='Get only short quotes')
args = parser.parse_args()
quotes = get_quote(show=args.show, short=args.short, count=args.number)
if isinstance(quotes, list):
for quote in quotes:
print(f"[{quote['show']}] {quote['character']}:")
print(f" {quote['text']}\n")
else:
print(f"[{quotes['show']}] {quotes['character']}:")
print(f" {quotes['text']}")
if __name__ == '__main__':
main()
Save this as
quote.py and run with: python quote.py --show "breaking bad" --number 3React component
A React component that displays random quotes:import { useState, useEffect } from 'react';
function QuoteDisplay({ show, short = false }) {
const [quote, setQuote] = useState(null);
const [loading, setLoading] = useState(true);
const fetchQuote = async () => {
setLoading(true);
const params = new URLSearchParams();
if (show) params.append('show', show);
if (short) params.append('short', 'true');
const url = `https://quotes.jepcd.com/quotes?${params}`;
const response = await fetch(url);
const data = await response.json();
setQuote(data);
setLoading(false);
};
useEffect(() => {
fetchQuote();
}, [show, short]);
if (loading) return <div>Loading...</div>;
return (
<div className="quote-card">
<blockquote>"{quote.text}"</blockquote>
<cite>— {quote.character}, {quote.show}</cite>
<button onClick={fetchQuote}>New Quote</button>
</div>
);
}
export default QuoteDisplay;
Twitter bot
Post random quotes to Twitter/X:const { TwitterApi } = require('twitter-api-v2');
const fetch = require('node-fetch');
const client = new TwitterApi({
appKey: process.env.TWITTER_API_KEY,
appSecret: process.env.TWITTER_API_SECRET,
accessToken: process.env.TWITTER_ACCESS_TOKEN,
accessSecret: process.env.TWITTER_ACCESS_SECRET,
});
async function tweetRandomQuote() {
const response = await fetch('https://quotes.jepcd.com/quotes?short=true');
const quote = await response.json();
const tweet = `"${quote.text}"\n\n— ${quote.character}, ${quote.show}`;
// Tweet must be under 280 characters
if (tweet.length <= 280) {
await client.v2.tweet(tweet);
console.log('Quote tweeted successfully!');
} else {
console.log('Quote too long, trying again...');
await tweetRandomQuote(); // Retry with another quote
}
}
// Tweet every 4 hours
setInterval(tweetRandomQuote, 4 * 60 * 60 * 1000);
Error handling
Always handle errors gracefully:async function fetchQuoteSafely(show) {
try {
const params = show ? `?show=${encodeURIComponent(show)}` : '';
const response = await fetch(`https://quotes.jepcd.com/quotes${params}`);
if (!response.ok) {
if (response.status === 404) {
console.error(`No quotes found for show: ${show}`);
return null;
}
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
} catch (error) {
console.error('Failed to fetch quote:', error);
return null;
}
}
The API doesn’t require authentication or rate limiting, but please use it responsibly.