mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-19 04:17:52 +00:00
45 lines
1.0 KiB
Markdown
45 lines
1.0 KiB
Markdown
Here's a concise version of the `README.md` for LLMs:
|
|
|
|
```markdown
|
|
# WebScraper.js
|
|
|
|
A lightweight JavaScript library for web scraping in the browser. Fetch and extract data using CSS selectors.
|
|
|
|
## Features
|
|
|
|
- Fetch HTML content from URLs.
|
|
- Extract text using CSS selectors.
|
|
- Browser-compatible with native JavaScript APIs.
|
|
|
|
## Usage
|
|
|
|
Include in HTML:
|
|
|
|
```html
|
|
<script src="/lollms_assets/js/webscraper"></script>
|
|
```
|
|
|
|
Example:
|
|
|
|
```html
|
|
<script>
|
|
(async () => {
|
|
const scraper = new WebScraper();
|
|
const data = await scraper.scrape('https://example.com', 'h1');
|
|
console.log(data);
|
|
})();
|
|
</script>
|
|
```
|
|
|
|
## Notes
|
|
|
|
- **CORS**: Ensure target URLs allow cross-origin requests.
|
|
- **Compliance**: Follow website terms of service.
|
|
- **Dynamic Content**: Does not handle JavaScript-rendered content.
|
|
|
|
## Author
|
|
|
|
By ParisNeo, AI enthusiast.
|
|
```
|
|
|
|
This version provides a quick overview of the library's purpose, features, usage, and important notes, making it suitable for quick reference or inclusion in a larger document. |