From d5b82a556fdda10c2485976ea834f021ef3736a1 Mon Sep 17 00:00:00 2001 From: Tsvetoslav Dimov Date: Mon, 19 Aug 2024 17:49:20 +0100 Subject: [PATCH] fix: temporary way for retrieving trakt username --- pkg/client/trakt.go | 2 +- pkg/client/trakt_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/client/trakt.go b/pkg/client/trakt.go index e2f5109..1379081 100644 --- a/pkg/client/trakt.go +++ b/pkg/client/trakt.go @@ -208,7 +208,7 @@ func (tc *TraktClient) ActivateAuthorize(authenticityToken string) error { if err != nil { return err } - value, err := selectorAttributeScrape(response.Body, "#desktop-user-avatar", "href") + value, err := selectorAttributeScrape(response.Body, "a.visible-xs", "href") if err != nil { return err } diff --git a/pkg/client/trakt_test.go b/pkg/client/trakt_test.go index 87b06f1..e38063f 100644 --- a/pkg/client/trakt_test.go +++ b/pkg/client/trakt_test.go @@ -1804,7 +1804,7 @@ func TestTraktClient_ActivateAuthorize(t *testing.T) { httpmock.RegisterResponder( http.MethodPost, traktPathBaseBrowser+traktPathActivateAuthorize, - httpmock.NewStringResponder(http.StatusOK, ``), + httpmock.NewStringResponder(http.StatusOK, `Profile`), ) }, assertions: func(assertions *assert.Assertions, err error) { @@ -1856,7 +1856,7 @@ func TestTraktClient_ActivateAuthorize(t *testing.T) { httpmock.RegisterResponder( http.MethodPost, traktPathBaseBrowser+traktPathActivateAuthorize, - httpmock.NewStringResponder(http.StatusOK, ``), + httpmock.NewStringResponder(http.StatusOK, `Profile`), ) }, assertions: func(assertions *assert.Assertions, err error) { @@ -2027,7 +2027,7 @@ func TestTraktClient_Hydrate(t *testing.T) { httpmock.RegisterResponder( http.MethodPost, traktPathBaseBrowser+traktPathActivateAuthorize, - httpmock.NewStringResponder(http.StatusOK, ``), + httpmock.NewStringResponder(http.StatusOK, `Profile`), ) httpmock.RegisterResponder( http.MethodPost, @@ -2229,7 +2229,7 @@ func TestTraktClient_Hydrate(t *testing.T) { httpmock.RegisterResponder( http.MethodPost, traktPathBaseBrowser+traktPathActivateAuthorize, - httpmock.NewStringResponder(http.StatusOK, ``), + httpmock.NewStringResponder(http.StatusOK, `Profile`), ) httpmock.RegisterResponder( http.MethodPost,