async Task <IEnumerable <IDeal> > IScraper.Scrape(CancellationToken token)
        {
            List <IDeal> deals = new List <IDeal>();

            try
            {
                string content = await GetContent(URL, token);

                if (token.IsCancellationRequested)
                {
                    return(null);
                }

                PlayStationPlusFreeGamesData freeGamesData = PlayStationPlusFreeGamesData.FromJson(content);
                List <IDeal> parsedData = ParseFreeGamesData(freeGamesData);

                deals.AddRange(parsedData);
            }
            catch (Exception e)
            {
                logger.Warn(e.Message);
            }

            return(deals);
        }
        private List <IDeal> ParseFreeGamesData(PlayStationPlusFreeGamesData data)
        {
            List <IDeal> freeGames = new List <IDeal>();

            foreach (Included included in data.Included)
            {
                if (included.Type.ToLower() != "game")
                {
                    continue;
                }

                PricesNonPlusUser plusUserSku = included.Attributes.Skus.First().Prices.PlusUser;
                if (plusUserSku.ActualPrice.Value != 0)
                {
                    continue;
                }

                Availability availability = plusUserSku.Availability;
                Deal         freeGame     = new Deal
                {
                    Discount = 100,
                    Image    = included.Attributes.ThumbnailUrlBase,
                    Link     = $"https://store.playstation.com/en-us/product/{included.Attributes.DefaultSkuId}",
                    Title    = included.Attributes.Name,
                    End      = GetUtcDateTime(availability.EndDate),
                    Start    = GetUtcDateTime(availability.StartDate)
                };
                freeGames.Add(freeGame);
            }

            return(freeGames);
        }
 public static string ToJson(this PlayStationPlusFreeGamesData self) =>
 JsonConvert.SerializeObject(self, Converter.Settings);