Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/divineomega/web-article-formatter
🌐🔀📰 Converts a webpage article into other formats, like PDF, markdown, JSON, plain text...
https://github.com/divineomega/web-article-formatter
html json markdown pdf php php-library scraper webpage webpage-scraper
Last synced: 21 days ago
JSON representation
🌐🔀📰 Converts a webpage article into other formats, like PDF, markdown, JSON, plain text...
- Host: GitHub
- URL: https://github.com/divineomega/web-article-formatter
- Owner: DivineOmega
- License: lgpl-3.0
- Created: 2018-03-24T23:01:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-04-12T21:42:54.000Z (over 6 years ago)
- Last Synced: 2024-10-15T02:38:09.414Z (about 1 month ago)
- Topics: html, json, markdown, pdf, php, php-library, scraper, webpage, webpage-scraper
- Language: PHP
- Homepage:
- Size: 16.6 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🌐🔀📰 Web Article Formatter
[![StyleCI](https://styleci.io/repos/126647242/shield?branch=master)](https://styleci.io/repos/126647242)
The web article formatter can extract and convert an article from a webpage into a number of other formats,
including PDF, markdown, JSON, plain text and more.## Installation
You can install Web Article Formatter via Composer. Just run the following command.
```
composer require divineomega/web-article-formatter
```## Usage
To retrieve a web page article and convert it into a different format, first create a new `WebArticleFormatter`
passing it the URL of the web page. Then, simply call the formatter's `get` method, passing it a valid format constant.A list of all format constants can be found in the [`Format` class](src/Format.php).
```php
$formatter = new WebArticleFormatter($url);echo $formatter->get(Format::PLAINTEXT);
echo $formatter->get(Format::MARKDOWN);
echo $formatter->get(Format::HTML);
echo $formatter->get(Format::JSON);file_put_contents('article.pdf', $formatter->get(Format::PDF));
```