Spaces:
Runtime error
Runtime error
Download scrape.html from harrycool12/Mining-misconceptionNew: direct link, hf CLI and curl.
- Browser
- Download file 4.26 kB
-
https://huggingface.co/spaces/harrycool12/Mining-misconceptionNew/resolve/main/scrape.html
- Command line
-
hf download hf://spaces/harrycool12/Mining-misconceptionNew/scrape.html
-
curl -L -o scrape.html https://huggingface.co/spaces/harrycool12/Mining-misconceptionNew/resolve/main/scrape.html
4.26 kB
| {% extends 'layout.html' %} | |
| {% block title %}Web Scraper | Math Misconception Detector{% endblock %} | |
| {% block content %} | |
| <div class="container mt-5"> | |
| <div class="row"> | |
| <div class="col-12"> | |
| <div class="card mb-4 shadow-sm"> | |
| <div class="card-header bg-gradient"> | |
| <h1 class="mb-0">Web Scraper</h1> | |
| </div> | |
| <div class="card-body"> | |
| <p class="lead">Extract text content from any website URL using advanced NLP techniques.</p> | |
| <form id="scrape-form" class="mb-4"> | |
| <div class="mb-3"> | |
| <label for="url" class="form-label">Website URL</label> | |
| <div class="input-group"> | |
| <input type="url" class="form-control" id="url" name="url" | |
| placeholder="https://example.com" required> | |
| <button type="submit" class="btn btn-primary"> | |
| <i class="fas fa-spider me-2"></i> Scrape Content | |
| </button> | |
| </div> | |
| <div class="form-text">Enter a complete URL including https://</div> | |
| </div> | |
| </form> | |
| <div id="loading" class="text-center d-none"> | |
| <div class="spinner-border text-primary" role="status"> | |
| <span class="visually-hidden">Loading...</span> | |
| </div> | |
| <p class="mt-2">Extracting content, please wait...</p> | |
| </div> | |
| <div id="results" class="d-none"> | |
| <h4 class="mb-3">Extracted Content</h4> | |
| <div class="card bg-light"> | |
| <div class="card-body"> | |
| <pre id="content-display" class="mb-0" style="white-space: pre-wrap;"></pre> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="error-message" class="alert alert-danger d-none mt-3"></div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| {% endblock %} | |
| {% block scripts %} | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const scrapeForm = document.getElementById('scrape-form'); | |
| const loadingDiv = document.getElementById('loading'); | |
| const resultsDiv = document.getElementById('results'); | |
| const contentDisplay = document.getElementById('content-display'); | |
| const errorMessage = document.getElementById('error-message'); | |
| scrapeForm.addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| // Get form data | |
| const formData = new FormData(scrapeForm); | |
| const url = formData.get('url'); | |
| // Reset previous results | |
| resultsDiv.classList.add('d-none'); | |
| errorMessage.classList.add('d-none'); | |
| loadingDiv.classList.remove('d-none'); | |
| // Send request to server | |
| fetch('/scrape', { | |
| method: 'POST', | |
| body: formData | |
| }) | |
| .then(response => response.json()) | |
| .then(data => { | |
| loadingDiv.classList.add('d-none'); | |
| if (data.status === 'success') { | |
| contentDisplay.textContent = data.content; | |
| resultsDiv.classList.remove('d-none'); | |
| } else { | |
| errorMessage.textContent = data.message; | |
| errorMessage.classList.remove('d-none'); | |
| } | |
| }) | |
| .catch(error => { | |
| loadingDiv.classList.add('d-none'); | |
| errorMessage.textContent = 'Error connecting to server. Please try again.'; | |
| errorMessage.classList.remove('d-none'); | |
| console.error('Error:', error); | |
| }); | |
| }); | |
| }); | |
| </script> | |
| {% endblock %} |