FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
neverstew
neverstewpageexplainer
Public
Like
pageexplainer
Home
Code
2
README.md
H
webpage-analyzer.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
webpage-analyzer.ts
https://neverstew--72a774c6345711f0a39d9e149126039e.web.val.run
README.md

Webpage Analyzer

This Val allows you to analyze webpages and answer questions about them based on their HTML, CSS, and JavaScript content.

Features

  • Fetches the source of any webpage
  • Extracts HTML, CSS, and JavaScript content
  • Uses OpenAI to analyze the page and answer questions about it
  • Provides a simple, user-friendly web interface
  • Also supports JSON API for programmatic usage

Usage

Web Interface

Simply visit the Val URL in your browser to use the web interface:

  • Enter a URL to analyze
  • Type your question about the webpage
  • Click "Analyze Webpage" to get your answer

API Usage

You can also use this Val programmatically by sending a POST request with JSON:

{ "url": "https://example.com", "question": "What is the main heading on this page?" }

Example using curl:

curl -X POST https://api.val.town/v1/run/yourusername/webpage-analyzer \ -H "Content-Type: application/json" \ -d '{"url": "https://example.com", "question": "What is the main heading on this page?"}'

Example using JavaScript:

const response = await fetch('https://api.val.town/v1/run/yourusername/webpage-analyzer', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ url: 'https://example.com', question: 'What is the main heading on this page?' }), }); const data = await response.json(); console.log(data.answer);

Response Format (API)

The API returns a JSON response with the following structure:

{ "url": "https://example.com", "question": "What is the main heading on this page?", "answer": "The main heading on the page is 'Example Domain'." }

Limitations

  • The Val truncates very large HTML, CSS, or JavaScript content to avoid exceeding token limits
  • JavaScript evaluation is limited to static analysis (the Val cannot execute JavaScript)
  • External resources like images, videos, or dynamically loaded content may not be fully analyzed
  • The analysis depends on the capabilities of the OpenAI model being used

Requirements

This Val requires an OpenAI API key to be set as an environment variable in your Val Town account.

HTTP
  • webpage-analyzer.ts
    neverstew--72…9e.web.val.run
Code
README.md
H
webpage-analyzer.ts
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.