How to Design a System That Reads Public Media Data Through an API
A practical blueprint for reading public media data through an API: define scope, split the system into layers, cache sensibly and respect each source's terms.
9 min readUpdated Nov 15, 2026By XPASS Editorial Team

Many products need to show media that lives somewhere else: a video title and thumbnail in a content directory, a podcast episode list in a learning portal, or a gallery of licensed pictures in a catalogue. The simplest way to build this is to call an API, read the fields you need and show them to your users. The simplest way is also easy to get wrong, because a few quick scripts tend to grow into a system that nobody designed.
This article walks through a practical design for a system that reads public media data through an API. It focuses on lawful use, meaning that you only read what a source has made public through its documented interface or what you are licensed to use. It covers scope, architecture, request flow, caching, error handling and monitoring, and it ends with the limits that are worth planning for from day one. If you are still deciding whether to read only descriptive data or to fetch files, start with how a media metadata API differs from file downloads, because that choice shapes everything below.
Start by defining what you are actually building
Before you write any code, write down three short statements. First, which sources will you read from? Name each one and note whether it offers an official API, a feed or only a web page. Second, what fields do you need? A catalogue page may only need a title, a short description, a thumbnail URL, a duration and a link back to the original. Third, what is your right to use each field? Public does not always mean open for republishing. A title shown with a link back is a very different use from copying a description in bulk.
Keep these statements in a small document next to the code. It sounds bureaucratic, but it saves time later when somebody asks why the system stores a certain field or why a source was removed. It also gives you a natural way to say no to scope creep. If a new request needs data that is not in your document, you can pause, check the source's terms and then decide.
A short checklist helps:
- List each source and the official way to read it (API, feed, embed or licensed export).
- List the fields you need and mark each as required or optional.
- Note the terms for each source: attribution, caching limits, storage limits and reuse rules.
- Decide who owns the integration, so that terms changes are noticed by a real person.

