Rss-bridge: [VkBridge] Article titles only show the first character of content

Created on 26 Apr 2020  路  16Comments  路  Source: RSS-Bridge/rss-bridge

Describe the bug
Article titles on VkBridge only show the first character of the content.

Expected behavior
I would expect at least several words of content in the title.

Ping @em92

Bug-Report

All 16 comments

It reads until first occurance of dot, comma and some others.
https://feed.eugenemolotov.ru/?action=display&bridge=Vk&u=tubushow&format=Html

But agree, title generating sometimes it awful

Maybe it could change to display the first x characters instead?

This revision fixes the issue for me:

    private function getTitle($content)
    {
        $result = substr(strip_tags(htmlspecialchars_decode($content)), 0, 280);
        if (empty($result)) return 'untitled';
        return $result;
    }

Can you test this on a command line and see what your rss titles look like please?

php index.php action=display bridge=Vk u=english_bookland format=Atom

Really weird. I tried this on a Windows machine and titles are truncated after one character.

On an Ubuntu 20.04 VM titles are truncated at the first "k".

Really weird.

I agree.

Tested on built-in docker image, titles are truncated after one character.
In my production instance everything is fine: https://feed.eugenemolotov.ru/?action=display&bridge=Vk&u=english_bookland&format=Html

OS on production instance: Debian 10

me = @em92

It seems odd, but I suppose this points to a regular expression issue when run via CLI. Although I've never come across such a thing before.

Perhaps I can alter my PR to trigger the 280 character titles with no preg_match when in CLI mode.

PR #1553 updated.

@triatic actually I mean't that titles are truncated after one character in BOTH cli and browser output. http://i.imgur.com/6okL08G.png

Ah I don't run a web instance. I wonder if my PR can detect the "bug" and process titles accordingly then. 馃槃

diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php
index ea81a2b..133eef0 100644
--- a/bridges/VkBridge.php
+++ b/bridges/VkBridge.php
@@ -355,7 +355,7 @@ class VkBridge extends BridgeAbstract

        private function getTitle($content)
        {
-               preg_match('/^["\w\ \p{Cyrillic}\(\)\?#芦禄-]+/mu', htmlspecialchars_decode($content), $result);
+               preg_match('/^["\w\ \(\)\?#芦禄-]+/mu', htmlspecialchars_decode($content), $result);
                if (count($result) == 0) return 'untitled';
                return $result[0];
        }

Here is how I managed to fix it. But I don't remember why I used \p{Cyrillic} in my regular expression.

That version works for me too. I guess I can close my PR now (although I do prefer an unconditional 280 character title myself)?

@triatic can you check this instead:

diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php
index ea81a2b..2e03790 100644
--- a/bridges/VkBridge.php
+++ b/bridges/VkBridge.php
@@ -355,7 +355,7 @@ class VkBridge extends BridgeAbstract

        private function getTitle($content)
        {
-               preg_match('/^["\w\ \p{Cyrillic}\(\)\?#芦禄-]+/mu', htmlspecialchars_decode($content), $result);
+               preg_match('/^["\w\ \p{L}\(\)\?#芦禄-]+/mu', htmlspecialchars_decode($content), $result);
                if (count($result) == 0) return 'untitled';
                return $result[0];
        }

Replaced \p{Cyrillic} to \p{L} (L means any unicode letter)

I guess I can close my PR now?

Yes

(although I do prefer an unconditional 280 character title myself)

I prefer current one, but fixed. Sorry.

No problem, PR closed. 馃憤馃徎

P.S. Latest version works fine too.

Was this page helpful?
0 / 5 - 0 ratings