summaryrefslogtreecommitdiff
path: root/providers/Facebook.php
diff options
context:
space:
mode:
Diffstat (limited to 'providers/Facebook.php')
-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(