juliomalegria / python-craigslist

Simple Craigslist wrapper
MIT No Attribution
387 stars 117 forks source link

Datetime question #60

Closed greenmindPDX closed 5 years ago

greenmindPDX commented 5 years ago

This utility is awesome, thanks for all the work. Question about datetime. I was looking in the Rochester, MN area, and received a result that looks like this;

{'name': u'QUIET BUILDING! CLOSE TO DOWNTOWN! BEST DEAL AROUND!', 'area': u'875ft2', 'url': u'https://rmn.craigslist.org/apa/d/rochester-quiet-building-close-to/6748094294.html', 'where': u'Rochester NW', 'price': u'$825', 'bedrooms': u'2', 'geotag': (44.036915, -92.464017), 'repost_of': u'6576850170', 'has_image': True, 'datetime': u'2018-12-12 16:15', 'has_map': True, 'id': u'6748094294'}

The datetime displayed is 2018-12-12. However, if I look at the listing based on its url, the date posted shows as: 2018-11-13. Is this something you've come across?

greenmindPDX commented 5 years ago

More info - it looks like datetime is showing the 'last updated' timestamp, rather than the initial post timestamp.

bparkin1283 commented 5 years ago

Yeah I noticed this as well, if I recall. My/most needs require storing scheduled results. So, do a check on your sql to see if the record is unique, then if it is, insert it, if not, don't. This way you can also track the posts update history. You're right though, you lose the ability to see exactly when it was posted, if you're checking every day it'll get you there though.

If you have any questions let me know

juliomalegria commented 5 years ago

That's a valid point. In 66d1d6f I'm adding 'last_updated' as a key with the same value as 'datetime' (keeping 'datetime' for backwards compatibility). The information of when was the entry actual created is in the detail, so if include_details is set to True, the key 'created' will be included with the datetime of when was it actually created. Hope this helps.