Hello.
I am building a workflow, RSS aggregator for Twitter that posts to Telegram.
I am using Telegram bot to post feeds items (Twitter posts from multiple channels) to Telegram.
Furthermore, I created multiple RSS triggers for each channel.
Since Twitter does not provide RSS feeds, I am using Google News that can create RSS for Telegram channels.
Google News generates an HTML response that contains JavaScript code that contains a direct link to the Twitter post. When launched in browser, it simply redirects to a Twitter post.
In the pipedream workflow, I catch these HTML responses as text and then, use Node.js code to extract those link strings.
This Node.js code collects all such Twitter links from all feeds in an array.
The result should be an array that contains HTTP URLs that I can use to post to Telegram that would be direct links to Twitter posts collected in all the RSS triggers.
Here is the code:
// To use any npm package, just import it
// import axios from "axios"
export default defineComponent({
async run({ steps, $ }) {
// Convert the current text to lowercase
const text = steps.custom_request.$return_value;
const words = ['ChanelRion', 'ACTBrigitte', 'OANN', 'AnIllarionov'];
// Regular expression to match a string in double quotes
const regex = /"([^"]*?)/g;
let match;
let results;
let lowerCaseMatch;
// Iterate through all matches
while ((match = regex.exec(text)) !== null) {
// Convert the current match to lowercase
lowerCaseMatch = match[0].toLowerCase();
// Iterate through each word in the array
for (const word of words) {
// Convert the current word to lowercase
const lowerCaseWord = word.toLowerCase();
// Check if the match contains the current word
if (lowerCaseMatch.includes(lowerCaseWord)) {
results.push(lowerCaseMatch);
}
}
}
// Return the matched string
// return results;
$.export("results", results);
},
})
And here is the workflow:
My question:
Why do I get this warning message (you can see it on the screenshot)?
Warning
- UNSERIALIZABLE_EXPORT: this.results could not be serialized.
And it returns null, but should return something, since I am scanning returned HTML responses for words that are actual usernames from RSS feeds that have been generated for these users.
I know it’s a bit complicated, but hope someone could actually assist.
Here I am sharing with you my workflow, so that you can run it in your environment.
I don’t care about posting to Telegram at this moment, so you can ignore the last action in the workflow.
Thank you.