mirror of
https://github.com/j0k3r/php-readability.git
synced 2026-09-27 14:36:23 +00:00
Compare commits
171
Commits
v1.0.8
...
03533f5e4f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03533f5e4f | ||
|
|
009b4ab9b8 | ||
|
|
f9e73fb49a | ||
|
|
3042990efc | ||
|
|
8b89d70b1a | ||
|
|
3e9b15db46 | ||
|
|
7413a38ff0 | ||
|
|
a18cd0f2a9 | ||
|
|
efbbc86df9 | ||
|
|
541fab34a0 | ||
|
|
90869d877e | ||
|
|
c7208f6ad2 | ||
|
|
4258559b8a | ||
|
|
1ac761d708 | ||
|
|
d3053fbce4 | ||
|
|
4c929754e9 | ||
|
|
1d7cdf3a12 | ||
|
|
f825dcf55a | ||
|
|
9a9373de4b | ||
|
|
d454c3a462 | ||
|
|
8b1ef07401 | ||
|
|
5885dbbe78 | ||
|
|
6947999782 | ||
|
|
da755013aa | ||
|
|
5b9551d1e3 | ||
|
|
c7b10dcc45 | ||
|
|
80adfe870b | ||
|
|
cb6b6ac577 | ||
|
|
677f3f096e | ||
|
|
29122763db | ||
|
|
89d3b74259 | ||
|
|
e792644fe8 | ||
|
|
648d8c605b | ||
|
|
f28191a728 | ||
|
|
2103853a1b | ||
|
|
7f4c6cfcbd | ||
|
|
38870cdff1 | ||
|
|
9bdd3b6b2e | ||
|
|
f14428e4c0 | ||
|
|
23f824a1ce | ||
|
|
2a57124528 | ||
|
|
0975574bdb | ||
|
|
9ed89bde92 | ||
|
|
2c6c6d5987 | ||
|
|
c5407ec07c | ||
|
|
7cd8476d38 | ||
|
|
82083c872b | ||
|
|
6689f19956 | ||
|
|
0c0653dad6 | ||
|
|
2ab87d7445 | ||
|
|
8af69ad68c | ||
|
|
c2a1639b34 | ||
|
|
ccf1b336c5 | ||
|
|
a44c4e5482 | ||
|
|
b580cf216d | ||
|
|
2e9349f076 | ||
|
|
c4bba53dbe | ||
|
|
66215a6c80 | ||
|
|
b1a20a9575 | ||
|
|
97c02e8ad4 | ||
|
|
c506b7ebd7 | ||
|
|
d0af21814a | ||
|
|
5b1eba79bd | ||
|
|
fabf096ce6 | ||
|
|
8ce1663238 | ||
|
|
eb72a315c4 | ||
|
|
d5330a9c28 | ||
|
|
635f8963dc | ||
|
|
19b2a25d96 | ||
|
|
9a490fac07 | ||
|
|
6f6b1f9e2b | ||
|
|
ea1368fac0 | ||
|
|
be81eb2a4f | ||
|
|
9632c4df8c | ||
|
|
bd9ca1b2cd | ||
|
|
6c917794a7 | ||
|
|
7cea79c23a | ||
|
|
c6425cc28b | ||
|
|
e6ad806460 | ||
|
|
3fa88461a0 | ||
|
|
6a8ecf232f | ||
|
|
52b1ddba57 | ||
|
|
90c625bb57 | ||
|
|
4d1c3b1777 | ||
|
|
d649b59414 | ||
|
|
44bebfc3d6 | ||
|
|
b1acc9ed73 | ||
|
|
9306996b47 | ||
|
|
bb75b4f089 | ||
|
|
11d2946904 | ||
|
|
ff78c63e6d | ||
|
|
f808c1b0a2 | ||
|
|
bb65caf864 | ||
|
|
de1b1d9775 | ||
|
|
2e20f76195 | ||
|
|
3c0289bf89 | ||
|
|
74d9cc605a | ||
|
|
6a0f3337a6 | ||
|
|
2dce2879bf | ||
|
|
49ce4233fa | ||
|
|
26c881d864 | ||
|
|
db69fe59a2 | ||
|
|
a78f01f656 | ||
|
|
db4508003b | ||
|
|
15b12ea2d6 | ||
|
|
694f0308fe | ||
|
|
bbe9021fe7 | ||
|
|
9dee4a240d | ||
|
|
eef6d6d456 | ||
|
|
30a577c617 | ||
|
|
70b393a2a3 | ||
|
|
9ab6d0d9e8 | ||
|
|
8712db510e | ||
|
|
422c74f29c | ||
|
|
ed3393a79f | ||
|
|
63cd304dba | ||
|
|
43939f88d9 | ||
|
|
3a7350a8a7 | ||
|
|
4c68cc9f09 | ||
|
|
276684ab6d | ||
|
|
163058aeff | ||
|
|
6427dd7371 | ||
|
|
613a63c062 | ||
|
|
05089bbd03 | ||
|
|
5ac82f3c87 | ||
|
|
85fb92a042 | ||
|
|
f2a43b476c | ||
|
|
6def743902 | ||
|
|
8a44926392 | ||
|
|
8c7740f073 | ||
|
|
6a4720c951 | ||
|
|
7a9a82b543 | ||
|
|
8a91d36294 | ||
|
|
669adfb20f | ||
|
|
445b889efb | ||
|
|
8b1c3f147d | ||
|
|
a505a13d0c | ||
|
|
9fe0d07805 | ||
|
|
e5d31b93d1 | ||
|
|
6e24a5d731 | ||
|
|
ff754b80bd | ||
|
|
ade850534c | ||
|
|
d97bece7c5 | ||
|
|
47ce4fb7f9 | ||
|
|
3de4e918b4 | ||
|
|
5182d6cb11 | ||
|
|
fb9810a827 | ||
|
|
22aa4c3b31 | ||
|
|
2ef400bf73 | ||
|
|
dec4514c00 | ||
|
|
00f622e9b7 | ||
|
|
7b47e2f1de | ||
|
|
c756ec067e | ||
|
|
8ab7d76cd5 | ||
|
|
149a333b40 | ||
|
|
209c404d7b | ||
|
|
6e3f2e8c0b | ||
|
|
8cbecd7e99 | ||
|
|
438699ab15 | ||
|
|
ea7a62d352 | ||
|
|
9181fd1a2c | ||
|
|
2951936e00 | ||
|
|
92965f76cf | ||
|
|
850ade16b6 | ||
|
|
dc590542f0 | ||
|
|
41d7440c6e | ||
|
|
252bb4ef42 | ||
|
|
7c30d76b6e | ||
|
|
111cb08034 | ||
|
|
74fbf6f009 | ||
|
|
1565a6819a |
+3
-2
@@ -4,9 +4,10 @@ root = true
|
||||
; Unix-style newlines
|
||||
[*]
|
||||
end_of_line = LF
|
||||
|
||||
[*.php]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[.github/**.yml]
|
||||
indent_size = 2
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/.editorconfig export-ignore
|
||||
/.gitattributes export-ignore
|
||||
/.gitignore export-ignore
|
||||
/.scrutinizer.yml export-ignore
|
||||
/.travis.yml export-ignore
|
||||
/.php_cs export-ignore
|
||||
/phpunit.xml.dist export-ignore
|
||||
/phpstan.neon export-ignore
|
||||
/rector.php export-ignore
|
||||
/.github export-ignore
|
||||
/tests export-ignore
|
||||
@@ -0,0 +1 @@
|
||||
github: j0k3r
|
||||
@@ -0,0 +1,47 @@
|
||||
name: "CS"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
coding-standards:
|
||||
name: "CS Fixer & PHPStan"
|
||||
runs-on: "ubuntu-22.04"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php:
|
||||
- "7.4"
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v4"
|
||||
|
||||
- name: "Install PHP"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
coverage: "none"
|
||||
php-version: "${{ matrix.php }}"
|
||||
tools: cs2pr, composer:v2
|
||||
ini-values: "date.timezone=Europe/Paris"
|
||||
env:
|
||||
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v3"
|
||||
with:
|
||||
composer-options: "--optimize-autoloader --prefer-dist"
|
||||
|
||||
- name: "Run PHP CS Fixer"
|
||||
run: "php vendor/bin/php-cs-fixer fix --verbose --dry-run --format=checkstyle | cs2pr"
|
||||
|
||||
- name: "Install PHPUnit for PHPStan"
|
||||
run: "php vendor/bin/simple-phpunit install"
|
||||
|
||||
- name: "Run PHPStan"
|
||||
run: "php vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr"
|
||||
@@ -0,0 +1,151 @@
|
||||
name: "CI"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "master"
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
|
||||
env:
|
||||
fail-fast: true
|
||||
|
||||
jobs:
|
||||
phpunit:
|
||||
name: "PHPUnit (PHP ${{ matrix.php }})"
|
||||
runs-on: "ubuntu-22.04"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php:
|
||||
- "7.4"
|
||||
- "8.0"
|
||||
- "8.1"
|
||||
- "8.2"
|
||||
- "8.3"
|
||||
- "8.4"
|
||||
- "8.5"
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v4"
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: "Install PHP"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
php-version: "${{ matrix.php }}"
|
||||
coverage: "none"
|
||||
tools: composer:v2
|
||||
extensions: tidy
|
||||
ini-values: "date.timezone=Europe/Paris"
|
||||
env:
|
||||
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: "Remove useless deps"
|
||||
run: "composer remove friendsofphp/php-cs-fixer --dev --no-progress --no-update"
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v3"
|
||||
with:
|
||||
composer-options: "--optimize-autoloader --prefer-dist"
|
||||
|
||||
- name: "Setup logs"
|
||||
run: "mkdir -p build/logs"
|
||||
|
||||
- name: "Run PHPUnit"
|
||||
run: "php vendor/bin/simple-phpunit -v"
|
||||
|
||||
phpunit-coverage:
|
||||
name: "PHPUnit coverage (PHP ${{ matrix.php }})"
|
||||
runs-on: "ubuntu-22.04"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php:
|
||||
- "8.0"
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v4"
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: "Install PHP with Xdebug"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
php-version: "${{ matrix.php }}"
|
||||
coverage: "xdebug"
|
||||
tools: composer:v2
|
||||
extensions: tidy
|
||||
ini-values: "date.timezone=Europe/Paris"
|
||||
env:
|
||||
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: "Remove useless deps"
|
||||
run: "composer remove friendsofphp/php-cs-fixer --dev --no-progress --no-update"
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v3"
|
||||
with:
|
||||
composer-options: "--optimize-autoloader --prefer-dist"
|
||||
|
||||
- name: "Setup logs"
|
||||
run: "mkdir -p build/logs"
|
||||
|
||||
- name: "Run PHPUnit (with coverage)"
|
||||
run: "php vendor/bin/simple-phpunit -v --coverage-clover build/logs/clover.xml"
|
||||
|
||||
- name: "Retrieve Coveralls phar"
|
||||
run: "wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.7.0/php-coveralls.phar"
|
||||
|
||||
- name: "Enable Coveralls phar"
|
||||
run: "chmod +x php-coveralls.phar"
|
||||
|
||||
- name: "Upload to Coveralls"
|
||||
run: "php php-coveralls.phar -v -x build/logs/clover.xml"
|
||||
env:
|
||||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
phpunit-lowest:
|
||||
name: "PHPUnit lowest deps (PHP ${{ matrix.php }})"
|
||||
runs-on: "ubuntu-22.04"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php:
|
||||
- "7.4"
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v4"
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: "Install PHP"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
php-version: "${{ matrix.php }}"
|
||||
coverage: "none"
|
||||
tools: composer:v2
|
||||
extensions: tidy
|
||||
ini-values: "date.timezone=Europe/Paris"
|
||||
env:
|
||||
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: "Remove useless deps"
|
||||
run: "composer remove friendsofphp/php-cs-fixer --dev --no-progress --no-update"
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v3"
|
||||
with:
|
||||
composer-options: "--optimize-autoloader --prefer-dist"
|
||||
dependency-versions: "lowest"
|
||||
|
||||
- name: "Setup logs"
|
||||
run: "mkdir -p build/logs"
|
||||
|
||||
- name: "Run PHPUnit"
|
||||
run: "php vendor/bin/simple-phpunit -v"
|
||||
@@ -1,3 +1,7 @@
|
||||
vendor/
|
||||
coverage/
|
||||
composer.lock
|
||||
.php_cs.cache
|
||||
.php-cs-fixer.cache
|
||||
.phpunit.result.cache
|
||||
phpstan.neon
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
$finder = (new PhpCsFixer\Finder())
|
||||
->in(__DIR__)
|
||||
->exclude(['vendor', 'var', 'web'])
|
||||
;
|
||||
|
||||
return (new PhpCsFixer\Config())
|
||||
->setUsingCache(true)
|
||||
->setRiskyAllowed(true)
|
||||
->setRules([
|
||||
'@Symfony' => true,
|
||||
'@Symfony:risky' => true,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'combine_consecutive_unsets' => true,
|
||||
'heredoc_to_nowdoc' => true,
|
||||
'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']],
|
||||
'no_unreachable_default_argument_value' => true,
|
||||
'no_useless_else' => true,
|
||||
'no_useless_return' => true,
|
||||
'ordered_class_elements' => true,
|
||||
'ordered_imports' => true,
|
||||
'php_unit_strict' => false,
|
||||
'phpdoc_order' => true,
|
||||
// 'psr4' => true,
|
||||
'strict_comparison' => true,
|
||||
'strict_param' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
// Pulled in by @Symfony:risky but we still support PHP 7.4
|
||||
'modernize_strpos' => false,
|
||||
// Pulled in by @Symfony, we cannot add property types until we bump PHP to ≥ 7.4
|
||||
'no_null_property_initialization' => false,
|
||||
])
|
||||
->setFinder($finder)
|
||||
;
|
||||
@@ -1,3 +0,0 @@
|
||||
tools:
|
||||
external_code_coverage:
|
||||
timeout: 600
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.3.3
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- nightly
|
||||
- hhvm
|
||||
|
||||
# run build against nightly but allow them to fail
|
||||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
- php: hhvm
|
||||
|
||||
# faster builds on new travis setup not using sudo
|
||||
sudo: false
|
||||
|
||||
install:
|
||||
- composer self-update
|
||||
|
||||
before_script:
|
||||
- composer install --prefer-dist --no-interaction
|
||||
|
||||
script:
|
||||
- phpunit --coverage-clover=coverage.clover
|
||||
|
||||
after_script:
|
||||
- |
|
||||
wget https://scrutinizer-ci.com/ocular.phar
|
||||
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
|
||||
@@ -1,13 +1,15 @@
|
||||
# Readability
|
||||
|
||||
[](https://travis-ci.org/j0k3r/php-readability)
|
||||
[](https://scrutinizer-ci.com/g/j0k3r/php-readability/?branch=master)
|
||||

|
||||
[](https://coveralls.io/github/j0k3r/php-readability/?branch=master)
|
||||
[](https://packagist.org/packages/j0k3r/php-readability)
|
||||
[](https://packagist.org/packages/j0k3r/php-readability)
|
||||
|
||||
This is an extract of the Readability class from the [full-text-rss](https://github.com/Dither/full-text-rss) fork. It kind be defined as a better version of the original [php-readability](https://bitbucket.org/fivefilters/php-readability/overview).
|
||||
This is an extract of the Readability class from this [full-text-rss](https://github.com/Dither/full-text-rss) fork. It can be defined as a better version of the original [php-readability](https://bitbucket.org/fivefilters/php-readability).
|
||||
|
||||
## Differences
|
||||
|
||||
The default php-readability lib is really old and needs to be improved. I found a great fork of [full-text-rss](http://fivefilters.org/content-only/) from @Dither which improve the Readability class.
|
||||
The default php-readability lib is really old and needs to be improved. I found a great fork of full-text-rss from [@Dither](https://github.com/Dither/full-text-rss) which improve the Readability class.
|
||||
|
||||
- I've extracted the class from its fork to be able to use it out of the box
|
||||
- I've added some simple tests
|
||||
@@ -15,6 +17,12 @@ The default php-readability lib is really old and needs to be improved. I found
|
||||
|
||||
**But** the code is still really hard to understand / read ...
|
||||
|
||||
## Requirements
|
||||
|
||||
By default, this lib will use the [Tidy extension](https://github.com/htacg/tidy-html5) if it's available. Tidy is only used to cleanup the given HTML and avoid problems with bad HTML structure, etc .. It'll be suggested by Composer.
|
||||
|
||||
Also, if you got problem from parsing a content without Tidy installed, please install it and try again.
|
||||
|
||||
## Usage
|
||||
|
||||
```php
|
||||
@@ -26,6 +34,8 @@ $url = 'http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/729-
|
||||
$html = file_get_contents($url);
|
||||
|
||||
$readability = new Readability($html, $url);
|
||||
// or without Tidy
|
||||
// $readability = new Readability($html, $url, 'libxml', false);
|
||||
$result = $readability->init();
|
||||
|
||||
if ($result) {
|
||||
@@ -37,3 +47,20 @@ if ($result) {
|
||||
echo 'Looks like we couldn\'t find the content. :(';
|
||||
}
|
||||
```
|
||||
|
||||
If you want to debug it, or check what's going on, you can inject a logger (which must follow `Psr\Log\LoggerInterface`, Monolog for example):
|
||||
|
||||
```php
|
||||
use Readability\Readability;
|
||||
use Monolog\Logger;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
|
||||
$url = 'http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/729-thatcher.html';
|
||||
$html = file_get_contents($url);
|
||||
|
||||
$logger = new Logger('readability');
|
||||
$logger->pushHandler(new StreamHandler('path/to/your.log', Logger::DEBUG));
|
||||
|
||||
$readability = new Readability($html, $url);
|
||||
$readability->setLogger($logger);
|
||||
```
|
||||
|
||||
+24
-2
@@ -24,10 +24,32 @@
|
||||
"role": "Developer (original JS version)"
|
||||
}],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"ext-tidy": ">=1.2"
|
||||
"php": ">=7.4.0",
|
||||
"ext-mbstring": "*",
|
||||
"psr/log": "^1.0.1 || ^2.0 || ^3.0",
|
||||
"masterminds/html5": "^2.7"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.0",
|
||||
"monolog/monolog": "^1.24|^2.1",
|
||||
"symfony/phpunit-bridge": "^4.4|^5.3|^6.0|^7.0",
|
||||
"phpstan/phpstan": "^2.0",
|
||||
"phpstan/phpstan-phpunit": "^2.0",
|
||||
"rector/rector": "^2.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-tidy": "Used to clean up given HTML and to avoid problems with bad HTML structure."
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Readability\\": "src/" }
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": { "Tests\\Readability\\": "tests/" }
|
||||
},
|
||||
"scripts": {
|
||||
"fix": "php-cs-fixer fix --verbose --diff",
|
||||
"phpstan": "phpstan analyze --memory-limit 512M",
|
||||
"rector": "rector process",
|
||||
"test": "simple-phpunit -v"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
parameters:
|
||||
level: 1
|
||||
paths:
|
||||
- src
|
||||
- tests
|
||||
|
||||
# https://github.com/phpstan/phpstan/issues/694#issuecomment-350724288
|
||||
bootstrapFiles:
|
||||
- vendor/bin/.phpunit/phpunit/vendor/autoload.php
|
||||
|
||||
includes:
|
||||
- vendor/phpstan/phpstan-phpunit/extension.neon
|
||||
- vendor/phpstan/phpstan-phpunit/rules.neon
|
||||
+4
-5
@@ -7,12 +7,11 @@
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Readability Test Suite">
|
||||
<testsuite name="Readability">
|
||||
<directory>./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
@@ -26,7 +25,7 @@
|
||||
</whitelist>
|
||||
</filter>
|
||||
|
||||
<logging>
|
||||
<log type="coverage-html" target="coverage" title="Readability" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/>
|
||||
</logging>
|
||||
<!-- <logging>
|
||||
<log type="coverage-html" target="coverage" lowUpperBound="35" highLowerBound="70"/>
|
||||
</logging> -->
|
||||
</phpunit>
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
|
||||
return RectorConfig::configure()
|
||||
->withPaths([
|
||||
__DIR__ . '/src',
|
||||
__DIR__ . '/tests',
|
||||
])
|
||||
->withBootstrapFiles([
|
||||
__DIR__ . '/vendor/bin/.phpunit/phpunit/vendor/autoload.php',
|
||||
__DIR__ . '/vendor/autoload.php',
|
||||
])
|
||||
->withSets([LevelSetList::UP_TO_PHP_74])
|
||||
;
|
||||
+43
-22
@@ -39,24 +39,39 @@ class JSLikeHTMLElement extends \DOMElement
|
||||
/**
|
||||
* Used for setting innerHTML like it's done in JavaScript:.
|
||||
*
|
||||
* @code
|
||||
* ```php
|
||||
* $div->innerHTML = '<h2>Chapter 2</h2><p>The story begins...</p>';
|
||||
* @endcode
|
||||
* ```
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
{
|
||||
if ($name == 'innerHTML') {
|
||||
if ('innerHTML' !== $name) {
|
||||
$trace = debug_backtrace();
|
||||
trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], \E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// first, empty the element
|
||||
if (isset($this->childNodes)) {
|
||||
for ($x = $this->childNodes->length - 1; $x >= 0; --$x) {
|
||||
$this->removeChild($this->childNodes->item($x));
|
||||
}
|
||||
}
|
||||
|
||||
// $value holds our new inner HTML
|
||||
if ($value != '') {
|
||||
$value = trim($value);
|
||||
if (empty($value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// ensure bad entity won't generate warning
|
||||
$previousError = libxml_use_internal_errors(true);
|
||||
|
||||
$f = $this->ownerDocument->createDocumentFragment();
|
||||
|
||||
// appendXML() expects well-formed markup (XHTML)
|
||||
$result = @$f->appendXML($value); // @ to suppress PHP warnings
|
||||
$result = $f->appendXML($value);
|
||||
if ($result) {
|
||||
if ($f->hasChildNodes()) {
|
||||
$this->appendChild($f);
|
||||
@@ -64,59 +79,65 @@ class JSLikeHTMLElement extends \DOMElement
|
||||
} else {
|
||||
// $value is probably ill-formed
|
||||
$f = new \DOMDocument();
|
||||
$value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8');
|
||||
|
||||
// Using <htmlfragment> will generate a warning, but so will bad HTML
|
||||
// (and by this point, bad HTML is what we've got).
|
||||
// We use it (and suppress the warning) because an HTML fragment will
|
||||
// be wrapped around <html><body> tags which we don't really want to keep.
|
||||
// Note: despite the warning, if loadHTML succeeds it will return true.
|
||||
$result = @$f->loadHTML('<htmlfragment>'.$value.'</htmlfragment>');
|
||||
$result = $f->loadHTML('<meta charset="utf-8"><htmlfragment>' . $value . '</htmlfragment>');
|
||||
|
||||
if ($result) {
|
||||
$import = $f->getElementsByTagName('htmlfragment')->item(0);
|
||||
|
||||
foreach ($import->childNodes as $child) {
|
||||
$importedNode = $this->ownerDocument->importNode($child, true);
|
||||
$this->appendChild($importedNode);
|
||||
}
|
||||
} else {
|
||||
// oh well, we tried, we really did. :(
|
||||
// this element is now empty
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$trace = debug_backtrace();
|
||||
trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_NOTICE);
|
||||
}
|
||||
|
||||
libxml_clear_errors();
|
||||
libxml_use_internal_errors($previousError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for getting innerHTML like it's done in JavaScript:.
|
||||
*
|
||||
* @code
|
||||
* ```php
|
||||
* $string = $div->innerHTML;
|
||||
* @endcode
|
||||
* ```
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
if ($name == 'innerHTML') {
|
||||
if ('innerHTML' === $name) {
|
||||
$inner = '';
|
||||
|
||||
if (isset($this->childNodes)) {
|
||||
foreach ($this->childNodes as $child) {
|
||||
$inner .= $this->ownerDocument->saveXML($child);
|
||||
}
|
||||
}
|
||||
|
||||
return $inner;
|
||||
}
|
||||
|
||||
$trace = debug_backtrace();
|
||||
trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], \E_USER_NOTICE);
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return '['.$this->tagName.']';
|
||||
return '[' . $this->tagName . ']';
|
||||
}
|
||||
|
||||
public function getInnerHtml()
|
||||
{
|
||||
return $this->__get('innerHTML');
|
||||
}
|
||||
|
||||
public function setInnerHtml($value)
|
||||
{
|
||||
return $this->__set('innerHTML', $value);
|
||||
}
|
||||
}
|
||||
|
||||
+931
-784
File diff suppressed because it is too large
Load Diff
+443
-196
@@ -2,319 +2,333 @@
|
||||
|
||||
namespace Tests\Readability;
|
||||
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Readability\JSLikeHTMLElement;
|
||||
use Readability\Readability;
|
||||
|
||||
class ReadabilityTested extends Readability
|
||||
class ReadabilityTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function getDebugText()
|
||||
{
|
||||
return $this->debugText;
|
||||
}
|
||||
/** @var TestHandler */
|
||||
public $logHandler;
|
||||
/** @var LoggerInterface */
|
||||
public $logger;
|
||||
|
||||
public function getDomainRegexp()
|
||||
/**
|
||||
* @requires extension tidy
|
||||
*/
|
||||
public function testConstructDefault(): void
|
||||
{
|
||||
return $this->domainRegExp;
|
||||
}
|
||||
}
|
||||
|
||||
class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testConstructDefault()
|
||||
{
|
||||
$readability = new ReadabilityTested('');
|
||||
$readability = $this->getReadability('');
|
||||
$this->assertSame('utf8', $readability->tidy_config['input-encoding']);
|
||||
$readability->init();
|
||||
|
||||
$this->assertNull($readability->url);
|
||||
$this->assertContains('Parsing URL', $readability->getDebugText());
|
||||
$this->assertContains('Tidying document', $readability->getDebugText());
|
||||
$this->assertNull($readability->getDomainRegexp());
|
||||
$this->assertInstanceOf('DomDocument', $readability->dom);
|
||||
$this->assertInstanceOf(\DOMDocument::class, $readability->dom);
|
||||
}
|
||||
|
||||
public function testConstructSimple()
|
||||
public function testConstructHtml5Parser(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<html/>', 'http://0.0.0.0');
|
||||
$readability = $this->getReadability('<html/>', 'http://0.0.0.0', 'html5lib');
|
||||
$readability->init();
|
||||
|
||||
$this->assertEquals('http://0.0.0.0', $readability->url);
|
||||
$this->assertContains('Parsing URL', $readability->getDebugText());
|
||||
$this->assertContains('Tidying document', $readability->getDebugText());
|
||||
$this->assertEquals('/0\.0\.0\.0/', $readability->getDomainRegexp());
|
||||
$this->assertInstanceOf('DomDocument', $readability->dom);
|
||||
$this->assertSame('http://0.0.0.0', $readability->url);
|
||||
$this->assertInstanceOf(\DOMDocument::class, $readability->dom);
|
||||
$this->assertSame('<html/>', $readability->original_html);
|
||||
}
|
||||
|
||||
public function testInitNoContent()
|
||||
/**
|
||||
* @requires extension tidy
|
||||
*/
|
||||
public function testConstructSimple(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<html/>', 'http://0.0.0.0');
|
||||
$readability = $this->getReadability('<html/>', 'http://0.0.0.0');
|
||||
$readability->init();
|
||||
|
||||
$this->assertSame('http://0.0.0.0', $readability->url);
|
||||
$this->assertInstanceOf(\DOMDocument::class, $readability->dom);
|
||||
$this->assertSame('<html/>', $readability->original_html);
|
||||
$this->assertTrue($readability->tidied);
|
||||
}
|
||||
|
||||
public function testConstructDefaultWithoutTidy(): void
|
||||
{
|
||||
$readability = $this->getReadability('', null, 'libxml', false);
|
||||
$readability->init();
|
||||
|
||||
$this->assertNull($readability->url);
|
||||
$this->assertSame('', $readability->original_html);
|
||||
$this->assertFalse($readability->tidied);
|
||||
|
||||
$this->assertInstanceOf(\DOMDocument::class, $readability->dom);
|
||||
}
|
||||
|
||||
public function testConstructSimpleWithoutTidy(): void
|
||||
{
|
||||
$readability = $this->getReadability('<html/>', 'http://0.0.0.0', 'libxml', false);
|
||||
$readability->init();
|
||||
|
||||
$this->assertSame('http://0.0.0.0', $readability->url);
|
||||
$this->assertInstanceOf(\DOMDocument::class, $readability->dom);
|
||||
$this->assertSame('<html/>', $readability->original_html);
|
||||
$this->assertFalse($readability->tidied);
|
||||
}
|
||||
|
||||
public function testInitNoContent(): void
|
||||
{
|
||||
$readability = $this->getReadability('<html/>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertFalse($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('Sorry, Readability was unable to parse this page for content.', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('Sorry, Readability was unable to parse this page for content.', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testInitP()
|
||||
public function testInitP(): void
|
||||
{
|
||||
$readability = new ReadabilityTested(str_repeat('<p>This is the awesome content :)</p>', 7), 'http://0.0.0.0');
|
||||
$readability = $this->getReadability(str_repeat('<p>This is the awesome content :)</p>', 7), 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<div readability=', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is the awesome content :)', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertStringContainsString('<div readability=', $readability->getContent()->getInnerHtml());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is the awesome content :)', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testInitDivP()
|
||||
public function testInitDivP(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<div>'.str_repeat('<p>This is the awesome content :)</p>', 7).'</div>', 'http://0.0.0.0');
|
||||
$readability = $this->getReadability('<div>' . str_repeat('<p>This is the awesome content :)</p>', 7) . '</div>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<div readability=', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is the awesome content :)', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertStringContainsString('<div readability=', $readability->getContent()->getInnerHtml());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is the awesome content :)', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testInitDiv()
|
||||
public function testInitDiv(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<div>'.str_repeat('This is the awesome content :)', 7).'</div>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<div>' . str_repeat('This is the awesome content :)', 7) . '</div>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<div readability=', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is the awesome content :)', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertStringContainsString('<div readability=', $readability->getContent()->getInnerHtml());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is the awesome content :)', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testWithFootnotes()
|
||||
public function testWithFootnotes(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<div>'.str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7).'</div>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<div>' . str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7) . '</div>', 'http://0.0.0.0');
|
||||
$readability->convertLinksToFootnotes = true;
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<div readability=', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('readabilityFootnoteLink', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('readabilityLink-3', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertStringContainsString('<div readability=', $readability->getContent()->getInnerHtml());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringContainsString('readabilityFootnoteLink', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringContainsString('readabilityLink-3', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testStandardClean()
|
||||
public function testStandardClean(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<div><h2>Title</h2>'.str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7).'<a href="#nofollow" rel="nofollow">will NOT be removed</a></div>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<div><h2>Title</h2>' . str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7) . '<a href="#nofollow" rel="nofollow">will NOT be removed</a></div>', 'http://0.0.0.0');
|
||||
$readability->lightClean = false;
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<div readability=', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('will NOT be removed', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('<h2>', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertStringContainsString('<div readability=', $readability->getContent()->getInnerHtml());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringContainsString('will NOT be removed', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringNotContainsString('<h2>', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testWithIframe()
|
||||
public function testWithIframe(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<div><h2>Title</h2>'.str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7).'<p>This is an awesome text with some links, here there are <iframe src="http://youtube.com/test" href="#nofollow" rel="nofollow"></iframe><iframe>http://soundcloud.com/test</iframe></p></div>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<div><h2>Title</h2>' . str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7) . '<p>This is an awesome text with some links, here there are <iframe src="http://youtube.com/test" href="#nofollow" rel="nofollow"></iframe><iframe>http://soundcloud.com/test</iframe></p></div>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<div readability=', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('nofollow', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertStringContainsString('<div readability=', $readability->getContent()->getInnerHtml());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringContainsString('nofollow', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testWithArticle()
|
||||
public function testWithArticle(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<article><p>'.str_repeat('This is an awesome text with some links, here there are: the awesome', 20).'</p><p>This is an awesome text with some links, here there are <iframe src="http://youtube.com/test" href="#nofollow" rel="nofollow"></iframe></p></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<article><p>' . str_repeat('This is an awesome text with some links, here there are: the awesome', 20) . '</p><p>This is an awesome text with some links, here there are <iframe src="http://youtube.com/test" href="#nofollow" rel="nofollow"></iframe></p></article>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('nofollow', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertStringContainsString('alt="article"', $readability->getContent()->getInnerHtml());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringContainsString('nofollow', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testWithAside()
|
||||
public function testWithAside(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<article>'.str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7).'<footer><aside>'.str_repeat('<p>This is an awesome text with some links, here there are</p>', 8).'</aside></footer></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<article>' . str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7) . '<footer><aside>' . str_repeat('<p>This is an awesome text with some links, here there are</p>', 8) . '</aside></footer></article>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('<aside>', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('<footer/>', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringNotContainsString('<aside>', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringContainsString('<footer readability="9"/>', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testWithClasses()
|
||||
public function testWithClasses(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<article>'.str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7).'<div style="display:none">'.str_repeat('<p class="clock">This text should be removed</p>', 10).'</div></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<article>' . str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7) . '<div style="display:none">' . str_repeat('<p class="clock">This text should be removed</p>', 10) . '</div></article>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('This text should be removed', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertStringContainsString('alt="article"', $readability->getContent()->getInnerHtml());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringNotContainsString('This text should be removed', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testWithTd()
|
||||
public function testWithClassesWithoutLightClean(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<table><tr>'.str_repeat('<td><p>This is an awesome text with some links, here there are the awesome</td>', 7).'</tr></table>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<article>' . str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7) . '<div style="display:none">' . str_repeat('<p class="clock">This text should be removed</p>', 10) . '</div></article>', 'http://0.0.0.0');
|
||||
$readability->lightClean = false;
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="tr"', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertStringContainsString('alt="article"', $readability->getContent()->getInnerHtml());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringNotContainsString('This text should be removed', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testWithSameClasses()
|
||||
public function testWithTd(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<article class="awesomecontent">'.str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7).'<div class="awesomecontent">This text is also an awesome text and you should know that !</div></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<table><tr>' . str_repeat('<td><p>This is an awesome text with some links, here there are the awesome</td>', 7) . '</tr></table>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testWithScript()
|
||||
public function testWithSameClasses(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<article class="awesomecontent">'.str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7).'<p><script>This text is also an awesome text and you should know that !</script></p></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<article class="awesomecontent">' . str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7) . '<div class="awesomecontent">This text is also an awesome text and you should know that !</div></article>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringContainsString('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testTitle()
|
||||
public function testWithScript(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<title>this is my title</title><article class="awesomecontent">'.str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7).'<p></p></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<article class="awesomecontent">' . str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7) . '<p><script>This text is also an awesome text and you should know that !</script></p></article>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEquals('this is my title', $readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringNotContainsString('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testTitleWithDash()
|
||||
public function testTitle(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<title> title2 - title3 </title><article class="awesomecontent">'.str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7).'<p></p></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<title>this is my title</title><article class="awesomecontent">' . str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7) . '<p></p></article>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEquals('title2 - title3', $readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertSame('this is my title', $readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringNotContainsString('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testTitleWithDoubleDot()
|
||||
public function testTitleWithDash(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<title> title2 : title3 </title><article class="awesomecontent">'.str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7).'<p></p></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<title> title2 - title3 </title><article class="awesomecontent">' . str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7) . '<p></p></article>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEquals('title2 : title3', $readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertSame('title2 - title3', $readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringNotContainsString('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testTitleTooShortUseH1()
|
||||
public function testTitleWithDoubleDot(): void
|
||||
{
|
||||
$readability = new ReadabilityTested('<title>too short</title><h1>this is my h1 title !</h1><article class="awesomecontent">'.str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7).'<p></p></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability('<title> title2 : title3 </title><article class="awesomecontent">' . str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7) . '<p></p></article>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEquals('this is my h1 title !', $readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertSame('title2 : title3', $readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringNotContainsString('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
// public function testConstructParser()
|
||||
// {
|
||||
// $readability = new ReadabilityTested('<html/>', 'http://0.0.0.0', 'html5lib');
|
||||
public function testTitleTooShortUseH1(): void
|
||||
{
|
||||
$readability = $this->getReadability('<title>too short</title><h1>this is my h1 title !</h1><article class="awesomecontent">' . str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7) . '<p></p></article>', 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
// $this->assertEquals('http://0.0.0.0', $readability->url);
|
||||
// $this->assertContains('Parsing URL', $readability->getDebugText());
|
||||
// $this->assertContains('Tidying document', $readability->getDebugText());
|
||||
// $this->assertEquals('/0\.0\.0\.0/', $readability->getDomainRegexp());
|
||||
// $this->assertInstanceOf('DomDocument', $readability->dom);
|
||||
// }
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertSame('this is my h1 title !', $readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringNotContainsString('This text is also an awesome text and you should know that', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testAutoClosingIframeNotThrowingException(): void
|
||||
{
|
||||
$oldErrorReporting = error_reporting(\E_ALL);
|
||||
$oldDisplayErrors = ini_set('display_errors', '1');
|
||||
// dummy function to be used to the next test
|
||||
public function error2Exception($code, $string, $file, $line, $context)
|
||||
{
|
||||
throw new \Exception($string, $code);
|
||||
}
|
||||
|
||||
public function testAutoClosingIframeNotThrowingException()
|
||||
{
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
ini_set('display_errors', true);
|
||||
set_error_handler(array($this, 'error2Exception'), E_ALL | E_STRICT);
|
||||
set_error_handler(static function (int $errno, string $errstr, string $errfile, int $errline) {
|
||||
throw new \Exception($errstr, $errno);
|
||||
});
|
||||
|
||||
try {
|
||||
$data = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="ru-RU" prefix="og: http://ogp.me/ns#">
|
||||
|
||||
@@ -340,15 +354,248 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
</body>
|
||||
</html>';
|
||||
|
||||
$readability = new ReadabilityTested($data, 'http://iosgames.ru/?p=22030');
|
||||
$readability->debug = true;
|
||||
$readability = $this->getReadability($data, 'http://iosgames.ru/?p=22030');
|
||||
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
$this->assertStringContainsString('<iframe src="https://www.youtube.com/embed/PUep6xNeKjA" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"> </iframe>', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringContainsString('3D Touch', $readability->getTitle()->getInnerHtml());
|
||||
} finally {
|
||||
restore_error_handler();
|
||||
if (false !== $oldDisplayErrors) {
|
||||
ini_set('display_errors', $oldDisplayErrors);
|
||||
}
|
||||
error_reporting($oldErrorReporting);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This should generate an Exception "DOMElement::setAttribute(): ID post-60 already defined".
|
||||
*/
|
||||
public function testAppendIdAlreadyHere(): void
|
||||
{
|
||||
$data = '<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header class="header sml-text-center med-text-left" role="banner">
|
||||
<h1 class="no-margin"><a class="maintitle" href="https://0.0.0.0" title="Bloc-notes">Bloc-notes</a></h1>
|
||||
<h2 class="h5 no-margin"></h2>
|
||||
</header>
|
||||
|
||||
<nav class="nav" role="navigation">
|
||||
<div class="responsive-menu">
|
||||
<label for="menu">Menu</label>
|
||||
<input type="checkbox" id="menu">
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<article class="article" role="article" id="post-60">
|
||||
<section>
|
||||
This is an awesome text with some links, here there are<br/>
|
||||
This is an awesome text with some links, here there are<br/>
|
||||
This is an awesome text with some links, here there are<br/>
|
||||
This is an awesome text with some links, here there are<br/>
|
||||
This is an awesome text with some links, here there are<br/>
|
||||
This is an awesome text with some links, here there are<br/>
|
||||
This is an awesome text with some links, here there are<br/>
|
||||
This is an awesome text with some links, here there are<br/>
|
||||
This is an awesome text with some links, here there are<br/>
|
||||
This is an awesome text with some links, here there are<br/>
|
||||
This is an awesome text with some links, here there are
|
||||
</section>
|
||||
<footer>
|
||||
<small>
|
||||
Classé dans : <a class="noactive" title="Services réseaux">Services réseaux</a>
|
||||
</small>
|
||||
</footer>
|
||||
</article>
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
|
||||
$readability = $this->getReadability($data, 'http://0.0.0.0');
|
||||
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent());
|
||||
$this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle());
|
||||
}
|
||||
|
||||
public function testPostFilters(): void
|
||||
{
|
||||
$readability = $this->getReadability('<div>' . str_repeat('<p>This <strong>is</strong> the awesome content :)</p>', 10) . '</div>', 'http://0.0.0.0');
|
||||
$readability->addPostFilter('!<strong[^>]*>(.*?)</strong>!is', '');
|
||||
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertStringContainsString('This the awesome content :)', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testPreFilters(): void
|
||||
{
|
||||
$readability = $this->getReadability('<div>' . str_repeat('<p>This <b>is</b> the awesome and WONDERFUL content :)</p>', 7) . '</div>', 'http://0.0.0.0');
|
||||
$readability->addPreFilter('!<b[^>]*>(.*?)</b>!is', '');
|
||||
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertStringContainsString('This the awesome and WONDERFUL content :)', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testChildNodeGoneNull(): void
|
||||
{
|
||||
// from http://www.ayyaantuu.net/ethiopia-targets-opposition-lawmakers/
|
||||
$html = (string) file_get_contents('tests/fixtures/childNodeGoesNull.html');
|
||||
|
||||
$readability = $this->getReadability($html, 'http://0.0.0.0');
|
||||
$readability->convertLinksToFootnotes = true;
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
}
|
||||
|
||||
public function testKeepFootnotes(): void
|
||||
{
|
||||
// from https://www.schreibdichte.de/blog/feed-aggregator-und-spaeter-lesen-dienst-im-team
|
||||
$html = (string) file_get_contents('tests/fixtures/keepFootnotes.html');
|
||||
|
||||
$readability = $this->getReadability($html, 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertStringContainsString('<sup id="fnref1:fnfeed_2"><a href="#fn:fnfeed_2" class="footnote-ref">2</a></sup>', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringContainsString('<a href="#fnref1:fnfeed_2" rev="footnote"', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testWithWipedBody(): void
|
||||
{
|
||||
// from https://www.cs.cmu.edu/~rgs/alice-table.html
|
||||
$html = (string) file_get_contents('tests/fixtures/wipedBody.html');
|
||||
|
||||
$readability = $this->getReadability($html, 'http://0.0.0.0', 'libxml', false);
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertStringContainsString('<a href="alice-I.html">Down the Rabbit-Hole</a>', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function dataForVisibleNode(): array
|
||||
{
|
||||
return [
|
||||
'visible node' => [
|
||||
'<div>' . str_repeat('<p>This <b>is</b> the awesome and WONDERFUL content :)</p>', 7) . '</div>',
|
||||
true,
|
||||
],
|
||||
'display=none' => [
|
||||
'<div style="display:none;">' . str_repeat('<p>This <b>is</b> the awesome and WONDERFUL content :)</p>', 7) . '</div>',
|
||||
false,
|
||||
],
|
||||
'display=inline' => [
|
||||
'<div style="display:inline;">' . str_repeat('<p>This <b>is</b> the awesome and WONDERFUL content :)</p>', 7) . '</div>',
|
||||
true,
|
||||
],
|
||||
'hidden attribute' => [
|
||||
'<div hidden>' . str_repeat('<p>This <b>is</b> the awesome and WONDERFUL content :)</p>', 7) . '</div>',
|
||||
false,
|
||||
],
|
||||
'missing display' => [
|
||||
'<div style="color:#ccc;">' . str_repeat('<p>This <b>is</b> the awesome and WONDERFUL content :)</p>', 7) . '</div>',
|
||||
true,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataForVisibleNode
|
||||
*/
|
||||
public function testVisibleNode(string $content, bool $shouldBeVisible): void
|
||||
{
|
||||
$readability = $this->getReadability($content, 'http://0.0.0.0');
|
||||
$res = $readability->init();
|
||||
|
||||
if ($shouldBeVisible) {
|
||||
$this->assertStringContainsString('WONDERFUL content', $readability->getContent()->getInnerHtml());
|
||||
} else {
|
||||
$this->assertStringNotContainsString('WONDERFUL content', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/wallabag/wallabag/issues/8158
|
||||
public function testCharsetAfterTitle(): void
|
||||
{
|
||||
$readability = $this->getReadability('<!DOCTYPE html><html lang="et"><head><title>Tõde ja õigus I</title> <meta charset="utf-8"></head><body><p>See oli läinud aastasaja kolmanda veerandi lõpul. Päike lähenes silmapiirile, seistes sedavõrd madalas, et enam ei ulatunud valgustama ei mäkke ronivat hobust, kes puutelgedega vankrit vedas, ei vankril istuvat noort naist ega ka ligi kolmekümnelist meest, kes kõndis vankri kõrval.</p></body></html>', 'https://et.wikisource.org/wiki/T%C3%B5de_ja_%C3%B5igus_I/I');
|
||||
$readability->convertLinksToFootnotes = true;
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<iframe src="https://www.youtube.com/embed/PUep6xNeKjA" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"> </iframe>', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('3D Touch', $readability->getTitle()->innerHTML);
|
||||
$this->assertSame('Tõde ja õigus I', $readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('Päike lähenes', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array{0: string, 1: string, 2?: bool}>
|
||||
*/
|
||||
public function dataForHtmlLang(): array
|
||||
{
|
||||
return [
|
||||
'meta' => [
|
||||
'<html lang="fr"><head><meta charset="utf-8"></head><body><article>' . str_repeat('<p>Tous les êtres humains naissent libres et égaux en dignité et en droits. Ils sont doués de raison et de conscience et doivent agir les uns envers les autres dans un esprit de fraternité.</p>', 7) . '</article></body></html>',
|
||||
'fr',
|
||||
],
|
||||
'head' => [
|
||||
'<html lang="fr"><head><title>Foo</title></head><body><article>' . str_repeat('<p>Tous les êtres humains naissent libres et égaux en dignité et en droits. Ils sont doués de raison et de conscience et doivent agir les uns envers les autres dans un esprit de fraternité.</p>', 7) . '</article></body></html>',
|
||||
'fr',
|
||||
],
|
||||
'headless' => [
|
||||
'<html lang="fr"><body><article>' . str_repeat('<p>Tous les êtres humains naissent libres et égaux en dignité et en droits. Ils sont doués de raison et de conscience et doivent agir les uns envers les autres dans un esprit de fraternité.</p>', 7) . '</article></body></html>',
|
||||
'fr',
|
||||
// tidy would add <head> tag.
|
||||
false,
|
||||
],
|
||||
'fragment' => [
|
||||
'<article>' . str_repeat('<p>Tous les êtres humains naissent libres et égaux en dignité et en droits. Ils sont doués de raison et de conscience et doivent agir les uns envers les autres dans un esprit de fraternité.</p>', 7) . '</article>',
|
||||
'',
|
||||
// tidy would add <html>.
|
||||
false,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataForHtmlLang
|
||||
*/
|
||||
public function testHtmlLang(string $html, string $lang, bool $useTidy = true): void
|
||||
{
|
||||
$readability = $this->getReadability($html, 'http://0.0.0.0', 'libxml', $useTidy);
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf(\DOMDocument::class, $readability->dom);
|
||||
$this->assertSame($lang, $readability->dom->documentElement->getAttribute('lang'));
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertStringContainsString('êtres', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
private function getReadability(string $html, ?string $url = null, string $parser = 'libxml', bool $useTidy = true): Readability
|
||||
{
|
||||
$readability = new Readability($html, $url, $parser, $useTidy);
|
||||
|
||||
$this->logHandler = new TestHandler();
|
||||
$this->logger = new Logger('test', [$this->logHandler]);
|
||||
$readability->setLogger($this->logger);
|
||||
|
||||
return $readability;
|
||||
}
|
||||
}
|
||||
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
<div id="main-sidebar-container">
|
||||
|
||||
<!-- #main Starts -->
|
||||
<section id="main">
|
||||
<?php if (function_exists ('adinserter')) echo adinserter (1); ?><article class="post-23842 post type-post status-publish format-standard hentry category-ethiopia">
|
||||
<header>
|
||||
<h1 class="title entry-title">Ethiopia targets opposition who met with European lawmakers</h1> </header>
|
||||
<div class="post-meta"><span class="Small"><abbr class="date time published updated" title="2017-01-09T15:25:17-0500">January 9, 2017</abbr> <span class="Small">in</span> <span class="categories"><a href="http://www.ayyaantuu.net/category/horn-of-africa/ethiopia/" title="View all items in Ethiopia">Ethiopia</a></span> </div>
|
||||
<section class="entry">
|
||||
<div id="fb-root"></div>
|
||||
<p><strong>Ethiopia targets opposition who met with European lawmakers</strong></p>
|
||||
<p><span class="dateline"><img class="alignleft wp-image-22789 size-full" src="http://www.ayyaantuu.net/wp-content/uploads/2016/12/Ana-Gomes-Merera-Gudina.jpg" alt="Ethiopia targets opposition who met with European lawmakers" width="300" height="160" srcset="http://www.ayyaantuu.net/wp-content/uploads/2016/12/Ana-Gomes-Merera-Gudina.jpg 300w, http://www.ayyaantuu.net/wp-content/uploads/2016/12/Ana-Gomes-Merera-Gudina-200x107.jpg 200w" sizes="(max-width: 300px) 100vw, 300px" />ADDIS ABABA (<a href="http://www.foxnews.com/world/2017/01/09/ethiopia-targets-opposition-who-met-with-european-lawmakers.html">Fox News</a>) – </span>Ethiopia says it will not release a leading opposition figure detained under the country’s state of emergency after meeting with European lawmakers in Belgium.</p>
|
||||
<!-- WP QUADS Content Ad Plugin v. 1.3.9 -->
|
||||
<div class="quads-location quads-ad2" id="quads-ad2" style="float:left;margin:2px 2px 2px 0;">
|
||||
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
||||
<!-- Ad2016_12_14_3 -->
|
||||
<ins class="adsbygoogle"
|
||||
style="display:inline-block;width:336px;height:280px"
|
||||
data-ad-client="ca-pub-6953193962442323"
|
||||
data-ad-slot="4950645476"></ins>
|
||||
<script>
|
||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<p>Prime Minister Hailemariam Desalegn told reporters on Monday that Merara Gudina of the Oromo Federalist Congress party instead will face justice.</p>
|
||||
<p>The prime minister says “individuals in the European Parliament who are harboring anti-peace elements cannot save those who trespass the law of the country.”</p>
|
||||
<p>Merara is one of 22,000 people the prime minister says were detained under the state of emergency declared in October after widespread anti-government protests.</p>
|
||||
<p>Merara was arrested immediately after he returned from Belgium. He was accused of meeting with members of an armed Ethiopian opposition group in Brussels, an act banned under the emergency law.</p>
|
||||
|
||||
<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div><aside class="mashsb-container mashsb-main "><div class="mashsb-box"><div class="mashsb-count mash-small" style="float:left;"><div class="counts mashsbcount">0</div><span class="mashsb-sharetext">SHARES</span></div><div class="mashsb-buttons"><a class="mashicon-facebook mash-small" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.ayyaantuu.net%2Fethiopia-targets-opposition-lawmakers%2F" target="_blank" rel="nofollow"><span class="icon"></span><span class="text">Share</span></a><a class="mashicon-twitter mash-small" href="https://twitter.com/intent/tweet?text=Ethiopia%20targets%20opposition%20who%20met%20with%20European%20lawmakers&url=http://www.ayyaantuu.net/?p=23842&via= ayyaantuu" target="_blank" rel="nofollow"><span class="icon"></span><span class="text">Tweet</span></a><div class="onoffswitch mash-small"></div><div class="secondary-shares" style="display:none;"><a class="mashicon-subscribe mash-small" href="#" target="_blank" rel="nofollow"><span class="icon"></span><span class="text">Subscribe</span></a><div class="onoffswitch2 mash-small" style="display:none;"></div></div></div>
|
||||
</div>
|
||||
<div style="clear:both;"></div><div class="mashsb-toggle-container"></div></aside>
|
||||
<!-- Share buttons by mashshare.net - Version: 3.3.6--> </section><!-- /.entry -->
|
||||
<div class="fix"></div>
|
||||
<aside id="connect">
|
||||
<h3>Subscribe</h3>
|
||||
|
||||
<div class="col-left">
|
||||
<p>Subscribe to our e-mail newsletter to receive updates.</p>
|
||||
|
||||
|
||||
|
||||
<div class="social">
|
||||
<a href="http://www.ayyaantuu.net/feed/" class="subscribe" title="RSS"></a>
|
||||
|
||||
<a target="_blank" href="https://twitter.com/ayyaantuu" class="twitter" title="Twitter"></a>
|
||||
|
||||
<a target="_blank" href="https://www.facebook.com/ayyaantuu.oromiyaa" class="facebook" title="Facebook"></a>
|
||||
|
||||
</div>
|
||||
|
||||
</div><!-- col-left -->
|
||||
|
||||
<div class="related-posts col-right">
|
||||
<h4>Related Posts:</h4>
|
||||
<div class="woo-sc-related-posts">
|
||||
<ul>
|
||||
<li class="post-id-23812">
|
||||
|
||||
<a href="http://www.ayyaantuu.net/country-new-african-millionaire/" title="Africa Business: The life of TPLF millionaire in Oromia/Ethiopia?" class="related-title"><span>Africa Business: The life of TPLF millionaire in Oromia/Ethiopia?</span></a>
|
||||
</li>
|
||||
<li class="post-id-23794">
|
||||
|
||||
<a href="http://www.ayyaantuu.net/ethiopian-girl-band-funding-axed-uk/" title="Ethiopian girl band Yegna’s funding axed by UK – BBC News" class="related-title"><span>Ethiopian girl band Yegna’s funding axed by UK – BBC News</span></a>
|
||||
</li>
|
||||
<li class="post-id-23783">
|
||||
|
||||
<a href="http://www.ayyaantuu.net/infrastructure-led-chinese-approach/" title="Ethiopia’s political ripple a big test for infrastructure-led Chinese approach" class="related-title"><span>Ethiopia’s political ripple a big test for infrastructure-led Chinese approach</span></a>
|
||||
</li>
|
||||
<li class="post-id-23766">
|
||||
|
||||
<a href="http://www.ayyaantuu.net/defense-witness-testimonials/" title="Defense Witness Testimonials on Yonatan Tesfaye’s Terrorism Charges" class="related-title"><span>Defense Witness Testimonials on Yonatan Tesfaye’s Terrorism Charges</span></a>
|
||||
</li>
|
||||
<li class="post-id-23745">
|
||||
|
||||
<a href="http://www.ayyaantuu.net/foreign-government-internet-shutdowns-soared-2016/" title="Foreign government internet shutdowns soared in 2016" class="related-title"><span>Foreign government internet shutdowns soared in 2016</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="fix"></div><!--/.fix-->
|
||||
</div><!--/.woo-sc-related-posts--> </div><!-- col-right -->
|
||||
|
||||
<div class="fix"></div>
|
||||
</aside>
|
||||
<div class="post-utility"></div>
|
||||
</article><!-- /.post -->
|
||||
<div class="post-entries">
|
||||
<div class="nav-prev fl"><a href="http://www.ayyaantuu.net/many-bombs-united-states-dropped-2016/" rel="prev"><i class="fa fa-angle-left"></i> How Many Bombs the United States Dropped in 2016?</a></div>
|
||||
<div class="nav-next fr"><a href="http://www.ayyaantuu.net/rockefeller-conspiracy-one-world-order/" rel="next">David Rockefeller Says Conspiracy About ‘One World Order’ Is True <i class="fa fa-angle-right"></i></a></div>
|
||||
<div class="fix"></div>
|
||||
</div>
|
||||
|
||||
<?php if (function_exists ('adinserter')) echo adinserter (1); ?><div id="comments"> <h3 id="comments-title">One Response to <em>Ethiopia targets opposition who met with European lawmakers</em></h3>
|
||||
<ol class="commentlist">
|
||||
|
||||
<li id="comment-30772" class="comment even thread-even depth-1">
|
||||
|
||||
<div id="li-comment-30772" class="comment-container">
|
||||
|
||||
<div class="avatar"></div>
|
||||
|
||||
<div class="comment-head">
|
||||
|
||||
<span class="name">Addis Zemen</span>
|
||||
<span class="date">January 9, 2017 at 5:57 pm</span>
|
||||
<span class="perma"><a href="http://www.ayyaantuu.net/ethiopia-targets-opposition-lawmakers/#comment-30772" title="Direct link to this comment">#</a></span>
|
||||
<span class="edit"></span>
|
||||
|
||||
</div><!-- /.comment-head -->
|
||||
|
||||
<div class="comment-entry">
|
||||
|
||||
<p>10,000 people that were areested in Oromia got released. When the people were arrested it was under the assumption “Violence broke out during an Oromo religious festival, and in some instances foreigners seem to have been targeted. ”</p>
|
||||
<p>But now many prosecutors agree Violence was not the case. The people at the Erecha celebration thought aliens invaded their country. They thought the foreigners were aliens from another planet.<br />
|
||||
Close to a thousand threw themselves of a cliff just because they saw a helicopter flying near them. Many are paralized hundreds died. Now the injured are trying to blame the helicopter pilot for their injuries by saying the pilot caused their injuries by scaring them, flying like an alien abductor UFO would . After the prosecutor agreed it was an accident or suicide that caused the deaths of hundreds of people at the Erecha celebration, the suspected 10,000 prisoners got released. The prosecutors are blaming those that spoke with the European parliament for spreading false information about what really happened at the Erecha celebration.</p>
|
||||
|
||||
|
||||
<div class="reply">
|
||||
<a rel='nofollow' class='comment-reply-link' href='http://www.ayyaantuu.net/ethiopia-targets-opposition-lawmakers/?replytocom=30772#respond' onclick='return addComment.moveForm( "comment-30772", "30772", "respond", "23842" )' aria-label='Reply to Addis Zemen'>Reply</a> </div><!-- /.reply -->
|
||||
|
||||
</div><!-- /comment-entry -->
|
||||
|
||||
</div><!-- /.comment-container -->
|
||||
|
||||
</li><!-- #comment-## -->
|
||||
</ol>
|
||||
</div> <div id="respond" class="comment-respond">
|
||||
<h3 id="reply-title" class="comment-reply-title">Leave a Reply <small><a rel="nofollow" id="cancel-comment-reply-link" href="/ethiopia-targets-opposition-lawmakers/#respond" style="display:none;">Click here to cancel reply.</a></small></h3> <form action="http://www.ayyaantuu.net/wp-comments-post.php" method="post" id="commentform" class="comment-form">
|
||||
<p class="comment-form-comment"><label class="hide" for="comment">Comment</label> <textarea tabindex="4" id="comment" name="comment" cols="50" rows="10" maxlength="65525" aria-required="true" required="required"></textarea></p><p class="comment-form-author"><input id="author" name="author" type="text" class="txt" tabindex="1" value="" size="30" aria-required='true' /><label for="author">Name <span class="required">(required)</span></label> </p>
|
||||
<p class="comment-form-email"><input id="email" name="email" type="text" class="txt" tabindex="2" value="" size="30" aria-required='true' /><label for="email">Email (will not be published) <span class="required">(required)</span></label> </p>
|
||||
<p class="comment-form-url"><input id="url" name="url" type="text" class="txt" tabindex="3" value="" size="30" /><label for="url">Website</label></p>
|
||||
<p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="Submit Comment" /> <input type='hidden' name='comment_post_ID' value='23842' id='comment_post_ID' />
|
||||
<input type='hidden' name='comment_parent' id='comment_parent' value='0' />
|
||||
</p><p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="39bacbf69e" /></p><p style="display: none;"><input type="hidden" id="ak_js" name="ak_js" value="66"/></p> </form>
|
||||
</div><!-- #respond -->
|
||||
|
||||
</section><!-- /#main -->
|
||||
Vendored
+54
@@ -0,0 +1,54 @@
|
||||
<article>
|
||||
|
||||
<h1>Feed-Aggregator und Später-Lesen-Dienst im Team</h1>
|
||||
|
||||
<figure>
|
||||
<img src="https://www.schreibdichte.de/content/1-blog/20170505-feed-aggregator-und-spaeter-lesen-dienst-im-team/workflow.png" alt="Feed-Aggregator und Später-Lesen-Dienst im Team" >
|
||||
</figure>
|
||||
|
||||
<time datetime="2017-05-05T18:40:00+00:00" >05.05.2017</time>
|
||||
|
||||
<p> <span class="tag">Tags:</span>
|
||||
<ul class="tag_list">
|
||||
<li><a href="https://www.schreibdichte.de/blog/tag:Software">Software</a></li>
|
||||
<li><a href="https://www.schreibdichte.de/blog/tag:Web">Web</a></li>
|
||||
<li><a href="https://www.schreibdichte.de/blog/tag:Tools">Tools</a></li>
|
||||
</ul>
|
||||
<p>
|
||||
|
||||
<div class="content">
|
||||
<p>Dank einer Mitteilung <sup id="fnref1:fnfeed_1"><a href="#fn:fnfeed_1" class="footnote-ref">1</a></sup> im OSBN <sup id="fnref1:fnfeed_2"><a href="#fn:fnfeed_2" class="footnote-ref">2</a></sup>, bin ich auf den Feed-Aggregator Miniflux <sup id="fnref1:fnfeed_3"><a href="#fn:fnfeed_3" class="footnote-ref">3</a></sup> aufmerksam geworden. Ich hatte schon lange nach einer Alternative zu Fever <sup id="fnref1:fnfeed_4"><a href="#fn:fnfeed_4" class="footnote-ref">4</a></sup> gesucht, da der Anschein vorlag, dass die Entwicklung nicht mehr weiter ging. Was sich bestätigte.</p>
|
||||
<p>Miniflux ist prima, einfach gehalten und erledigt genau dass, was es machen soll. Zudem wird die Fever-API unterstützt, was bedeutet, dass ich weiterhin meine Feed-Reader nutzen kann, was den Dialog mit Miniflux auf dem Server betrifft. Das ist deshalb interessant, um den Lesestatus oder das Favorisieren von Feeds zentral auf dem Server zu berücksichtigen und nicht lokal. So habe ich sowohl auf dem lokalen Rechner, als auch auf allen mobilen Geräten den gleichen Stand und Status meiner abonnierten Feeds.</p>
|
||||
<p>Für das spätere Lesen von Webseiten, nutze ich seit längerem wallabag <sup id="fnref1:fnfeed_5"><a href="#fn:fnfeed_5" class="footnote-ref">5</a></sup>. Wallabag wird mit Inhalten über den Browser gefüttert. Die Webseiten werden bei der Konservierung von Werbung befreit, damit der reine Text vorliegt. Bilder dagegen nicht und gehen evtl. verloren, wenn es die Quelle mal nicht mehr geben sollte. Ich habe also zwei Orte, an denen Informationen gehalten werden. Miniflux zur Verwaltung von Feed-Nachrichten und Wallabag für Webseiten.</p>
|
||||
<p>Bei einem Update von Miniflux ist mit aufgefallen, dass es nun eine API für Wallabag gibt. Dabei werden alle gespeicherten Feeds von Miniflux an Wallabag übergeben. Eine prima Angelegenheit, da ich jetzt nur noch einen Topf habe, woraus ich meine gesammelten Informationen aus dem Netz entnehme.</p>
|
||||
<p>Miniflux als auch wallabag sind selbst gehostete Web-Applikationen, die auch über den Browser erreichbar sind. Native wallabag-Apps für iOS bzw. Android werden ebenfalls angeboten. Wallabag bietet zusätzlich einen Feed an, um die gesammelten Informationen per Feed-Reader zu lesen. Hierbei drängt sich evtl. die Idee auf, diesen Feed wieder in Miniflux zu abonnieren, da dann zentral alles aus verschiedenen Quellen vorliegt. Hier hätten wir allerdings eine gewisse Redundanz.</p>
|
||||
<p>Ich nutze seit ein paar Monaten Devonthink <sup id="fnref1:fnfeed_6"><a href="#fn:fnfeed_6" class="footnote-ref">6</a></sup> auf dem Mac. Das ist eine lokale Dokumentenverwaltung (DMS), die heute u.a. meine Bücher, Notizen und mein Mail-Archiv verwaltet und ihre Stärke u.a. in der Suche von Informationen hat. Devonthink versteht es auch Feeds zu abonnieren. Für mich war dies der Moment, nun den Feed von wallabag mit all meinen gespeicherten Informationen aus dem Web mit zu integrieren. Ich muss sagen, eine runde Lösung, denn jetzt habe ich für die lokale Suche und das Lesen eine zentrale Stelle.</p>
|
||||
<p>Die Grafik veranschaulicht das Teamplay zwischen Feed-Aggregator Miniflux und wallabag als Später-Lesen-Dienst, zusammengeführt in Devonthink. Ich kenne leider keine Dokumentenverwaltung für Linux oder Windows, die auch Feeds versteht. Wer etwas kennt, bitte melden. Wer zudem etwas zum Thema hören möchte, für dem ist ggf. die Podcast-Folge "Der eigene Workflow" <sup id="fnref1:fnfeed_7"><a href="#fn:fnfeed_7" class="footnote-ref">7</a></sup> interessant.</p>
|
||||
<div class="footnotes">
|
||||
<hr />
|
||||
<ol>
|
||||
<li id="fn:fnfeed_1">
|
||||
<p>Artikel zu Miniflux: <a href="Link"><a href="https://www.robbinaer.info/index.php?post/78">https://www.robbinaer.info/index.php?post/78</a></a> <a href="#fnref1:fnfeed_1" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
<li id="fn:fnfeed_2">
|
||||
<p>OSBN: <a href="Link"><a href="https://osbn.de">https://osbn.de</a></a> <a href="#fnref1:fnfeed_2" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
<li id="fn:fnfeed_3">
|
||||
<p>Miniflux: <a href="Link"><a href="https://miniflux.net">https://miniflux.net</a></a> <a href="#fnref1:fnfeed_3" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
<li id="fn:fnfeed_4">
|
||||
<p>Fever: <a href="Link"><a href="https://feedafever.com">https://feedafever.com</a></a> <a href="#fnref1:fnfeed_4" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
<li id="fn:fnfeed_5">
|
||||
<p>wallabag: <a href="Link"><a href="https://wallabag.org/de">https://wallabag.org/de</a></a> <a href="#fnref1:fnfeed_5" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
<li id="fn:fnfeed_6">
|
||||
<p>Devonthink: <a href="Link"><a href="http://www.devontechnologies.com/de/produkte/devonthink/ueberblick.html">http://www.devontechnologies.com/de/produkte/devonthink/ueberblick.html</a></a> <a href="#fnref1:fnfeed_6" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
<li id="fn:fnfeed_7">
|
||||
<p>Podcast MacMittwoch: <a href="Link"><a href="https://itunes.apple.com/de/podcast/macmittwoch/id1212750085?mt=2ueberblick.html">https://itunes.apple.com/de/podcast/macmittwoch/id1212750085?mt=2ueberblick.html</a></a> <a href="#fnref1:fnfeed_7" rev="footnote" class="footnote-backref">↩</a></p>
|
||||
</li>
|
||||
</ol>
|
||||
</div></div>
|
||||
|
||||
</article>
|
||||
Vendored
+67
@@ -0,0 +1,67 @@
|
||||
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Alice's Adventures in Wonderland (Project Gutenberg)</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<frameset Rows="50, *">
|
||||
<frame src="alice-finfo.html">
|
||||
<frame src="alice-ftitle.html" name="alice-main">
|
||||
</frameset>
|
||||
|
||||
<noframes>
|
||||
<BODY>
|
||||
<H1>Alice's Adventures in Wonderland</H1>
|
||||
<H1>Lewis Carroll</H1>
|
||||
<H1>The Millennium Fulcrum Edition 3.0</H1>
|
||||
|
||||
NOTE: This is a hypertext formatted version of the Project Gutenberg edition.
|
||||
For more information, check the
|
||||
<A HREF="alice-small.txt">small print</A>
|
||||
or check out the
|
||||
<A HREF="ftp://uiarchive.cso.uiuc.edu/pub/etext/gutenberg/etext91/alice30.txt">
|
||||
full ascii text</A>. The original Tenniel illustrations are also available
|
||||
due to the efforts of Project Gutenberg. You can if you like, grab them as a
|
||||
<A HREF="ftp://uiarchive.cso.uiuc.edu/pub/etext/gutenberg/etext94/algif10.zip">
|
||||
"zip file"</A> or read the <A HREF="algif-small.txt">small print</A>
|
||||
that comes with them.
|
||||
This document is part of a small, but growing collection of html formatted
|
||||
etexts. (Others may be found in either my <A
|
||||
HREF="http://www.cs.cmu.edu/Web/People/rgs/rgs-home.html">home page</A> or
|
||||
John Ockerbloom's indexes by <A
|
||||
HREF="http://www.cs.cmu.edu/Web/bookauthors.html">author</A> and <A
|
||||
HREF="http://www.cs.cmu.edu/Web/booktitles.html">title</A>.)
|
||||
I am still trying to figure out whether anyone else is interested in these
|
||||
on-line readable documents. If you appreciate this document or would like to
|
||||
see more such, send me mail at "rgs@cs.cmu.edu".
|
||||
<P>
|
||||
<A HREF="alice01a.gif"><IMG SRC="alice01th.gif"></A>
|
||||
<P>
|
||||
<H2>CONTENTS</H2>
|
||||
<PRE>
|
||||
CHAPTER I: <A HREF="alice-I.html">Down the Rabbit-Hole</A>
|
||||
CHAPTER II: <A HREF="alice-II.html">The Pool of Tears</A>
|
||||
CHAPTER III: <A HREF="alice-III.html">A Caucus-Race and a Long Tale</A>
|
||||
CHAPTER IV: <A HREF="alice-IV.html">The Rabbit Sends in a Little Bill</A>
|
||||
CHAPTER V: <A HREF="alice-V.html">Advice from a Caterpillar</A>
|
||||
CHAPTER VI: <A HREF="alice-VI.html">Pig and Pepper</A>
|
||||
CHAPTER VII: <A HREF="alice-VII.html">A Mad Tea-Party</A>
|
||||
CHAPTER VIII: <A HREF="alice-VIII.html">The Queen's Croquet-Ground</A>
|
||||
CHAPTER IX: <A HREF="alice-IX.html">The Mock Turtle's Story</A>
|
||||
CHAPTER X: <A HREF="alice-X.html">The Lobster Quadrille</A>
|
||||
CHAPTER XI: <A HREF="alice-XI.html">Who Stole the Tarts?</A>
|
||||
CHAPTER XII: <A HREF="alice-XII.html">Alice's Evidence</A>
|
||||
</PRE>
|
||||
|
||||
<ADDRESS><A HREF="mailto:rgs@cs.cmu.edu">Robert Stockton</A></ADDRESS>
|
||||
<P>
|
||||
<!- Access counter added 5/25 1:49am ->
|
||||
<A href="http://www.dbasics.com/cgi-bin/pages.cgi?143205747"><IMG SRC="http://www.dbasics.com/cgi-bin/counter.cgi?143205747.2&(none)"></A> Access statistics from htmlZine
|
||||
<!- This page has been visited
|
||||
A HREF="http://counter.digits.com/wc?--info=yes&--name=rgsalice"
|
||||
IMG SRC="http://counter.digits.com/wc/-d/4/-r/-z/rgsalice"
|
||||
ALIGN=absmiddle WIDTH=60 HEIGHT=20 BORDER=0 HSPACE=4 ALT="????"/A
|
||||
times since March 2, 1996. ->
|
||||
</BODY>
|
||||
</noframes>
|
||||
</HTML>
|
||||
Reference in New Issue
Block a user