working and tested
This commit is contained in:
parent
316aae15ad
commit
3030e3073c
|
@ -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';
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue