Media coverage can show which issues are receiving attention from news organizations over time. For this analysis, I used the MediaCloud API to compare online news coverage of artificial intelligence and social media during 2026. MediaCloud collects and analyzes news stories from online news sources, allowing researchers to examine patterns in media attention. I used weekly story counts to compare the two topics and identify differences and notable changes in coverage volume.
The MediaCloud API was used to collect daily story counts for two topics: artificial intelligence and social media. The search period was January 1, 2026, through September 1, 2026.
The search queries were:
"artificial intelligence""social media"The daily data were grouped into weeks so that changes in media coverage could be compared over time.
The table below summarizes the total number of stories, minimum and maximum weekly story counts, and average weekly story count for each topic.
| topic | Total_Stories | Weekly_Minimum | Weekly_Maximum | Weekly_Mean |
|---|---|---|---|---|
| Social Media | 196482 | 1803 | 6603 | 5457.83 |
| Artificial Intelligence | 56690 | 339 | 2342 | 1574.72 |
The line graph below shows how coverage of artificial intelligence and social media changed from week to week during the study period.
The MediaCloud results show that Social Media received the greatest overall amount of coverage during the period examined, with 196,482 stories. The topic with the lowest total coverage was Artificial Intelligence, which had 56,690 stories. The graph also shows that coverage varied from week to week, with Social Media reaching a maximum of 6,603 stories in a single week. These differences may be related to major news events, technological developments, or other events that caused one topic to receive more attention from online news organizations during particular weeks.
The following is the R script used to collect, analyze, and visualize the MediaCloud data.
############################################################
# STEP 1: Install and Load Packages
############################################################
if (!require("tidyverse")) install.packages("tidyverse")
if (!require("httr2")) install.packages("httr2")
if (!require("lubridate")) install.packages("lubridate")
if (!require("kableExtra")) install.packages("kableExtra")
library(tidyverse)
library(httr2)
library(lubridate)
library(kableExtra)
############################################################
# STEP 2: Verify Media Cloud API Key
############################################################
if (!nzchar(Sys.getenv("MEDIACLOUD_KEY"))) {
stop(
"No Media Cloud API key was found.\n",
"Please save your key to .Renviron first."
)
}
############################################################
# STEP 3: Define Two Topics
############################################################
topics <- c(
"Artificial Intelligence" = "\"artificial intelligence\"",
"Social Media" = "\"social media\""
)
############################################################
# STEP 4: Define the Date Range
############################################################
start_date <- "2026-01-01"
end_date <- "2026-09-01"
############################################################
# STEP 5: Create a Function to Download
# Daily Story Counts
############################################################
get_counts <- function(query) {
Sys.sleep(35)
response <-
request(
"https://search.mediacloud.org/api/search/count-over-time"
) |>
req_headers(
Authorization = paste(
"Token",
Sys.getenv("MEDIACLOUD_KEY")
)
) |>
req_url_query(
q = query,
start = start_date,
end = end_date,
platform = "onlinenews-mediacloud",
cs = 34412234
) |>
req_perform()
results <-
response |>
resp_body_json()
map_dfr(
results$count_over_time$counts,
as_tibble
) |>
mutate(
date = as.Date(date)
)
}
############################################################
# STEP 6: Download Data for Both Topics
############################################################
topic_data <-
imap_dfr(
topics,
function(search_query, topic_name) {
message("Downloading: ", topic_name)
get_counts(search_query) |>
mutate(
topic = topic_name
)
}
)
############################################################
# STEP 7: Calculate Weekly Story Counts
############################################################
weekly_counts <-
topic_data |>
mutate(
week = floor_date(date, unit = "week")
) |>
group_by(topic, week) |>
summarise(
stories = sum(count),
.groups = "drop"
)
############################################################
# STEP 8: Summarize Total Coverage
############################################################
topic_summary <-
weekly_counts |>
group_by(topic) |>
summarise(
Total_Stories = sum(stories),
Weekly_Minimum = min(stories),
Weekly_Maximum = max(stories),
Weekly_Mean = round(mean(stories), 2),
.groups = "drop"
) |>
arrange(desc(Total_Stories))
############################################################
# STEP 9: Create Pretty Summary Table
############################################################
Summary_Table <- topic_summary |>
kbl(
caption = "Coverage Summary by Topic"
) |>
kable_styling(
full_width = FALSE,
bootstrap_options = c(
"striped",
"hover"
)
)
Summary_Table
############################################################
# STEP 10: Create Line Graph
############################################################
Line_Graph <- weekly_counts |>
ggplot(
aes(
x = week,
y = stories,
color = topic
)
) +
geom_line(
linewidth = 1
) +
geom_point(
size = 2
) +
labs(
title = "Weekly Media Coverage Volume",
subtitle = "Artificial Intelligence vs. Social Media",
x = "Week",
y = "Number of Stories",
color = "Topic"
) +
theme_minimal()
Line_Graph