summaryrefslogtreecommitdiff
path: root/providers
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2022-01-31 21:39:23 +0100
committeremkael <emkael@tlen.pl>2022-01-31 21:39:23 +0100
commit9601f3be1ee5be711671a922c3282339aeb1ddf4 (patch)
tree7b402675b2029e49b5756f59c2e5ef77db8186cc /providers
parent489816e3573afff315f61292ba2e1afc2fe96a16 (diff)
Another round of FB crap
Diffstat (limited to 'providers')
-rw-r--r--providers/Facebook.php19
1 files changed, 12 insertions, 7 deletions
diff --git a/providers/Facebook.php b/providers/Facebook.php
index 5eb588e..20f5028 100644
--- a/providers/Facebook.php
+++ b/providers/Facebook.php
@@ -22,7 +22,10 @@ class Facebook extends \Providers\Provider {
protected function _fetchItems() {
$jsonContent = [];
- exec('python3 ' . implode(DIRECTORY_SEPARATOR, [dirname(__FILE__), '..', 'bin', 'get-fb-content.py']) . ' ' . escapeshellarg($this->_feed), $jsonContent);
+ exec('direnv exec ' .
+ implode(DIRECTORY_SEPARATOR, [dirname(__FILE__), '..', 'bin', 'fb-scrape']) . ' ' .
+ 'python ' . implode(DIRECTORY_SEPARATOR, [dirname(__FILE__), '..', 'bin', 'fb-scrape', 'get-fb-content.py']) . ' ' .
+ escapeshellarg($this->_feed), $jsonContent);
return json_decode(implode(PHP_EOL, $jsonContent), TRUE);
}
@@ -33,12 +36,14 @@ class Facebook extends \Providers\Provider {
if (!count($texts)) {
$texts[] = '';
}
- $texts = array_merge(
- $texts,
- array_map(function($i) {
- return sprintf('<img src="%s" />', $i);
- }, $obj['images'])
- );
+ if ($obj['images']) {
+ $texts = array_merge(
+ $texts,
+ array_map(function($i) {
+ return sprintf('<img src="%s" />', $i);
+ }, $obj['images'])
+ );
+ }
$item = new Item();
$item->ID = $obj['id'];
$item->Link = sprintf(