VK Bridge returned error 0! (20075)
Error: Call to a member function getAttribute() on null in bridges/VkBridge.php line 394
index.php(68): RssBridge->main()
lib/RssBridge.php(39): RssBridge->{closure}()
lib/RssBridge.php(37): CacheMiddleware->__invoke()
middlewares/CacheMiddleware.php(44): RssBridge->{closure}()
lib/RssBridge.php(37): ExceptionMiddleware->__invoke()
middlewares/ExceptionMiddleware.php(17): RssBridge->{closure}()
lib/RssBridge.php(37): SecurityMiddleware->__invoke()
middlewares/SecurityMiddleware.php(19): RssBridge->{closure}()
lib/RssBridge.php(37): MaintenanceMiddleware->__invoke()
middlewares/MaintenanceMiddleware.php(10): RssBridge->{closure}()
lib/RssBridge.php(37): BasicAuthMiddleware->__invoke()
middlewares/BasicAuthMiddleware.php(13): RssBridge->{closure}()
lib/RssBridge.php(37): TokenAuthenticationMiddleware->__invoke()
middlewares/TokenAuthenticationMiddleware.php(10): RssBridge->{closure}()
lib/RssBridge.php(34): DisplayAction->__invoke()
actions/DisplayAction.php(54): DisplayAction->createResponse()
actions/DisplayAction.php(89): VkBridge->collectData()
bridges/VkBridge.php(394)
Query string: action=display&bridge=VkBridge&u=rexsauer&format=Atom
Version: 2024-02-02 (git.master.f0db6a2)
Os: Linux
PHP version: 8.2.24
Maintainer: @em92
VK decided to update the wall design and all selectors at the same time :(
Also experiencing the same issue
@em92
@wpdevelopment11 @Ahiles3005
They all celebrate a New Year, I think.
I'm trying to parse via xpath, but I'm faced with the fact that $titleNode doesn't return any value
class VkBridge extends BridgeAbstract
{
...
const URI = 'https://vk.com/';
const CACHE_TIMEOUT = 180; //3min because max posts is 10
...
const PARAMETERS = [
[
'u' => [
'name' => 'public link',
'exampleValue' => 'filmsense',
'required' => true
]
]
];
public function collectData()
{
$username = $this->getInput('u');
$url = self::URI . $username;
...
libxml_use_internal_errors(true);
$htmlContent = getContents($url);
$dom = new DOMDocument();
@$dom->loadHTML($htmlContent);
$xpath = new DOMXPath($dom);
//path to the block containing all posts
$postsContainer = $xpath->query('//*[@id="page_wall_posts"]')->item(0);
//$postsContainer = $xpath->query('/html/body/div[4]/div/div/div[2]/div[2]/div[3]/div/div[1]/div[2]/div[2]/div/div[6]/div/div[2]')->item(0);
if ($postsContainer) {
// number of displayed posts
$posts = $xpath->query('./div[position() <= 4]', $postsContainer); //max is 10
// post is /html/body/div[4]/div/div/div[2]/div[2]/div[3]/div/div[1]/div[2]/div[2]/div/div[6]/div/div[2]/div[*]
foreach ($posts as $post) {
$item = [];
// title
$titleNode = $xpath->query('./div/div[1]/div[2]/div/div/h5/a/span', $post)->item(0);
$item['title'] = $titleNode ? $titleNode->nodeValue : 'No title';```
Give up this bridge, use Vk2 instead. https://rss-bridge.github.io/rss-bridge/Bridge_Specific/Vk2.html
https://github.com/RSS-Bridge/rss-bridge/pull/4418