working and tested
This commit is contained in:
parent
316aae15ad
commit
3030e3073c
|
@ -2,15 +2,11 @@
|
||||||
|
|
||||||
class ReadabilityExtension extends Minz_Extension {
|
class ReadabilityExtension extends Minz_Extension {
|
||||||
|
|
||||||
const regex = [
|
|
||||||
'#^https?://.*washingtonpost.com/#i',
|
|
||||||
'#^https?://.*heise.de/#i'
|
|
||||||
];
|
|
||||||
|
|
||||||
public function init() {
|
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'));
|
$this->registerHook('entry_before_insert', array($this, 'fetchStuff'));
|
||||||
}
|
}
|
||||||
|
@ -19,15 +15,23 @@ class ReadabilityExtension extends Minz_Extension {
|
||||||
|
|
||||||
$read = false;
|
$read = false;
|
||||||
|
|
||||||
|
$regex = [
|
||||||
|
'washingtonpost.com',
|
||||||
|
'heise.de',
|
||||||
|
'nytimes.com'
|
||||||
|
];
|
||||||
|
|
||||||
foreach ( $regex as $ex ) {
|
foreach ( $regex as $ex ) {
|
||||||
if ( preg_match($ex, $entry->link()) === 1 ) {
|
print "Iterating";
|
||||||
$read = true;
|
if (false !== strpos($entry->link(), $ex ) ) {
|
||||||
}
|
$read = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (! $read){
|
if (! $read){
|
||||||
|
print "Constantly failing";
|
||||||
return $entry;
|
return $entry;
|
||||||
}
|
}
|
||||||
|
print "should work";
|
||||||
$data = "{\"url\": \"" . $entry->link() ."\"}";
|
$data = "{\"url\": \"" . $entry->link() ."\"}";
|
||||||
$headers[] = 'Content-Type: application/json';
|
$headers[] = 'Content-Type: application/json';
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
"author": "printfuck",
|
"author": "printfuck",
|
||||||
"description": "fetch article content for every feed with readability",
|
"description": "fetch article content for every feed with readability",
|
||||||
"version": "0.7.1",
|
"version": "0.7.1",
|
||||||
"entrypoint": "RedditImage",
|
"entrypoint": "Readability",
|
||||||
"type": "user"
|
"type": "system"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue