Skip to content

Add ability to extract flair from comments and threads? #44

@tnieuwe

Description

@tnieuwe

Hello! This is a wonderful package for getting really interesting data. I was wondering if it would be possible to add flairs to the scraped comments. I was going to do this myself by editing the below function, I was having trouble getting a toy json and request_url from the other functions to properly test it. Would it be as simple as?

build_comments_content_df <- function(json, request_url) data.frame(
  url = strip_json(request_url),
  author = extract_comments_attributes(json, "author"),
  date = extract_comments_attributes(json, "created_utc") |> timestamp_to_date(),
  timestamp = extract_comments_attributes(json, "created_utc"),
  score = extract_comments_attributes(json, "score"),
  upvotes = extract_comments_attributes(json, "ups"),
  downvotes = extract_comments_attributes(json, "downs"),
  golds = extract_comments_attributes(json, "gilded"),
  comment = extract_comments_attributes(json, "body"),
  flair = extract_comments_attributes(json, "author_flair_text"), ## Changed line
  comment_id = build_comment_ids(json),
  stringsAsFactors = FALSE
)

I'm sorry if it is more complicated than that, but I'd be willing to help work on it.

Also this has previously been discussed here and I was interested in trouble shooting the issue the original user ran into:
https://www.reddit.com/r/redditdev/comments/10q2s59/using_redditextractor_to_scrape_flairs/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions