BoKKeR / RSS-to-Telegram-Bot

RSS to Telegram python script
http://t.me/rss_t_bot
GNU General Public License v3.0
260 stars 102 forks source link

Only URL #17

Closed Yoken0S closed 2 years ago

Yoken0S commented 3 years ago

Hi,

Thanks for your contribution it works like a charm but I only get URL of my RSS Feed posted. I'm not a python guy but I can see that your script take more than just URL so I'm assuming that something has to be changed either in my rss feed format or in the python script.

BoKKeR commented 3 years ago

What do you mean by "I only get URL of my RSS Feed posted".

using /add Test https://www.reddit.com/r/funny/new/.rss you add a rss feed, after this the bot checks if there is a new post, if there is. it posts it in your chat. You can add as many urls you want.

Yoken0S commented 3 years ago

My RSS feed is like this :

<item> <title><![CDATA[Title Blabla]]></title> <link><![CDATA[https://www.blablalink.com]]></link> <description><![CDATA[Blabladescription very long]]></description>

`<pubDate>Tue, 02 Feb 2021 12:50:43 +0100</pubDate>`
`<guid><![CDATA[https://www.blabla.com]]></guid>`

</item> <item>

The robot do correctly its job but it posts only the <link>. I'd like to know how add the Title and description ?

tux93 commented 3 years ago

Afaik Telegram generates those itself from the OpenGraph data on your page / post, not the bot

Yoken0S commented 3 years ago

I'm not sure to understand, I don't use Afaik Telegram it's my own RSS generate with a script from my fb page. And with others "public" rss feed bots with the same rss they can detect more than the link.

tux93 commented 3 years ago

The bot posts the link to a Telegram channel / group correct?

This bot does not generate the preview cards, Telegram does that itself by looking at the link

BoKKeR commented 3 years ago

Exactly, if the RSS link can't be accessed by telegram it wont generate the cards. This is something I could add

Yoken0S commented 3 years ago

Indeed, and it's works great with Youtube links but with Facebook Links, cards have only the "Log in to Facebook to start..." @BoKKeR Yes if you could that would be magic =)

temporhodes commented 3 years ago

you mean you want title and description in telegram too? i could add title here: if you need https://github.com/BoKKeR/RSS-to-Telegram-Bot/issues/15

Yoken0S commented 3 years ago

@temporhodes Yes it works great ! I just had to modify a little more but it is perfect ! Code for who want it : if 'facebook' in rss_d.entries[0]['link'] and 'live' not in rss_d.entries[0]['title']: context.bot.send_message(chatid, rss_d.entries[0]['title'] + "\n" + rss_d.entries[0]['description'] + "\n" + rss_d.entries[0]['link']) else: context.bot.send_message(chatid, rss_d.entries[0]['link'])

BoKKeR commented 3 years ago

The bot does not send automatic messages to the Group or Channel. What is the reason?

Open a new issue and provide some logs and debug info

rubzn commented 3 years ago

Hello. I've slightly modified the code to get a link with title wrapped in Markdown

context.bot.send_message(chatid, "[" + rss_d.entries[0]['title'] + "](" + rss_d.entries[0]['link'] + ")", parse_mode='MarkdownV2')

and now Telegram doesn't generate previews for those messages.

Is there any possible fix for that?

rubzn commented 2 years ago

Hello. I've slightly modified the code to get a link with title wrapped in Markdown

context.bot.send_message(chatid, "[" + rss_d.entries[0]['title'] + "](" + rss_d.entries[0]['link'] + ")", parse_mode='MarkdownV2')

and now Telegram doesn't generate previews for those messages.

Is there any possible fix for that?

As I've recently found out, link previews were forbidden in group settings 😓

alfonder commented 2 years ago

As I've recently found out, link previews were forbidden in group settings 😓

It's not true. It depends on the group you're posting to. At least preview does work if you set the bot as administrator.

rubzn commented 2 years ago

I was trying to say the same thing. It didn't work for me, because it was forbidden in group settings. As soon as that restriction was removed, everything went like clockwork.