Files
cxyz/src/index.js
T
nsrb 3799ad59f8 Add initial project structure with Docker support and chapter downloading functionality
- Created .dockerignore and .gitignore files to exclude unnecessary files from Docker builds.
- Added Dockerfile for multi-stage build setup, including dependencies and production environment configuration.
- Introduced docker-compose.yml for service orchestration, including FlareSolverr and the main application.
- Implemented core functionality for downloading manga chapters, including utilities for handling file paths and chapter metadata.
- Added ESLint configuration for code quality and consistency.
- Included JSDoc configuration for documentation generation.
- Established initial package.json and package-lock.json with necessary dependencies for the project.
2026-08-03 07:35:37 +07:00

20 lines
546 B
JavaScript

const axios = require("axios");
const { parse } = require("node-html-parser");
/**
* Fetches HTML from a URL and returns the parsed document root.
* @async
* @param {string} url - Absolute URL to fetch.
* @returns {Promise<object>} Parsed HTML root (node-html-parser tree).
*/
async function fetchAndParseHtml(url) {
const { data } = await axios.get(url, {
responseType: "text",
validateStatus: (status) => status >= 200 && status < 300,
timeout: 15_000,
});
return parse(data);
}
module.exports = { fetchAndParseHtml };