Skip to content

Commit

Permalink
updates readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Zettersten committed Dec 2, 2024
1 parent 9908480 commit 9c8a4c9
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CancellationToken cancellationToken
{
try
{
var response = await this.GetAsync($"/{handle}/followers", cancellationToken);
var response = await this.GetAsync($"/{handle.StripAtSignFromHandle()}/followers", cancellationToken);
response.EnsureSuccessStatusCode();
var content = await response.Content.ReadAsStringAsync(cancellationToken);
this.logger.LogDebug("Received content for Facebook page {Handle}", handle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CancellationToken cancellationToken
{
try
{
var response = await this.GetAsync($"/{handle}/", cancellationToken);
var response = await this.GetAsync($"/{handle.StripAtSignFromHandle()}/", cancellationToken);
response.EnsureSuccessStatusCode();

var content = await response.Content.ReadAsStringAsync(cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CancellationToken cancellationToken
{
// LinkedIn profiles are accessed by their handle
var response = await this.GetAsync(
$"/search?q=\"https%3A%2F%2Fwww.linkedin.com%2Fin%2F{handle}\"",
$"/search?q=\"https%3A%2F%2Fwww.linkedin.com%2Fin%2F{handle.StripAtSignFromHandle()}\"",
cancellationToken
);
response.EnsureSuccessStatusCode();
Expand Down
2 changes: 1 addition & 1 deletion SocialCounter/SocialCounter.TikTok/TikTokCounterClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CancellationToken cancellationToken
{
try
{
var response = await this.GetAsync($"/@{handle}", cancellationToken);
var response = await this.GetAsync($"/@{handle.StripAtSignFromHandle()}", cancellationToken);
response.EnsureSuccessStatusCode();

var content = await response.Content.ReadAsStringAsync(cancellationToken);
Expand Down
2 changes: 1 addition & 1 deletion SocialCounter/SocialCounter.X/XCounterClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CancellationToken cancellationToken
{
try
{
var response = await this.GetAsync($"/{handle}", cancellationToken);
var response = await this.GetAsync($"/{handle.StripAtSignFromHandle()}", cancellationToken);
response.EnsureSuccessStatusCode();

var content = await response.Content.ReadAsStringAsync(cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CancellationToken cancellationToken
{
try
{
var response = await this.GetAsync($"/@{handle}", cancellationToken);
var response = await this.GetAsync($"/@{handle.StripAtSignFromHandle()}", cancellationToken);
response.EnsureSuccessStatusCode();

var content = await response.Content.ReadAsStringAsync(cancellationToken);
Expand Down
3 changes: 3 additions & 0 deletions SocialCounter/SocialCounter/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,7 @@ Action<IServiceProvider, HttpClient> configureClient
builder.HttpClientBuilder.ConfigureHttpClient(configureClient);
return builder;
}

public static string StripAtSignFromHandle(this string handle) =>
handle.StartsWith('@') ? handle[1..] : handle;
}

0 comments on commit 9c8a4c9

Please sign in to comment.