aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2025-02-14 02:00:07 +0100
committerGravatar GitHub <noreply@github.com> 2025-02-14 02:00:07 +0100
commite4c32bb046011a95ffecf3693db3a754b37dac13 (patch)
tree544cc42c0dd7297edcbb93da8ff9e16e8bb5f8fe
parentdd4dcfa59c08e5bece71861647f82c05e60c0cfa (diff)
downloadrss-bridge-e4c32bb046011a95ffecf3693db3a754b37dac13.tar.gz
rss-bridge-e4c32bb046011a95ffecf3693db3a754b37dac13.tar.zst
rss-bridge-e4c32bb046011a95ffecf3693db3a754b37dac13.zip
fix(vk): semi-disable broken bridge (#4448)
-rw-r--r--bridges/VkBridge.php23
1 files changed, 15 insertions, 8 deletions
diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php
index 11cfca5d..54b2897a 100644
--- a/bridges/VkBridge.php
+++ b/bridges/VkBridge.php
@@ -7,8 +7,8 @@ class VkBridge extends BridgeAbstract
// const MAINTAINER = 'ahiles3005';
const NAME = 'VK.com';
const URI = 'https://vk.com/';
- const CACHE_TIMEOUT = 300; // 5min
- const DESCRIPTION = 'Working with open pages';
+ const CACHE_TIMEOUT = 3600; // 1h
+ const DESCRIPTION = 'Does not work anymore';
const PARAMETERS = [
[
'u' => [
@@ -65,6 +65,7 @@ class VkBridge extends BridgeAbstract
public function collectData()
{
+ return;
$text_html = $this->getContents();
$text_html = iconv('windows-1251', 'utf-8//ignore', $text_html);
@@ -391,10 +392,13 @@ class VkBridge extends BridgeAbstract
$item['categories'] = $hashtags;
// get post link
- $post_link = $post->find('a.PostHeaderSubtitle__link', 0)->getAttribute('href');
- preg_match('/wall-?\d+_(\d+)/', $post_link, $preg_match_result);
- $item['post_id'] = intval($preg_match_result[1]);
- $item['uri'] = $post_link;
+ $var = $post->find('a.PostHeaderSubtitle__link', 0);
+ if ($var) {
+ $post_link = $var->getAttribute('href');
+ preg_match('/wall-?\d+_(\d+)/', $post_link, $preg_match_result);
+ $item['post_id'] = intval($preg_match_result[1]);
+ $item['uri'] = $post_link;
+ }
$item['timestamp'] = $this->getTime($post);
$item['title'] = $this->getTitle($item['content']);
$item['author'] = $post_author;
@@ -402,7 +406,7 @@ class VkBridge extends BridgeAbstract
// do not append it now
$pinned_post_item = $item;
} else {
- $last_post_id = $item['post_id'];
+ $last_post_id = $item['post_id'] ?? null;
$this->items[] = $item;
}
}
@@ -474,7 +478,10 @@ class VkBridge extends BridgeAbstract
if ($accurateDateElement) {
return $accurateDateElement->getAttribute('time');
} else {
- $strdate = $post->find('time.PostHeaderSubtitle__item', 0)->plaintext;
+ $strdate = $post->find('time.PostHeaderSubtitle__item', 0)->plaintext ?? null;
+ if (!$strdate) {
+ return 0;
+ }
$strdate = preg_replace('/[\x00-\x1F\x7F-\xFF]/', ' ', $strdate);
$date = date_parse($strdate);