Skip to content

Commit

Permalink
Use web proxy to avoid cs.deals client restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyskoedijk committed Dec 25, 2024
1 parent 42e96e1 commit 036a64f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions SCMM.Market.CSDeals.Client/CSDealsWebClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Logging;
using System.Net;
using System.Text.Json;

namespace SCMM.Market.CSDeals.Client
Expand All @@ -8,7 +9,7 @@ public class CSDealsWebClient : Shared.Web.Client.WebClientBase
private const string WebsiteBaseUri = "https://cs.deals/";
private const string ApiBaseUri = "https://cs.deals/API/";

public CSDealsWebClient(ILogger<CSDealsWebClient> logger) : base(logger) { }
public CSDealsWebClient(ILogger<CSDealsWebClient> logger, IWebProxy webProxy) : base(logger, webProxy: webProxy) { }

public async Task<IEnumerable<CSDealsItemPrice>> GetPricingGetLowestPricesAsync(string appId)
{
Expand All @@ -31,7 +32,7 @@ public async Task<IEnumerable<CSDealsItemPrice>> GetPricingGetLowestPricesAsync(

public async Task<CSDealsMarketplaceSearchResults<CSDealsItemListings>> PostMarketplaceSearchAsync(string appId, string appName, int page = 0)
{
using (var client = BuildWebBrowserHttpClient(referrer: new Uri($"{WebsiteBaseUri}/market/{appName?.ToLower()}")))
using (var client = BuildWebBrowserHttpClient(referrer: new Uri($"{WebsiteBaseUri}/new")))
{
var url = $"{WebsiteBaseUri}ajax/marketplace-search";
var payload = new FormUrlEncodedContent(new Dictionary<string, string>() {
Expand Down

0 comments on commit 036a64f

Please sign in to comment.