diff options
author | emkael <emkael@tlen.pl> | 2021-04-02 02:40:03 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2021-04-02 02:40:03 +0200 |
commit | c5554536a29d40e5dfe11ca56f8d07b77c7d24ae (patch) | |
tree | e79fe42ca408f7d9a2977a8189c8cda8309f9f26 /providers/Facebook.php | |
parent | c04e31020120b9dbec370691e793618e7425f675 (diff) |
Adjustments to FB date parsing
Diffstat (limited to 'providers/Facebook.php')
-rw-r--r-- | providers/Facebook.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/providers/Facebook.php b/providers/Facebook.php index b3f2015..d5233c3 100644 --- a/providers/Facebook.php +++ b/providers/Facebook.php @@ -20,7 +20,7 @@ class Facebook extends \Providers\HtmlFeed { } protected function __getUserAgent() { - return 'curl/7.72.0'; + return 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.51 Safari/537.36'; } protected function _getCachePath() { @@ -36,12 +36,16 @@ class Facebook extends \Providers\HtmlFeed { $string = str_replace("\xc2\xa0", ' ', $origString); $string = str_replace(' godzinie ', ' ', $string); $string = str_replace(' o ', ', ', $string); - $string = str_replace('godz.', 'hours ago', $string); $string = str_replace('Wczoraj', 'Yesterday', $string); + $string = str_replace('Dzisiaj', '', $string); + $string = str_replace('godz.', 'hours ago', $string); + $string = str_replace('min', 'minutes ago', $string); + $string = str_replace('Przed chwilą', 'now', $string); $string = str_replace(['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia'], ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], $string); $time = strtotime($string); if (!$time) { - throw new Exception('Cannot parse date string: ' . $origString); + var_dump(bin2hex($origString)); + throw new \Exception('Cannot parse date string: ' . $origString); } return $string; } |