jellyfin-srfPlay/Program.cs
Duncan Tourolle ac6a3842dd
Some checks failed
🏗️ Build Plugin / call (push) Failing after 0s
📝 Create/Update Release Draft & Release Bump PR / call (push) Failing after 0s
🧪 Test Plugin / call (push) Failing after 0s
🔬 Run CodeQL / call (push) Failing after 0s
first commit
2025-11-12 22:05:36 +01:00

69 lines
2.5 KiB
C#

using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var handler = new HttpClientHandler
{
Proxy = new WebProxy("http://192.168.1.37:3128"),
UseProxy = true,
AutomaticDecompression = DecompressionMethods.All,
CheckCertificateRevocationList = false
};
using var client = new HttpClient(handler)
{
Timeout = TimeSpan.FromSeconds(30),
DefaultRequestVersion = new Version(1, 1)
};
client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36");
client.DefaultRequestHeaders.Accept.ParseAdd("*/*");
client.DefaultRequestHeaders.AcceptLanguage.ParseAdd("en-US,en;q=0.9");
var url = "https://il.srgssr.ch/integrationlayer/2.0/mediaComposition/byUrn/urn:srf:video:b84713f0-f81b-460f-9b0f-d0517310fb4f.json";
Console.WriteLine($"Testing: {url}");
Console.WriteLine("Using proxy: http://192.168.1.37:3128");
Console.WriteLine();
try
{
Console.WriteLine("Making request...");
var response = await client.GetAsync(url);
Console.WriteLine($"Status Code: {response.StatusCode}");
Console.WriteLine($"Headers:");
foreach (var header in response.Headers)
{
Console.WriteLine($" {header.Key}: {string.Join(", ", header.Value)}");
}
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine($"\nContent Length: {content.Length}");
Console.WriteLine($"First 500 chars: {content.Substring(0, Math.Min(500, content.Length))}");
}
else
{
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine($"\nError content: {content}");
}
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.GetType().Name}");
Console.WriteLine($"Message: {ex.Message}");
if (ex.InnerException != null)
{
Console.WriteLine($"Inner: {ex.InnerException.Message}");
}
Console.WriteLine($"\nStack trace:\n{ex.StackTrace}");
}
}
}