|
| 1 | +# NitroWebfetch |
| 2 | + |
| 3 | +Extract web content, cleanly. |
| 4 | + |
| 5 | +**NitroWebfetch – the developer‑friendly web content extractor with CSS selectors.** |
| 6 | + |
| 7 | +This project is in alpha phase. |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +- Extracts content from web pages using CSS selectors |
| 12 | +- Converts HTML to clean Markdown format |
| 13 | +- Fallback selectors for maximum compatibility |
| 14 | +- Command-line interface with various options |
| 15 | +- Built on Playwright for reliable web scraping |
| 16 | +- Completely free (open source, MIT license) |
| 17 | + |
| 18 | +## Ideas for next steps |
| 19 | + |
| 20 | +- Add support for multiple output formats (JSON, plain text) |
| 21 | +- Batch processing for multiple URLs |
| 22 | +- Custom user-agent and headers configuration |
| 23 | +- Integration with NitroDigest for web page summarization |
| 24 | +- Support for authentication and cookies |
| 25 | +- Content filtering and cleaning options |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +## Usage |
| 30 | + |
| 31 | +### Prerequisites |
| 32 | + |
| 33 | +To run this tool, you need to have [Python](https://www.python.org/downloads/) installed on your local machine. |
| 34 | + |
| 35 | +### Installation |
| 36 | + |
| 37 | +Install NitroWebfetch via pip: |
| 38 | + |
| 39 | +```bash |
| 40 | +pip install nitrowebfetch-cli |
| 41 | +playwright install firefox |
| 42 | +``` |
| 43 | + |
| 44 | +For development installation: |
| 45 | + |
| 46 | +```bash |
| 47 | +cd Projects/Nitrowebfetch |
| 48 | +pip install -e . |
| 49 | +playwright install firefox |
| 50 | +``` |
| 51 | + |
| 52 | +### Basic Usage |
| 53 | + |
| 54 | +Run NitroWebfetch to extract content from web pages: |
| 55 | + |
| 56 | +```bash |
| 57 | +nitrowebfetch <url> > <output_file> |
| 58 | +``` |
| 59 | + |
| 60 | +#### Examples |
| 61 | + |
| 62 | +Extract article content from a webpage and save it to a file: |
| 63 | + |
| 64 | +```bash |
| 65 | +nitrowebfetch https://example.com/article > article.md |
| 66 | +``` |
| 67 | + |
| 68 | +Extract content using a custom CSS selector: |
| 69 | + |
| 70 | +```bash |
| 71 | +nitrowebfetch https://example.com --selector ".main-content" > content.md |
| 72 | +``` |
| 73 | + |
| 74 | +Get HTML output instead of Markdown: |
| 75 | + |
| 76 | +```bash |
| 77 | +nitrowebfetch https://example.com --format html > content.html |
| 78 | +``` |
| 79 | + |
| 80 | +### Command Line Arguments |
| 81 | + |
| 82 | +You can customize the extraction process using command line arguments: |
| 83 | + |
| 84 | +```bash |
| 85 | +nitrowebfetch \ |
| 86 | + --selector ".article-body" \ |
| 87 | + --format md \ |
| 88 | + https://example.com |
| 89 | +``` |
| 90 | + |
| 91 | +Available arguments: |
| 92 | + |
| 93 | +- `url`: URL to fetch content from (required) |
| 94 | +- `--selector`: CSS selector to use for content extraction (default: article) |
| 95 | +- `--format`: Format of output content - 'md' for Markdown or 'html' for raw HTML (default: md) |
| 96 | + |
| 97 | +### Fallback Selectors |
| 98 | + |
| 99 | +If the primary selector doesn't match any elements, NitroWebfetch automatically tries these alternatives: |
| 100 | + |
| 101 | +- `article` |
| 102 | +- `main` |
| 103 | +- `.article` |
| 104 | +- `.content` |
| 105 | +- `#content` |
| 106 | +- `.post` |
| 107 | +- `.entry-content` |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +## Contributing |
| 112 | + |
| 113 | +Do you want to contribute to this tool? Check the Contributing page: |
| 114 | + |
| 115 | +[Getting started](../../Contributing.md) |
| 116 | + |
| 117 | +## Report an issue |
| 118 | + |
| 119 | +Found an issue? You can easily report it here: |
| 120 | + |
| 121 | +[https://github.com/Frodigo/garage/issues/new](https://github.com/Frodigo/garage/issues/new) |
| 122 | + |
| 123 | +## License |
| 124 | + |
| 125 | +This project is licensed under the MIT License - see the LICENSE file for details. |
0 commit comments