Quote:
Originally Posted by TonytheBookworm
Do you mind posting a code snippet of one of your recipes that utilizes the do not fetch if first previous url hasn't changed. I would like to implement that in some of my recipes but never actually figured out how to do it other than what i mentioned in one of my post about the date check. It works sorta but the article still renders, it is just blank I was hoping to totally abort the whole thing and not even have the feed save period. maybe that isn't possible.
|
Tony,
All I've done in my testing is save and retrieve data of interest (time, first article url, etc.) to/from a recipe between multiple runs. I haven't tried anything sophisticated with what I do with that data. In fact, I saw that you used exit code in a recipe and thought I might adapt that to abort the recipe when the first feed hadn't changed.
I did this sort of thing in my tests:
Code:
now = #set current time in desired format using datetime
first_url = # set current first_url
previous_download_time = dynamic['recipe_name']['download_time']
previous_first_url = dynamic['recipe_name']['first_url']
dynamic['recipe_name']['download_time'] = now
dynamic['recipe_name']['first_url'] = first_url
This retrieves the info about the previous recipe run and sets the new info. What you do with it is up to the recipe author. My tests just put it in print_version because that's the point where the recipe has parsed the RSS for article URLs.