Understand what "public" and "authorized" mean
Teams often use the word public loosely. In practice there are three situations that behave differently. The first is data that a source offers through an official API with documented terms. The second is content that the owner has licensed to you under a contract. The third is a page that is visible in a browser but has no interface intended for automated use. Your design should treat these as separate classes, because the rules, rate expectations and risks are different.
For the first two classes, you have a clear basis: read what the documentation allows, at the pace it allows, and keep to the stated storage and display rules. For the third class, be cautious. Read the site's terms, check its robots.txt file as described in RFC 9309, and if there is no clear permission, ask the owner or leave it out. A design that depends on bypassing a limit, a login or a CAPTCHA is not a design you can maintain, and it is not one we recommend. For a deeper look at how parsing fits with authorization, see what a media parsing API is and how it relates to authorized data.
A layered architecture that stays maintainable
A reading system becomes much easier to run when you separate its responsibilities. A simple layout has five layers, and each can be replaced without rewriting the others.
| Layer | Responsibility | Typical content |
|---|---|---|
| Source connector | Talks to one source's API using its rules | Authentication, paging, request building |
| Normalizer | Converts each source's response to your own shape | Field mapping, type checks, default values |
| Storage and cache | Keeps normalized items and short-lived responses | Database table, key-value cache |
| Service layer | Exposes clean functions to the rest of your app | Search, list, get by id |
| Presentation | Shows the data and the required attribution | Pages, cards, API for your front end |
The source connector is the only layer that knows about a specific provider. If a source changes its fields or you drop it, you replace one connector and the rest of the application is unaffected. The normalizer is where you define your own model, for example MediaItem with id, title, summary, thumbnailUrl, durationSeconds, sourceUrl, sourceName and fetchedAt. Everything above the normalizer deals only with that model. This is the single most useful decision in the design, because it stops source-specific quirks from leaking into your product.
The request flow, step by step
Here is the path of one request for a media item, from your user to the source and back.
- A user opens a page that needs a media item. The presentation layer asks the service layer for the item by your own id.
- The service layer checks the cache. If a fresh copy exists, it returns it immediately and no external call is made.
- If the copy is missing or stale, the service layer asks the right source connector to fetch the item.
- The connector builds the request according to the source's documentation, adds credentials from a secure configuration store, and sends it with a sensible timeout.
- The connector checks the HTTP status and the response headers. Success codes and cache hints follow the meaning described in HTTP Semantics (RFC 9110).
- The normalizer converts the response to your model and validates it. Missing required fields lead to a clear error rather than a half-filled item.
- The service layer stores the result with a freshness time, returns it and logs the outcome.
A plain example makes this concrete. Imagine an online learning portal that lists lectures from a university channel that has licensed the portal to show them. The portal stores only the title, a one-line summary, a thumbnail URL, the duration and the link to the original lecture. When a student opens the course page, the portal reads these fields from its cache. Only when an entry is older than the source allows does it make a fresh call. The video itself is played from the owner's own player, and the portal never copies the file.
Where a proxy fits, and where it does not
Some teams ask whether a proxy belongs in this design. A proxy is simply an intermediary that sends requests on your behalf, as explained in the MDN overview of proxy servers and tunneling. In a reading system it has a modest, legitimate role. You might route your own requests through a fixed network location so that a source sees a stable address, or you might check how an authorized source presents data to visitors from another region, so that you can test your own regional pages.
What a proxy does not do is grant permission. It does not turn a restricted source into an allowed one, and it must not be used to hide excessive request rates or to avoid a source's rules. Keep the proxy configuration inside the connector layer, so it is one setting per source and easy to review. If you want to look at proxy options for lawful testing and routing, the XPASS proxy page describes what is available and is the place to check what each plan includes.
Caching, freshness and being a polite client
Caching is the biggest lever you have, for both cost and courtesy. Most media metadata changes slowly. A title or description rarely changes within an hour, so there is little reason to ask the source again for every page view. A good approach has three parts.
- Respect the source's signals. If the response carries cache directives or an expiry hint, use them as the upper limit for how long you keep a copy.
- Add your own floor and ceiling. Choose a minimum time before refetching and a maximum time before a copy is treated as stale, based on how often your content really changes.
- Refresh in the background. Instead of making the user wait for a refetch, serve the slightly stale copy and refresh it in a queue. This keeps pages fast and spreads load evenly.
Add basic politeness on top. Limit concurrency per source, use exponential backoff after errors, and honour any rate limit that the documentation states. If a source returns a response telling you to slow down, treat that as a rule, not an obstacle. A reading system that is kind to its sources also tends to be a stable one, because it triggers fewer blocks and fewer surprises.
Errors, retries and monitoring
External APIs fail in many ways, and your system should expect that. Sort failures into groups so that each gets the right response.
| Situation | Typical sign | Suggested handling |
|---|---|---|
| Temporary network problem | Timeout, connection reset | Retry a few times with backoff |
| Source overloaded | Server error codes | Back off, serve cached copy, retry later |
| Rate limit reached | Too-many-requests response | Slow down and wait as instructed |
| Item removed or moved | Not-found or gone response | Mark the item inactive, do not retry forever |
| Credential problem | Unauthorized or forbidden response | Alert the owner, stop that connector |
| Unexpected data shape | Validation error in the normalizer | Log the sample, keep the old copy |
Whatever you choose, write the rules down and test them. A simple way is to build a fake source that returns each of these cases and run your connector against it in automated tests. For monitoring, track a handful of numbers per source: successful calls, errors by type, median response time, the share of requests answered from the cache and the number of items that expired. Alerts on sudden changes in any of these will usually tell you about a terms change or an outage before your users do.
Limits and what to watch for
Every design has boundaries, and it is better to know them early.
- Terms of use can change. A source may tighten its rules about storage, attribution or the number of calls. Review them on a schedule, and record the date you last checked.
- Links expire. Many sources issue media or thumbnail links that stop working after some time. Store the stable item identifier and fetch a fresh link when needed, rather than treating a link as permanent. The related guide on fetching thumbnails from licensed links goes deeper into this.
- Personal data. Even public posts can contain names, faces or comments. Check the privacy rules that apply to you, keep only what you need and delete what you no longer use.
- Do not copy more than you need. Store the minimum fields required for your use. A smaller data set is cheaper, safer and easier to keep within a licence.
- Respect local law and site rules. Do not build features whose purpose is to avoid a source's restrictions, rate limits or access controls. If a requirement seems to need that, it is a signal to ask the owner for a proper agreement.
- Regional differences. Availability and fields can vary by region. If you test this, do so only against sources that allow it, and record what you observed.
A practical rollout plan
Do not build everything in one sprint. A sensible order is to start with one source and one page. Build the connector, the normalizer and a simple cache, then show a handful of items. Add monitoring before you add a second source. After the first source is stable, add the next one by writing only a new connector and a new mapping. Finally, add background refresh and alerts. This keeps the early version small enough to review and gives you real numbers to guide later choices.
When you review the finished system, ask four questions. Can I explain, for each field, why we store it and what permits it? Can I replace any single source without touching the rest? Does the system behave calmly when a source is down? And can a new teammate find the terms for each source in under a minute? If all four answers are yes, you have a design that will keep working as your product grows.
Summary
A public media reading system is easiest to maintain when you decide its scope first, read only what you are permitted to read, and keep source-specific code inside connectors that feed one normalized model. Put a cache in front of every external call, respect the headers and limits each source sends, and handle errors by category instead of retrying blindly. Monitor a few key numbers, plan for expiring links and changing terms, and keep a proxy, if you use one, as a simple routing tool rather than a way around rules. When you are ready to explore network options for lawful testing and routing, the proxy page is the place to see what is on offer.
Frequently asked questions
What is a public media reading system?
It is an application that, through an API, reads information about media that its owner has made public or that you are licensed to use, such as titles, descriptions, thumbnails and duration. It stores or displays that information inside your own product.
Should I read metadata or download the media files?
For most display and catalogue needs, metadata is enough and is lighter, easier to cache and easier to keep within the source's terms. Download files only when your licence or agreement clearly allows it.
Where should caching sit in the design?
Place a cache between your own application and the API client layer, and respect the cache headers and freshness rules that the source sends. This reduces repeated calls and keeps your system calmer under load.
Do I need a proxy to build this?
Not necessarily. A proxy can be useful for routing your own requests from a chosen network location, for example when you test regional behaviour of a source you are allowed to use. It does not replace permissions or terms.
What should I monitor once the system is running?
Track success and error rates per source, response times, how many calls are served from cache, and how often stored links or items have expired. Alerts on sudden changes help you react before users notice.
References
About the author

Bob Kanokphon Thongdee
- Founder of XPASS VPN
- Co-founder of eSIMonline.asia
- More than 7 years in online marketing
- Founder of Cojourney Visa and Cojourney Travel
Need a proxy for this?
XPASS Proxy sells residential proxy traffic by the gigabyte, with the price shown before you pay.
See proxy plansKeep reading

Proxy Guides
How a Media Metadata API Differs From Downloading the File
Reading information about a media item and copying the media itself are different actions. This guide compares them across size, permission, risk and design.
9 min read
Proxy Guides
How to Build a Thumbnail Fetcher for Links You Are Licensed to Use
A step-by-step guide to a thumbnail fetcher that only touches links you are licensed to use, with validation, resizing, caching and safe handling of failures.
9 min read

Proxy Guides
What Is a Media Parsing API and How to Use It With Authorised Data
A media parsing API reads a link to a video, audio or image page and returns structured details. This guide explains it and how to stay within permission.
9 min read