Spaces:
Paused
Paused
Download controllers/scrape.controller.js from wokogaming/ML-LT: direct link, hf CLI and curl.
- Browser
- Download file 594 Bytes
-
https://huggingface.co/spaces/wokogaming/ML-LT/resolve/main/controllers/scrape.controller.js
- Command line
-
hf download hf://spaces/wokogaming/ML-LT/controllers/scrape.controller.js
-
curl -L -o scrape.controller.js https://huggingface.co/spaces/wokogaming/ML-LT/resolve/main/controllers/scrape.controller.js
594 Bytes
| import scrapeService from '../services/scrape.service.js'; | |
| class ScrapeController { | |
| async scrape(req, res) { | |
| try { | |
| const { url } = req.body; | |
| if (!url) { | |
| return res.status(400).json({ error: 'URL is required' }); | |
| } | |
| const data = await scrapeService.scrapeUrl(url); | |
| res.json(data); | |
| } catch (error) { | |
| console.error('Scrape Error:', error.message); | |
| res.status(500).json({ | |
| error: 'Failed to scrape URL', | |
| details: error.message | |
| }); | |
| } | |
| } | |
| } | |
| export default new ScrapeController(); | |