working and tested

This commit is contained in:
Aeris 2022-05-21 16:11:26 +02:00
parent 316aae15ad
commit 3030e3073c
2 changed files with 16 additions and 12 deletions

View File

@ -2,15 +2,11 @@
class ReadabilityExtension extends Minz_Extension {
const regex = [
'#^https?://.*washingtonpost.com/#i',
'#^https?://.*heise.de/#i'
];
public function init() {
$this->registerTranslates();
#$this->registerTranslates();
$current_user = Minz_Session::param('currentUser');
#$current_user = Minz_Session::param('currentUser');
$this->registerHook('entry_before_insert', array($this, 'fetchStuff'));
}
@ -19,15 +15,23 @@ class ReadabilityExtension extends Minz_Extension {
$read = false;
$regex = [
'washingtonpost.com',
'heise.de',
'nytimes.com'
];
foreach ( $regex as $ex ) {
if ( preg_match($ex, $entry->link()) === 1 ) {
$read = true;
}
print "Iterating";
if (false !== strpos($entry->link(), $ex ) ) {
$read = true;
}
}
if (! $read){
print "Constantly failing";
return $entry;
}
print "should work";
$data = "{\"url\": \"" . $entry->link() ."\"}";
$headers[] = 'Content-Type: application/json';

View File

@ -3,6 +3,6 @@
"author": "printfuck",
"description": "fetch article content for every feed with readability",
"version": "0.7.1",
"entrypoint": "RedditImage",
"type": "user"
"entrypoint": "Readability",
"type": "system"
}