From 2c314427e9f9a78ee91ace896b443f4f85424c35 Mon Sep 17 00:00:00 2001 From: cansavvy Date: Wed, 6 Mar 2024 08:44:44 -0500 Subject: [PATCH] Add name of paper --- R/citations.R | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/R/citations.R b/R/citations.R index a1580ff..52f253b 100644 --- a/R/citations.R +++ b/R/citations.R @@ -25,6 +25,14 @@ get_citation_count <- function(paper_cite_link) { response <- httr::GET(paper_cite_link) + if (httr::status_code(response) != 200) { + httr::stop_for_status(response) + } + + original_paper <- rvest::read_html(httr::content(response, "text")) %>% + rvest::html_nodes('h2.gs_rt') %>% + rvest::html_text() + titles <- rvest::read_html(httr::content(response, "text")) %>% rvest::html_nodes('h3') %>% rvest::html_text() @@ -34,6 +42,6 @@ get_citation_count <- function(paper_cite_link) { rvest::html_nodes("a") %>% rvest::html_attr("href") - df <- data.frame(titles, links) + df <- data.frame(original_paper, cite_titles, links) return(df) }