boB Rudis
4 years ago
7 changed files with 127 additions and 20 deletions
@ -0,0 +1,50 @@ |
|||
#' Retrieve iTunes info about a give app (via bundle id) |
|||
#' |
|||
#' @param bundle_id an app bundle id |
|||
#' @export |
|||
get_app_info <- function(bundle_id) { |
|||
|
|||
bundle_id <- bundle_id[1] |
|||
|
|||
if (grepl("^com\\.apple\\.", bundle_id)) { |
|||
|
|||
tibble( |
|||
app = bundle_id, |
|||
name = stringi::stri_trans_totitle(sub("^com\\.apple\\.", "", bundle_id)), |
|||
category = "Apple" |
|||
) |
|||
|
|||
} else { |
|||
|
|||
httr::GET( |
|||
url = "https://itunes.apple.com/lookup", |
|||
query = list( |
|||
bundleId = bundle_id |
|||
) |
|||
) -> res |
|||
|
|||
httr::stop_for_status(res) |
|||
|
|||
out <- jsonlite::fromJSON(httr::content(res, as = "text")) |
|||
|
|||
if (length(out$resultCount)) { |
|||
|
|||
tibble( |
|||
app = bundle_id, |
|||
name = out$results$trackName, |
|||
category = out$results$primaryGenreName |
|||
) |
|||
|
|||
} else { |
|||
|
|||
tibble( |
|||
app = bundle_id, |
|||
name = NA_character_, |
|||
category = NA_character_ |
|||
) |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,8 @@ |
|||
#' Source the `knowledgeC.db` on the local system |
|||
#' |
|||
#' @param knowledgeC_location location of the `knowledgeC.db` file (defaults to "`~/Library/Application Support/Knowledge/knowledgeC.db`") |
|||
#' @export |
|||
src_knowledgeC <- function(knowledgeC_location = "~/Library/Application Support/Knowledge/knowledgeC.db") { |
|||
dplyr::src_sqlite(knowledgeC_location) |
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/get-app-info.R |
|||
\name{get_app_info} |
|||
\alias{get_app_info} |
|||
\title{Retrieve iTunes info about a give app (via bundle id)} |
|||
\usage{ |
|||
get_app_info(bundle_id) |
|||
} |
|||
\arguments{ |
|||
\item{bundle_id}{an app bundle id} |
|||
} |
|||
\description{ |
|||
Retrieve iTunes info about a give app (via bundle id) |
|||
} |
@ -0,0 +1,15 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/src-knowledgeC.R |
|||
\name{src_knowledgeC} |
|||
\alias{src_knowledgeC} |
|||
\title{Source the `knowledgeC.db` on the local system} |
|||
\usage{ |
|||
|
|||
src_knowledgeC(knowledgeC_location = "~/Library/Application Support/Knowledge/knowledgeC.db") |
|||
} |
|||
\arguments{ |
|||
\item{knowledgeC_location}{location of the `knowledgeC.db` file (defaults to "`~/Library/Application Support/Knowledge/knowledgeC.db`")} |
|||
} |
|||
\description{ |
|||
Source the `knowledgeC.db` on the local system |
|||
} |
Loading…
Reference in new issue