I’m trying to create my own personalized RSS Feed for an Italian institutional site. The site in question is this, belonging to an Italian municipality. The idea would be to use the PolitePol online tool, generate the RSS Feed (since the one incorporated into the site doesn’t satisfy me, not always creating new elements if there are already too many) and send everything on a Telegram channel via the RSS-to-Telegram-Bot. I correctly identified the essential elements for my post, namely Title
(with td[1]
), Description
(with td[4]
) and finally the Link
(with td[5]
). However, still in the Title
section, I would like to concatenate other information, namely that contained in td[2]
and that contained in td[5]
. The code I’ve used so far has been this:
concat('Atto numero ', td[1]/child::node(), ' Tipo: ', td[2]/child::node(), ' ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ Data: ',td[5]/child::node())
The solution I adopted is certainly very rudimentary, but for now I haven’t found anything else to get to the bottom of; the result is obviously terrible. At this point I ask you, is it possible to make a code like this to allow me to put the various XPaths in the title but put them in separate lines?
What I would like to achieve:
Atto numero 0203/2024
Tipo: Manifesti
Data: 20/06/2024
REVISIONE SEMESTRALE DELLE LISTE ELETTORALI
What I get instead:
Atto numero 0203/2024 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ Tipo: Manifesti ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ Data: 20/06/2024
REVISIONE SEMESTRALE DELLE LISTE ELETTORALI
I tried the code above, however the result was not the best, having poorly defined spaces and messy text.
2
Answers
Try this:
OR xpath 2:
Result:
PS: Change the numbers in the tr, td tags for accurate searches.
I’m not familiar with PolitePol, but if that doesn’t work for you, then why not use an HTML/XML parser, like the command-line tool xidel, to create your own RSS feed?
With "direct element constructors":
Or with "computed constructors":
You can totally customize it the way you like. The output for these queries: