ivan-rivera/RedditExtractor

Getting the Timestamp

Closed this issue · 5 comments

Is there a way to get the timestamp from get_reddit()? e.g. {"created_utc": 1543846575.0}

comm_date = format(as.Date(as.POSIXct(unlist(lapply(main.node, function(x){GetAttribute(x,"created_utc")})), origin="1970-01-01")),"%d-%m-%y"),

Edit: It seems it is converted. Is there a simple way to recover the Unix stamp?

I rebuilt and tried setting comm_date = to meta.node$created_utc, but the timestamps were all the same. The second effort produced the same result when I tried format(as.Date(as.POSIXct(unlist(lapply(main.node, function(x){GetAttribute(x,"created_utc")})), origin="1970-01-01")),"%Y-%m-%d %H:%M:%S")

I added the HMS to the timestamp, but they all returned as zeroes. The comments are sporadic, so I couldn't figure out the logic, but I will try again tomorrow.

I solved it: comm_date = unlist(lapply(main.node, function(x){GetAttribute(x,"created_utc")})),

Remove the formatting, and change the data type on line 41 to numeric().

Reopened and added a pull request.

Hey, is this issue solved ? when I pull the data using the command

get_reddit( subreddit = "wallstreetbets",
                   cn_threshold = 1, page_threshold = 1, sort_by = "comments",
                   wait_time = 2)

it does not return timestamps

I've updated the package to version 3.0.0 so the interface and the outputs have changed, but I expose the parsed UTC date which you can convert back to a timestamp if needed.