summaryrefslogtreecommitdiff
path: root/providers/Facebook.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-10-09 09:54:35 +0200
committeremkael <emkael@tlen.pl>2020-10-09 09:54:35 +0200
commit45dc75ef568b95ff4162761b4dedc3b9d4249a95 (patch)
treee2007c9fce185023d0b637b055747de9577389f8 /providers/Facebook.php
parent0aff0e94be8e31ddc4660c34ee7e26761332f470 (diff)
Fuck You, sugar hill gang
Diffstat (limited to 'providers/Facebook.php')
-rw-r--r--providers/Facebook.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/providers/Facebook.php b/providers/Facebook.php
index 4f4c76e..beb8f98 100644
--- a/providers/Facebook.php
+++ b/providers/Facebook.php
@@ -19,6 +19,10 @@ class Facebook extends \Providers\HtmlFeed {
}
}
+ protected function __getUserAgent() {
+ return 'curl/7.72.0';
+ }
+
protected function _getCachePath() {
return '../cache/facebook.%s';
}
@@ -32,11 +36,10 @@ class Facebook extends \Providers\HtmlFeed {
if (isset($this->_options['dump'])) {
print($tree->html());
}
- foreach ($tree->find('article') as $header) {
- $data = json_decode($header->attr()['data-store'], TRUE);
- if (isset($data['linkdata'])) {
- $data = $data['linkdata'];
- $data = json_decode(explode('page_insights.', $data)[1], TRUE);
+ foreach ($tree->find('#timelineBody div[data-ft]') as $header) {
+ $data = json_decode($header->attr()['data-ft'], TRUE);
+ if (isset($data['page_insights'])) {
+ $data = $data['page_insights'];
$data = array_filter(
$data,
function($a) { return isset($a['post_context']); }