DEV Community

Cover image for Profitable Sport Blogs: Maximizing Monetization with Sport Highlights API
Highlightly
Highlightly

Posted on

Profitable Sport Blogs: Maximizing Monetization with Sport Highlights API

In the current landscape, sport blog owners face a consistent challenge — sourcing timely and relevant content. This is exacerbated by common issues such as content staleness and the time-consuming nature of content generation. Fortunately, there exist already available market solutions designed to enhance the sport blog experience. These solutions not only streamline content creation but also alleviate the time and effort required to consistently maintain a dynamic and engaging platform. By addressing common sport blog problems, these solutions empower blog owners to stay ahead of the curve in delivering fresh, compelling content to their audience.

The current norm for sport blog owners is to write attractive and relevant articles. While some may resort to utilizing a news aggregator API like Microsoft Azure, the downside lies in the potential degradation of content uniqueness and the risk of creating duplications. Consequently, many bloggers lean towards writing posts manually to maintain a distinctive voice and perspective.

Recognizing the evolving landscape, another valuable addition to enhance the sport blog experience is the incorporation of highlight clips. These clips include interviews, penalties, fouls, and game recaps. However, the process of scouring the internet on a per-match basis for these highlights proves to be exceptionally time-consuming and can impede the efficiency of content creation.

In this article we will introduces an innovative solution — Highlightly, a Sport Highlights API aggregator. It offers a centralized hub for diverse and engaging sports highlights and also ensures that your sport blog remains dynamic, distinctive, and rich in multimedia content.

Prerequisites for Sport Highlights API integration

To integrate the Sport Highlights API into your blog, there are certain prerequisites you must meet:

Creating a RapidAPI Account: At the time of writing this article, the API is exclusively available through the trusted platform known as RapidAPI. Please visit their website and complete the registration process. Once that’s done, you can proceed to the next step.

Choosing Your Tier: The API offers different plans tailored to various needs and budgets. I recommend starting with the BASIC plan and then scaling up as required. It’s important to note that all sports are available in the free tier, but certain leagues within that sport are considered premium. For example, the NBA is excluded from basketball, the NFL from American football, etc.

Securing Your Token: Your RapidAPI token is essential as it enables you to query the highlights API data. It’s crucial to maintain the utmost security for this token and ensure that it is not accessible to anyone else. Think of it as akin to your credit card number; only you should have access to it.
That covers the prerequisites you need to fulfill. Once you have completed all the steps mentioned above, you’ll be ready to start querying the highlights data.

Read. Write. Query. Integrate. Monetize.

Comprehensive documentation is absolutely crucial. Fortunately, the API we are utilizing offers exemplary documentation, catering to the needs of developers and bloggers seeking a seamless integration of this feature into their projects. The official documentation for this API can be conveniently accessed here. Even for those without a developer background, accessing the API through the RapidAPI website is a viable option, which we will illustrate in the following section.

One notable feature of this API is its language-agnostic nature. Regardless of your programming language preferences, the integration process is streamlined and effortless. Instead of spamming you with code snippets for a multitude of programming languages, I recommend visiting the Rapid API testing page. Here, you will find pre-constructed code snippets for an extensive range of languages, including but not limited to C, C#, Java, JavaScript, Ruby, and more. This invaluable resource simplifies the integration process significantly. Furthermore, if you prefer to bypass the programming language aspect, you can independently query highlights, making this functionality accessible even to non-developers seeking to enhance their sports blog content.

The base url for the API is:

https://sport-highlights-api.p.rapidapi.com/
Enter fullscreen mode Exit fullscreen mode

At the time of writing this article, the API supports football, basketball, hockey, and american football. The base URLs would look something like this:

https://sport-highlights-api.p.rapidapi.com/football/
https://sport-highlights-api.p.rapidapi.com/basketball/
https://sport-highlights-api.p.rapidapi.com/hockey/
https://sport-highlights-api.p.rapidapi.com/american-football/
Enter fullscreen mode Exit fullscreen mode

Each sport has several routes which can be utilised to better query relevant highlights. These routes are described in detail within the official docs. But to sum it up:

  • /countries and /countries/{countryCode}: These routes provide country-related data, which is essential for contextualizing highlights.
  • /teams and /teams/{team_id}: You can obtain team-specific information through these routes.
  • /leagues and /leagues/{league_id}: League routes grant you access to valuable league-related data, aiding in the precision of your search for highlights.
  • /matches and /matches/{match_id}: These routes offer match-specific details, allowing you to pinpoint the highlights of a particular game.
  • /highlights and /highlights/{highlight_id}: At the core of the API, these routes are where the magic happens. Here, you can retrieve the actual highlights that elevate the quality of your blog.

