Skip to main content
Best answer

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

  • August 7, 2023
  • 6 replies
  • 462 views

akril

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. 🤲

Best answer by Troy Tessalone

@akril 

Here’s another approach using the Formatter app.

 

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

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • August 7, 2023

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


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • Answer
  • August 7, 2023

@akril 

Here’s another approach using the Formatter app.

 


akril
  • Author
  • Beginner
  • August 7, 2023

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. 😵‍💫

 

 

 


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • August 7, 2023

@akril 

JavaScript


akril
  • Author
  • Beginner
  • August 7, 2023

My bad. It’s OK now :)

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

Thank you !


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • August 16, 2023

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! 🙂