aikaterna / aikaterna-cogs

Cogs for Red-DiscordBot by Twentysix26.
Other
108 stars 98 forks source link

Fix for double posting issues #295

Closed Juniteevee closed 1 year ago

Juniteevee commented 1 year ago

This if statement is such that if there is no title in this feed it meets the criteria for this If and the one above and thus gets placed in the queue twice and double posted. Ive seen this in Mastodon feeds for example.

            if (last_title == "" and entry_title == "") and (last_link != entry_link) and (last_time < entry_time):
                log.debug(f"New entry found via time validation for feed {name} on cid {channel.id} - no title")
                feedparser_plus_obj = await self._add_to_feedparser_object(entry, url)
                feedparser_plus_objects.append(feedparser_plus_obj)
aikaterna commented 1 year ago

Have you tried this with feeds that don't provide a title and the only way to qualify the new feed posts is by feed time? I recall that Pinterest board RSS feeds specifically fall into this qualification, but I don't have an example link currently.

Do you have an example of a mastodon feed you can share with me for my own testing?

Juniteevee commented 1 year ago

sure where I was having the issue was using my mastodon feed https://vt.social/@juni.rss There is no title on items. The other option if you are concerned is changing it to an "elif" since there shouldnt be a reason for them both to need to execute. I did not test with Pinterest

aikaterna commented 1 year ago

Have you tried adding https://vt.social/ to the rss parse add command yet and seeing if it still double posts after that? Feel free to read the help for rss parse first if you'd like more info on it. I am not convinced this setting will help this situation but I'd like you to try it first.

Juniteevee commented 1 year ago

I treid but then there was another issue there where the check doesnt work on domains without subdomains for example: http://www.vt.social would work but http://vt.social would not. I actually made a local fork where i was debugging this issue and the first thing i tried was changing that check so that it would accept http://vt.social but I still had the issue. Thats when I put it into debug logging and saw that both the debug log lines 1405 and 1409 were being logged. And determined this as the actual issue. I can add a PR for the parse fix as well if you like

aikaterna commented 1 year ago

Hey there, December has been pretty busy for me and I wanted to let you know that I still have this issue in mind. I intend to try to work on it a little myself on a different branch of my repo and then have you give that modified version a try when I have it ready. Messing with the feed qualifier can break a bunch of feeds so I am pretty hesitant to merge this as-is, but I have some ideas when I can get to it.

aikaterna commented 1 year ago

Hello, when all of your mission-critical cogs on your bot are updated for Red 3.5, and your bot is updated to Red 3.5, you can find a new implementation of the feed qualifier in this version that will resolve this issue: https://github.com/aikaterna/aikaterna-cogs/commit/fac5d84a7e76509a9700f61a3e7dae306c6121ee

I won't be backporting this but if you need to stay on Red 3.4 for a while, you should be able to take the changed feed qualifying code and drop it right into the code section where you were making your PR previously (and a few more lines around it, of course).

Edit: Links like vt.social should be able to be added to the rss parse override now as well, on that newer version.