Skip to content

Commit

Permalink
fix: temporary way for retrieving trakt username
Browse files Browse the repository at this point in the history
  • Loading branch information
cecobask committed Aug 19, 2024
1 parent 7d6aaba commit d5b82a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/client/trakt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/client/trakt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1804,7 +1804,7 @@ func TestTraktClient_ActivateAuthorize(t *testing.T) {
httpmock.RegisterResponder(
http.MethodPost,
traktPathBaseBrowser+traktPathActivateAuthorize,
httpmock.NewStringResponder(http.StatusOK, `<a id="desktop-user-avatar" href="/users/cecobask"></a>`),
httpmock.NewStringResponder(http.StatusOK, `<a class="visible-xs" href="/users/cecobask">Profile</a>`),
)
},
assertions: func(assertions *assert.Assertions, err error) {
Expand Down Expand Up @@ -1856,7 +1856,7 @@ func TestTraktClient_ActivateAuthorize(t *testing.T) {
httpmock.RegisterResponder(
http.MethodPost,
traktPathBaseBrowser+traktPathActivateAuthorize,
httpmock.NewStringResponder(http.StatusOK, `<a id="desktop-user-avatar" href="invalid"></a>`),
httpmock.NewStringResponder(http.StatusOK, `<a class="visible-xs" href="invalid">Profile</a>`),
)
},
assertions: func(assertions *assert.Assertions, err error) {
Expand Down Expand Up @@ -2027,7 +2027,7 @@ func TestTraktClient_Hydrate(t *testing.T) {
httpmock.RegisterResponder(
http.MethodPost,
traktPathBaseBrowser+traktPathActivateAuthorize,
httpmock.NewStringResponder(http.StatusOK, `<a id="desktop-user-avatar" href="/users/cecobask"></a>`),
httpmock.NewStringResponder(http.StatusOK, `<a class="visible-xs" href="/users/cecobask">Profile</a>`),
)
httpmock.RegisterResponder(
http.MethodPost,
Expand Down Expand Up @@ -2229,7 +2229,7 @@ func TestTraktClient_Hydrate(t *testing.T) {
httpmock.RegisterResponder(
http.MethodPost,
traktPathBaseBrowser+traktPathActivateAuthorize,
httpmock.NewStringResponder(http.StatusOK, `<a id="desktop-user-avatar" href="/users/cecobask"></a>`),
httpmock.NewStringResponder(http.StatusOK, `<a class="visible-xs" href="/users/cecobask">Profile</a>`),
)
httpmock.RegisterResponder(
http.MethodPost,
Expand Down

0 comments on commit d5b82a5

Please sign in to comment.