Exemple #1
0
    def process_item(self, item, spider):
        #isodates
        if item.get('datePublished', None):
            item['datePublished'] = get_isodate(item['datePublished'])
        if item.get('dateModified', None):
            item['dateModified'] = get_isodate(item['dateModified'])
        if item.get('dateCreated', None):
            item['dateCreated'] = get_isodate(item['dateCreated'])

        #isodurations
        if item.get('prepTime', None):
            item['prepTime'] = get_isoduration(item['prepTime'])
        if item.get('cookTime', None):
            item['cookTime'] = get_isoduration(item['cookTime'])
        if item.get('totalTime', None):
            item['totalTime'] = get_isoduration(item['totalTime'])

        return item
Exemple #2
0
 def test_get_isodate(self):
     self.assertEqual('2009-10-11', get_isodate("October 11 2009"))