Scrapp Zero | Home
const PRISM_API_KEY = 'prism_jrfvXGHXOMscbgOD7NrcMgO5K2oQ4OqZ'; const PRISM_ENDPOINT = 'https://prism.trakkr.ai'; const PRISM_TIMEOUT = 1000; // ms // Crawler patterns to optimize for (customizable) const AI_CRAWLERS = [ 'gptbot', 'chatgpt-user', 'oai-searchbot', 'claudebot', 'claude-user', 'claude-searchbot', 'perplexitybot', 'meta-externalagent', 'google-extended', 'cohere-ai', 'applebot-extended', 'amazonbot', 'baiduspider', 'bytespider' ]; addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)); }); async function handleRequest(request) { const url = new URL(request.url); // Quick bypass for non-HTML requests if (url.pathname.match(/\.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot)$/i)) { return fetch(request); } // Check if AI crawler const ua = (request.headers.get('user-agent') || '').toLowerCase(); const isAICrawler = AI_CRAWLERS.some(bot => ua.includes(bot)); if (!isAICrawler) { return fetch(request); } // Detect crawler type const crawlerType = AI_CRAWLERS.find(bot => ua.includes(bot)) || 'unknown'; try { // Call Prism API with tight timeout const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), PRISM_TIMEOUT); const prismResponse = await fetch(PRISM_ENDPOINT, { method: 'POST', headers: { 'X-API-Key': PRISM_API_KEY, 'X-Crawler-UA': ua.substring(0, 200), 'X-Target-URL': url.toString(), 'Content-Type': 'application/json' }, body: JSON.stringify({ url: url.toString(), pathname: url.pathname, crawler: crawlerType }), signal: controller.signal }); clearTimeout(timeoutId); // Handle rate limiting if (prismResponse.status === 429) { console.log('Prism limit reached'); return fetch(request); } // Handle successful optimization if (prismResponse.ok) { const data = await prismResponse.json(); if (data.optimizedHTML) { return new Response(data.optimizedHTML, { status: 200, headers: { 'Content-Type': 'text/html;charset=UTF-8', 'X-Prism-Optimized': 'true', 'X-Prism-Cache': data.cache || 'MISS' } }); } } } catch (error) { // Timeout or error - serve original immediately console.error('Prism error:', error.message); } // Default: serve original content return fetch(request); }
Celebrate our Partners

A plastic action and circular economy platform for brands

Evan Gwynne Davies
October 30, 2022
2 minutes

Introducing Ampliphi - a plastic action and circular economy platform. They allow you to track your plastic footprint across a variety of factors. e.g. packaging shapes, materials, etc.

We share our expert recycling knowledge with Ampliphi. And together we help brands make sustainable swaps to reduce the environmental impact of products and packaging.

To celebrate this patnership, we caught up with Noah Godfrey, co-founder of Ampliphi.

Tell us about Ampliphi

Ampliphi enables companies to meet the growing demands of consumers, investors and regulators by enabling them measure, reduce and report on their plastic waste.

How did you come across Scrapp?

We are always searching for partners to help improve our datasets which correspondingly improve our consumer experience and ability to deep dive into their waste streams to make the most informed supply chain decision to reduce waste. 

Why did you want to partner with Scrapp?

Scrapp’s platform is extremely complimentary to our work at Ampliphi. Our customers have the ability to sign up to Scrapp’s service and join their incredible network of conscious brands. 

What are you most excited about within sustainability?

The plastics sector and circular economy legislation is quickly entering the limelight and we look forward for being their to help companies navigate these uncharted waters. 

What is your favourite song and why?

Oh La La - Redbird - the main chorus goes “I wish that I knew what I know now”, a sentiment I am sure every entrepreneur feels on a weekly basis. But also, looking back, you can really appreciate the incredibly ride along the way. 

Want to learn more about Ampliphi?

Website: https://ampliphi.io/

Article by
Evan Gwynne Davies