Added URL verification functionality to the Analyze tab that allows users to verify URLs using the same text detection model (91% accuracy).
File: src/components/AnalyzePageWithDragDrop.tsx
-
Added URL content type:
- Updated
ContentTypeto include'url' - Added
Linkicon import from lucide-react - Added URL tab to the 5 content type tabs
- Updated
-
Added URL state management:
- Added
urlInputstate for storing URL input - Reset URL input when switching tabs
- Added
-
Added URL input field:
- Created URL input section with placeholder
- Added helper text explaining the feature
- Input validates URL format (http/https)
-
Updated analysis logic:
- Added URL validation before analysis
- Added
/api/v1/check-urlendpoint call - Displays URL source in results
-
Updated UI:
- Changed grid from 4 to 5 columns for tabs
- Added URL-specific validation
- Updated button disabled state to include URL
File: backend/simple_server.py
-
Added URL detection endpoint:
@app.post("/api/v1/check-url", response_model=DetectionResponse) async def check_url(request: URLDetectionRequest)
-
Features:
- URL format validation (http/https)
- Simulated URL content fetching
- Extracts domain for display in results
- Uses same response model as text detection
- Returns fake/real verdict with confidence
-
Added imports:
HTTPExceptionfrom fastapiurlparsefrom urllib.parse
File: backend/ai_server_sota.py
-
Added advanced URL verification:
@app.post("/api/v1/check-url", response_model=CheckResponse) async def check_url(request: URLCheckRequest)
-
Features:
- Real URL content fetching using
httpx - HTML parsing with
BeautifulSoup4 - Text extraction from paragraphs and headings
- Removes scripts, styles, nav, footer elements
- Reuses existing
check_text()logic - Web-based fact-checking with Tavily search
- Gemini AI verification (if available)
- Comprehensive logging
- Real URL content fetching using
-
Added imports:
urlparsefrom urllib.parse
For the advanced backend (ai_server_sota.py), install:
pip install httpx beautifulsoup4Or add to requirements.txt:
httpx>=0.24.0
beautifulsoup4>=4.12.0
- User navigates to Analyze tab
- Clicks on "URL" tab (5th tab)
- Pastes a URL (e.g.,
https://example.com/article) - Clicks "Analyze Content"
- Backend fetches the URL content
- Extracts main text from HTML
- Runs text through the same detection model (91% accuracy)
- Returns verdict: REAL, FAKE, or UNVERIFIED
Simple Server (simple_server.py):
- Validates URL format
- Simulates content fetching (mock for development)
- Returns random verdict (for testing)
Advanced Server (ai_server_sota.py):
- Fetches actual URL content with
httpx - Parses HTML with BeautifulSoup
- Extracts text from
<p>,<h1>,<h2>,<article>tags - Removes noise (scripts, styles, navigation)
- Passes extracted text to
check_text()function - Uses Tavily API for web fact-checking
- Uses Gemini AI for verification
- Compares claim with latest web sources
- Returns verdict with confidence score
- Start frontend:
npm run dev(port 3001) - Navigate to Analyze tab
- Click URL tab
- Enter a test URL
- Click "Analyze Content"
- Verify result displays correctly
Test with simple_server.py:
cd backend
python simple_server.pyTest with ai_server_sota.py:
cd backend
# Install dependencies first
pip install httpx beautifulsoup4
python ai_server_sota.pyManual API Test:
curl -X POST http://localhost:8000/api/v1/check-url \
-H "Content-Type: application/json" \
-d '{"url": "https://www.bbc.com/news/world"}'The URL verification uses the exact same model and configurations as text detection:
- Model: LIAR Political Fact-Checker / Brain2 General Fact-Checker
- Confidence: 60-95%
- Accuracy: 91% (same as text detection)
- Timeout: 10 seconds for URL fetching
- Max Content Length: 5000 characters
- Validates URL format (must start with http:// or https://)
- Shows error toast if URL is empty
- Displays error message if analysis fails
- Shows loading spinner during analysis
- Returns 400 for invalid URL format
- Returns 400 if content cannot be extracted
- Returns 500 for server errors
- Logs all errors to console
- 10-second timeout for URL fetching
- URL Access: May fail for URLs that require authentication
- JavaScript Content: Cannot extract content rendered by JavaScript
- Paywalls: Cannot access content behind paywalls
- Rate Limiting: May be blocked by aggressive rate limiting
- Content Length: Limited to 5000 characters
- Add support for JavaScript-rendered content (Playwright/Selenium)
- Implement caching for frequently checked URLs
- Add URL reputation checking (blacklist/whitelist)
- Support for PDF and other document formats
- Display article metadata (author, publish date, source)
- Show article preview/summary
- Add URL history and bookmarking
When community features are active:
- URL verifications count towards user points
- Users earn 10 points per URL check
- Verified reports earn 50 points
- URL checks appear in user stats
- Contributes to accuracy percentage
-
Test the feature:
# Terminal 1: Start backend cd backend python simple_server.py # Terminal 2: Frontend should already be running # Visit http://localhost:3001 and test URL verification
-
Install advanced dependencies (optional):
cd backend pip install httpx beautifulsoup4 -
Test with real URLs:
- Try news articles: https://www.bbc.com/news, https://www.reuters.com
- Try blog posts
- Try fact-checking sites: https://www.snopes.com
✅ src/components/AnalyzePageWithDragDrop.tsx - Frontend UI and logic
✅ backend/simple_server.py - Development/testing endpoint
✅ backend/ai_server_sota.py - Production endpoint with AI