This vignette shows how to download media (photos/videos/documents)
from a Telegram channel using download_channel_media().
To keep this vignette fully reproducible, the output below is
generated from a small bundled sample dataset. The commands shown are
real; if you have credentials and a live session, you can run them by
setting eval=TRUE in your environment.
# Download media into ./downloads
media <- download_channel_media(
client,
"telegram",
limit = 200,
media_types = c("photo", "video"),
start_date = "2025-01-01",
end_date = "2025-02-01",
out_dir = tempdir()
)# Inspect results
media
#> # A tibble: 2 × 9
#> message_id channel_id channel_username channel_title date
#> <dbl> <dbl> <chr> <chr> <dttm>
#> 1 28508 1149277960 ShrikeNews Шрайк Ньюс 2026-03-06 11:22:24
#> 2 28495 1149277960 ShrikeNews Шрайк Ньюс 2026-03-06 08:48:16
#> # ℹ 4 more variables: media_type <chr>, file_path <chr>,
#> # original_filename <chr>, error <chr>photo_path <- media %>%
filter(media_type == "photo") %>%
slice(1) %>%
pull(file_path)
# In a real session with downloaded files, display the photo:
# knitr::include_graphics(file.path("..", photo_path))
cat("Photo path:", photo_path, "\n")
#> Photo path: NA
cat("(Photo display omitted in offline demo — run with eval=TRUE and real credentials to download.)\n")
#> (Photo display omitted in offline demo — run with eval=TRUE and real credentials to download.)The result is a tibble with one row per downloaded media item. Typical columns include:
message_id, channel_id,
channel_username, channel_titledate, text, media_typefile_path, errorstart_date/end_date to restrict the
window and speed up downloads.media_types to select only photos or only
videos.wait_time (e.g.,
wait_time = 1).image/*).
download_channel_media() treats image as a
photo-type alias when photo is requested.