rss-bridge icon indicating copy to clipboard operation
rss-bridge copied to clipboard

VK Bridge returned error 0! (20075)

Open ptah-alexs opened this issue 1 year ago • 8 comments

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

ptah-alexs avatar Dec 18 '24 17:12 ptah-alexs

VK decided to update the wall design and all selectors at the same time :(

dimagukov avatar Dec 18 '24 18:12 dimagukov

Also experiencing the same issue

victor-mitr avatar Dec 18 '24 19:12 victor-mitr

@em92

dvikan avatar Jan 02 '25 15:01 dvikan

@wpdevelopment11 @Ahiles3005

dvikan avatar Jan 03 '25 05:01 dvikan

They all celebrate a New Year, I think.

ptah-alexs avatar Jan 03 '25 17:01 ptah-alexs

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';```

dimagukov avatar Jan 18 '25 10:01 dimagukov

Give up this bridge, use Vk2 instead. https://rss-bridge.github.io/rss-bridge/Bridge_Specific/Vk2.html

em92 avatar Jan 24 '25 19:01 em92

https://github.com/RSS-Bridge/rss-bridge/pull/4418

dvikan avatar Jan 25 '25 17:01 dvikan