Skip to content

Conversation

FFace32
Copy link
Contributor

@FFace32 FFace32 commented Oct 10, 2023

Adds support for FlareSolverr v3.3.0's proxy authentication.

Resolves #23

@ilike2burnthing ilike2burnthing merged commit 86b5b28 into FlareSolverr:master Mar 1, 2024
@ilike2burnthing
Copy link
Contributor

Thanks. We're having an issue with NuGet, but once that's resolved we'll push a new version with this.

@FFace32
Copy link
Contributor Author

FFace32 commented Mar 1, 2024

Thanks. We're having an issue with NuGet, but once that's resolved we'll push a new version with this.

Could you also please take a look at my other merge requests? #26 and #27

They're also part of FlareSolverrSharp-fork.

@ilike2burnthing
Copy link
Contributor

I'm just maintaining FlareSolverr while the actual dev is away. I was able to test this PR easily enough using Jackett, however other than 'does it still work with Jackett' I am not sure how to test those PRs specifically. If you could provide scripts or commands I can use on Windows to run as tests, I'll be happy to take a look them.

@FFace32
Copy link
Contributor Author

FFace32 commented May 3, 2024

I'm just maintaining FlareSolverr while the actual dev is away. I was able to test this PR easily enough using Jackett, however other than 'does it still work with Jackett' I am not sure how to test those PRs specifically. If you could provide scripts or commands I can use on Windows to run as tests, I'll be happy to take a look them.

I've got some free time just now and I managed to write this (with <PackageReference Include="FlareSolverrSharp-fork" Version="3.0.5" /> which contains #26 and #27):

using FlareSolverrSharp.Solvers;
using FlareSolverrSharp.Types;
using System.Reflection;

namespace Playground
{
    class Program
    {
        static async Task Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine($"Usage: dotnet run {Assembly.GetExecutingAssembly().Location} <FlareSolverr URL>");
                return;
            }

            FlareSolverr solver = new(args[0]);

            FlareSolverrIndexResponse indexResponse = await solver.GetIndex();
            Console.WriteLine("GetIndex() returned the following:");
            Console.WriteLine($"  Message = '{indexResponse.Message}'");
            Console.WriteLine($"  Version = '{indexResponse.Version}'");
            Console.WriteLine($"  UserAgent = '{indexResponse.UserAgent}'");
            Console.WriteLine("Now, I'll save the UserAgent and use it WITHOUT having to call Solve() and do an expensive request.\n");

            // Code that uses indexResponse.UserAgent goes here

            Uri uri = new("https://setcookie.net/");
            HttpRequestMessage request = new(HttpMethod.Get, uri);

            Console.WriteLine($"Calling Solve() on {uri} with no cookies...");
            FlareSolverrResponse response = await solver.Solve(request);

            if (response.Solution.Response.Contains("Received no cookies."))
            {
                Console.WriteLine("Received no cookies, as expected.");
            }
            else
            {
                Console.WriteLine("Received cookies, which is unexpected!");
            }

            Console.WriteLine($"Calling Solve() on {uri} with 2 cookies...");
            response = await solver.Solve(request, cookies: [
                new Cookie() { Name = "test", Value = "value" },
                new Cookie() { Name = "test2", Value = "value2" }
            ]);

            if (response.Solution.Response.Contains("Received no cookies."))
            {
                Console.WriteLine("Received no cookies, which is unexpected!");
            }
            else if (response.Solution.Response.Contains("test = value") &&
                    response.Solution.Response.Contains("test2 = value2"))
            {
                Console.WriteLine("Received cookies, as expected.");
            }
            else
            {
                Console.WriteLine($"Something went wrong, here's the response:\n{response.Solution.Response}");
            }
        }
    }
}

Make sure you're using .NET8 when compiling!

@FFace32 FFace32 mentioned this pull request Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for proxy credentials
2 participants