THE python program is as follows, it errors:
File "C:\Python\PyCharmProject\FaceBookCrawl\group_download.py", line 31, in getFeed params += "&since=" + SINCE.strftime("%s")
ValueError: Invalid format string
the program it seems SINCE.strftime("%s")
is wrong, how to solve it?
SINCE = datetime.datetime.now() - datetime.timedelta(DAYS)
params = "?fields=permalink_url,from,story,type,message,link,created_time,updated_time,likes.limit(0).summary(total_count),comments.limit(0).summary(total_count)"
#Default paging limit
params += "&&limit=" + DEFAULT_LIMIT
#Time-based limit
params += "&since=" + SINCE.strftime("%s")
graph_url = GRAPH_URL_PREFIX + group + "/feed" + params
For anybody coming here when using ("%s") to generate an Epoch timestamp. Note that the usage of strftime("%s") is platform dependent and doesnt work on windows while it works on Linux with you Local Timezone. You can just use timestamp()
:
int(datetime.datetime.utcnow().timestamp())
You can read more here Convert python datetime to epoch with strftime
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With