Title: | R Interface to the OP3 API |
---|---|
Description: | The op3r package provides a tidy interface to the Open Prefix Project (OP3) API. |
Authors: | Eric Nantz [aut, cre], John Spurlock [ctb] (Author of OP3 project) |
Maintainer: | Eric Nantz <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1 |
Built: | 2024-11-22 03:52:09 UTC |
Source: | https://github.com/rpodcast/op3r |
Obtain the OP3 API token from a .Renviron
file, either stored in the
current directory or the user's home directory.
get_op3_token()
get_op3_token()
list with API token
op3_downloads_show()
obtains the number of monthly downloads and average
weekly downloads over the last four weeks (excludes bots)
op3_downloads_show(show_id, nest_downloads = TRUE)
op3_downloads_show(show_id, nest_downloads = TRUE)
show_id |
One or more character strings of OP3 show UUID values |
nest_downloads |
Boolean to create a list column of the weekly
download metrics or expand the data frame to have one row per
week of download metrics. Default is |
tibble
data frame with the following columns:
days
: Number of days in time window
monthlyDownloads
: Number of downloads in month
weeklyAvgDownloads
: Average number of downloads per week in month
numWeeks
: Number of weeks in time window
download_data
: Nested data frame of download numbers per week (when nest_downloads
is TRUE)
weekNumber
: Week number in time window (when nest_downloads
is FALSE)
weeklyDownloads
: Number of downloads for weekNumber
(when nest_downloads
is FALSE)
# Requires API token op3_downloads_show(show_id = "a18389b8a52d4112a782b32f40f73df6")
# Requires API token op3_downloads_show(show_id = "a18389b8a52d4112a782b32f40f73df6")
op3_get_show_uuid()
uses the API to obtain the podcast
OP3 UUID based on either the podcast GUID or podcast RSS feed.
Only one of the two can be specified.
op3_get_show_uuid(show_guid = NULL, show_rss_url = NULL)
op3_get_show_uuid(show_guid = NULL, show_rss_url = NULL)
show_guid |
String representing the podcast GUID. |
show_rss_url |
String representing the podcast RSS feed |
string with the podcast UUID
op3_hits()
obtains lowest-level log records for every prefix redirect
processed by the OP3 service.
op3_hits( format = "json", limit = 100, desc = TRUE, start = NULL, start_inclusive = TRUE, end = NULL, url = NULL, hashed_ip_address = NULL )
op3_hits( format = "json", limit = 100, desc = TRUE, start = NULL, start_inclusive = TRUE, end = NULL, url = NULL, hashed_ip_address = NULL )
format |
result output format returned by the API endpoint. Possible
values are |
limit |
Integer of maximum number of episodes to return. The
maximum limit supported for this endpoint is |
desc |
Boolean to return results in time-descending order. If |
start |
Optional date or date-time object to filter results to those
starting at the supplied value. The object must be class |
start_inclusive |
Boolean to consider the |
end |
Optional date or date-time object to filter results to those
ending at the supplied value. The object must be class |
url |
Optional string to filter results by the specific URL providing
the redirect. The URL is often a direct link to a podcast episode file,
or a version of the URL with a wildcard character |
hashed_ip_address |
Optional string to filter results by the specific
IP address secure hash. Default is |
Atibble
data frame for the json
format, otherwise a nested list
for the json-a
format. The data frame contains the following columns:
time
: Timestamp of current record
uuid
: OP3 UUID for podcast
hashedIpAddress
: Secure hash of the record's originating IP address
method
: Type of HTTP method used
url
: URL of the record's request
userAgent
: Request's reported user agent
range
: If application, the request's specified bytes range.
edgeColo
: Three-letter airport code associated with the record
continent
: The request's originating continent
country
: Two-letter country code of the record
timezone
: Request timezone
regionCode
: Abbreviation of region
region
: Region of request
metroCode
: Region metro code
# Requires API token # obtain 10 records op3_hits(limit = 10) # records based on specific podcast episode op3_hits(url = "https://op3.dev/e/serve.podhome.fm/episode/99cfd30f-e40c-426a-3557-08dc4ea63bb0/63851340872787683054574074-0a1f-4951-8f2a-9084678c6604v1.mp3") # records for multiple episodes using a wildcard in URL op3_hits(url = "https://op3.dev/e/serve.podhome.fm/episode/99cfd30f-e40c-426a-3557-08dc4ea63bb0/*")
# Requires API token # obtain 10 records op3_hits(limit = 10) # records based on specific podcast episode op3_hits(url = "https://op3.dev/e/serve.podhome.fm/episode/99cfd30f-e40c-426a-3557-08dc4ea63bb0/63851340872787683054574074-0a1f-4951-8f2a-9084678c6604v1.mp3") # records for multiple episodes using a wildcard in URL op3_hits(url = "https://op3.dev/e/serve.podhome.fm/episode/99cfd30f-e40c-426a-3557-08dc4ea63bb0/*")
op3_show()
obtains show-level information for a given podcast
using OP3.
op3_show(show_id, episodes = FALSE)
op3_show(show_id, episodes = FALSE)
show_id |
String representing an OP3 show UUID, podcast GUID, or a podcast RSS feed URL. |
episodes |
Boolean to return episode-level metadata along with
the show-level information. Default is |
tibble
data frame with the following columns:
showUuid
: Podcast OP3 UUID
title
: Podcast title
podcastGuid
: Podcast GUID
statsPageUrl
: URL of the OP3 statistics web page for the podcast
episodes_id
: Episode ID (when episodes
is TRUE)
episodes_title
: Episode title (when episodes
is TRUE)
# Requires API token op3_show(show_id = "bb28afcc-137e-5c66-b231-4ffad7979b44")
# Requires API token op3_show(show_id = "bb28afcc-137e-5c66-b231-4ffad7979b44")
Detect if OP3 API token is defined
op3_token_isset()
op3_token_isset()
boolean, TRUE if 'OP3_API_TOKEN' is defined in the current R session.
op3_top_apps()
obtains global shares of application downloads over the
last thirty days categorized by application
op3_top_apps(device_name = NULL)
op3_top_apps(device_name = NULL)
device_name |
Optional string of a specific device ID to constrain results. |
tibble
data frame with the following columns:
app_name
: Device name
value
: Percentage of download share
min_date
: Oldest date in data range
max_date
: Newest date in data range
# Requires API token op3_top_apps()
# Requires API token op3_top_apps()
op3_top_show_apps()
obtains the download numbers for individual
podcast applications over the last three calendar months
for a specific show.
op3_top_show_apps(show_id)
op3_top_show_apps(show_id)
show_id |
String representing an OP3 show UUID, podcast GUID, or a podcast RSS feed URL. |
tibble
data frame with the following columns:
show_uuid
: OP3 show UUID
app_name
: Name of podcast application
value
: Number of downloads in the last three calendar months
# Requires API token op3_top_show_apps(show_id = "bb28afcc-137e-5c66-b231-4ffad7979b44")
# Requires API token op3_top_show_apps(show_id = "bb28afcc-137e-5c66-b231-4ffad7979b44")
op3_transcripts()
obtains the most recent episodes of podcasts using OP3
containing transcripts along with their daily download numbers.
op3_transcripts(limit = 100, nest_downloads = TRUE)
op3_transcripts(limit = 100, nest_downloads = TRUE)
limit |
Integer of maximum number of episodes to return. The maximum limit supported is 100. |
nest_downloads |
Boolean to create a list column of the daily
download metrics or expand the data frame to have one row per
day of download metrics. Default is |
tibble
data frame with the following columns:
asof
: Timestamp
pubdate
: Episode publish timestamp
podcastGuid
: Podcast GUID
episodeItemGuid
: Episode GUID
hasTranscripts
: Boolean indicating if the episode has a transcript
dailyDownloads
: List of episode download numbers by date (when nest_downloads
is TRUE)
date
: Date of download number (when nest_downloads
is FALSE)
n_downloads
: Number of downloads for the date
(when nest_downloads
is FALSE)
# Requires API token op3_transcripts(limit = 5, nest_downloads = FALSE)
# Requires API token op3_transcripts(limit = 5, nest_downloads = FALSE)