Lets create a practical example on how one would query highlight data. For this example we will be using Node.js and focus on Soccer. To begin, lets add the following library to our package.json:

npm install axios --save

You can use other package managing tools such as yarn, bower, pnpm as well. If you already have a project, and are not using axios but other libraries to make HTTP requests, you will need to tweak the next few lines of code. Now let us create a simple function:

const axios = require("axios");

const fetchHighlightsData = async (sport, queryParams) => {
  const options = {
    method: 'GET',
    url: `https://sport-highlights-api.p.rapidapi.com/${sport}/highlights`,
    params: queryParams,
    headers: {
      'X-RapidAPI-Key': '<API TOKEN>',
      'X-RapidAPI-Host': 'sport-highlights-api.p.rapidapi.com'
    }
  };

  try {
    const response = await axios.request(options);
    console.log(response.data);
  } catch (error) {
    console.error(error);
  }
};
Enter fullscreen mode Exit fullscreen mode

Remember to replace with your own Rapid API key, which you receive upon subscribing to any tier of the API. With this function, you can fetch data in a variety of ways, example being:

fetchHighlightsData("football", {
  timezone: 'Europe/London',
  season: 2023,
  countryName: "England"
});
Enter fullscreen mode Exit fullscreen mode

With the PRO Rapid API tier, the above function would result in the following data:

{
    "data": [
        ...,
        {
            "id": 6963,
            "type": "VERIFIED",
            "imgUrl": "https://img.youtube.com/vi/Kw7WXUF7khA/hqdefault.jpg",
            "title": "League One: Charlton vs Leyton Orient",
            "description": null,
            "url": "https://www.youtube.com/watch?v=Kw7WXUF7khA",
            "match": {
                "id": 884439978,
                "round": "Regular Season - 1",
                "date": "2023-08-05T14:00:00.000Z",
                "country": {
                    "code": "GB-ENG",
                    "name": "England",
                    "logo": "https://highlightly.net/soccer/images/countries/GB-ENG.svg"
                },
                "awayTeam": {
                    "id": 1169207,
                    "logo": "https://highlightly.net/soccer/images/teams/1169207.png",
                    "name": "Leyton Orient"
                },
                "homeTeam": {
                    "id": 1136869,
                    "logo": "https://highlightly.net/soccer/images/teams/1136869.png",
                    "name": "Charlton"
                },
                "league": {
                    "id": 35675,
                    "logo": "https://highlightly.net/soccer/images/leagues/35675.png",
                    "name": "League One",
                    "season": 2023
                }
            }
        }
    ],
    "pagination": {
        "totalCount": 2371,
        "offset": 0,
        "limit": 40
    }
}
Enter fullscreen mode Exit fullscreen mode

Highlight clips vary and are aggregated from different platforms such as ESPN, Youtube, Twitter, Reddit, etc. After watching the API for a bit, I found that soccer clips that contain goals or fouls come in real time. But game recaps and post match interviews are normally uploaded within 24h post match time.

Now It’s essential to note that the API supports a wide range of routes and query parameters, not just the above demonstrated ones. Another key point to remember is that responses are paginated. If the total count exceeds the limit, you can increase the offset to retrieve the next batch of highlights.

While I could continue to demonstrate various ways to query highlights using league, country, and team query parameters, I suggest taking a look at the APIs official documentation or the RapidAPI testing page.

Example query parameters from the official docs for the football highlights route.<br>

Conclusion: Maximizing Engagement with Highlights

In conclusion, the exploration of maximizing monetization with highlights has been proven to be a rewarding endeavor. The integration of highlights into sport blogs has not only improved user experience but also paved the way for innovative revenue streams. Highlightly Sport Highlights API emerges as a fair solution which reduces your workload.

As you embark on your API journey, consider starting with the BASIC tier, which is free but comes with certain league constraints. For those seeking comprehensive coverage across all sports and leagues, the PRO plan stands as the ideal choice. With this upgrade, you break free from any limitations, ensuring access to highlights from renowned leagues such as NBA, NHL, NFL, Premier League, La Liga, and more.

Wishing you the best of luck on your sport blogging journey.

Top comments (0)