redditSearchmain.tsx4 matches
1516// Use Browserbase (with proxy) to search and scrape Reddit results
17export async function redditSearch({
18query,
19apiKey = Deno.env.get("BROWSERBASE_API_KEY"),
46}
4748function constructSearchUrl(query: string): string {
49const encodedQuery = encodeURIComponent(query).replace(/%20/g, "+");
50return `https://www.reddit.com/search/?q=${encodedQuery}&type=link&t=week`;
51}
5253async function extractPostData(page: any): Promise<Partial<ThreadResult>[]> {
54return page.evaluate(() => {
55const posts = document.querySelectorAll("div[data-testid=\"search-post-unit\"]");
67}
6869async function processPostData(postData: Partial<ThreadResult>[]): Promise<ThreadResult[]> {
70const processedData: ThreadResult[] = [];
71
slackScoutmain.tsx10 matches
15}
1617export default async function(interval: Interval): Promise<void> {
18try {
19await createTable();
3839// Create an SQLite table
40async function createTable(): Promise<void> {
41await sqlite.execute(`
42CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
5051// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53return hackerNewsSearch({
54query: topic,
58}
5960async function fetchTwitterResults(topic: string): Promise<Website[]> {
61return twitterSearch({
62query: topic,
67}
6869async function fetchRedditResults(topic: string): Promise<Website[]> {
70return redditSearch({ query: topic });
71}
7273function formatSlackMessage(website: Website): string {
74const displayTitle = website.title || website.url;
75return `*<${website.url}|${displayTitle}>*
78}
7980async function sendSlackMessage(message: string): Promise<Response> {
81const slackWebhookUrl = Deno.env.get("SLACK_WEBHOOK_URL");
82if (!slackWebhookUrl) {
104}
105106async function isURLInTable(url: string): Promise<boolean> {
107const result = await sqlite.execute({
108sql: `SELECT 1 FROM ${TABLE_NAME} WHERE url = :url LIMIT 1`,
112}
113114async function addWebsiteToTable(website: Website): Promise<void> {
115await sqlite.execute({
116sql: `INSERT INTO ${TABLE_NAME} (source, url, title, date_published)
120}
121122async function processResults(results: Website[]): Promise<void> {
123for (const website of results) {
124if (!(await isURLInTable(website.url))) {
11const client = new OpenAI({ apiKey: Deno.env.get("OPENAI_API_KEY") });
1213async function main() {
14const stream = client.beta.chat.completions.stream({
15model: "gpt-4o-mini",
twitterSearchmain.tsx2 matches
11}
1213function formatTweetText(text: string): string {
14// Remove any URLs from the text
15text = text.replace(/https?:\/\/\S+/g, "");
32}
3334export async function twitterSearch({
35query,
36maxResults = 4,
ForestryFinancialModelmain.tsx3 matches
21);
2223function App() {
24const [landSize, setLandSize] = useState(1000);
25const [sections, setSections] = useState(5);
124}
125126function client() {
127createRoot(document.getElementById("root")).render(<App />);
128}
132}
133134export default async function server(request: Request): Promise<Response> {
135return new Response(`
136<!DOCTYPE html>
hackerNewsSearchmain.tsx8 matches
9}
1011export async function hackerNewsSearch({
12query = "Artificial Intelligence",
13pages = 3,
101}
102103async function scrapePageThreads(page) {
104const scrollToBottom = async () => {
105await page.evaluate(async () => {
122await scrollToBottom();
123124return page.evaluate(async (dateConverterFunctionString) => {
125const convertDateInBrowser = async (relativeDate) => {
126try {
127// Reconstruct the date converter function from its string representation
128const dateConverterFunction = eval(`(${dateConverterFunctionString})`);
129const result = await dateConverterFunction({ relativeDate });
130131// Check if the result is a Response object (from a potential fetch call)
172// Return the array of thread data
173return threads;
174}, convertRelativeDateToString.toString()); // Pass the string representation of the original function
175}
176177async function goToNextPage(page, currentPage) {
178// Scroll to the bottom of the page
179await page.evaluate(async () => {
pleasedLavenderAlbatrossmain.tsx4 matches
18}
1920function MicroReact({
21id,
22reactions = "12345",
54}
5556function App() {
57return (
58<div>
76}
7778function client() {
79createRoot(document.getElementById("root")).render(<App />);
80}
84}
8586export default async function server(request: Request): Promise<Response> {
87return new Response(`
88<html>
18const inputClass = "p-2 border rounded w-full";
19const labelClass = "w-full text-sm font-bold uppercase text-emerald-800 [&>span]:pl-0.5 flex flex-col gap-2";
20function parseCookies(cookie: string) {
21const out: Record<string, string> = {};
22const c = cookie.split(";");
72<label class=${labelClass} for="description">
73<span>Description</span>
74<input required class=${inputClass} id="description" name="description" type="text" placeholder="Function to return a random number" autocomplete="off" />
75</label>
76<button class="p-2 bg-emerald-500 text-white rounded" type="submit">Generate!</button>
1import { Buffer } from "node:buffer";
23export async function pngTest(req: Request): Promise<Response> {
4var { default: pnglib } = await import("npm:pnglib");
5const w = 64;