Best answer

Getting a random (number) to get a random post inside a RSS

  • 8 August 2023
  • 6 replies
  • 262 views

Hello people,

First, I’m new to Zapier. Previously Make.com user, I’m trying the service and migrate all my functions to Zapier. So far, I was able to do everything I need, except one scenario.

I want to parse a RSS for all the available posts between 2 dates : 2010 and 2023 for example.

Then, I want to generate a random number to take the corresponding post in my RSS.

My final objective is to post on a social network, a random and old post from a RSS.

I could potentially publish a screenshot on how I did that on Make.com but maybe it’s restricted.

Someone could point me some directions because I don’t know how to do that with Zapier.

Thank you for any hint. 🤲

icon

Best answer by Troy Tessalone 8 August 2023, 00:35

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +14

Hi @akril 

Good question.

You can use a Code step.

 

CONFIG

 

CODE

let Length = inputData.Length;
let Random = Math.floor(Math.random() * Length);

output = [{Length, Random}];

 

OUTPUT

Userlevel 7
Badge +14

@akril 

Here’s another approach using the Formatter app.

 

Hello @Troy Tessalone 

Thank you for your help on this.

I’m sorry but I’m still very noob and you’re assuming some steps that I’m not mastering right now.

When I’m choosing “Code” in my function. Should I choose Python or Javascript ?

Looks like Python but it’s strange to have “;” at the end no?

I’ve tried the following and unfortunately it’s a no go. 😵‍💫

 

 

 

Userlevel 7
Badge +14

@akril 

JavaScript

My bad. It’s OK now :)

And by the way, your second method with Formatter app is much easier.

Thank you !

Userlevel 7
Badge +11

Glad to see Troy was able to help out here, @akril! 🎉

Please do return to the Community if you run into further questions. We're always happy to assist! 🙂