Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Games don't add up #27

Closed
zieluu1 opened this issue May 30, 2023 · 4 comments · Fixed by #31
Closed

Games don't add up #27

zieluu1 opened this issue May 30, 2023 · 4 comments · Fixed by #31
Assignees
Labels
bug Something isn't working

Comments

@zieluu1
Copy link

zieluu1 commented May 30, 2023

I did everything right, I entered the command freegames, the program replied that it received 6 free games but they were not added to steam, unless it's not supposed to be added to stea, can someone help me??

@chuvak889
Copy link

I keep getting errors. I think something bugged in the plugin.

@JourneyOver
Copy link

Yea sadly getting errors now as well..

error is as followed:

 Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 2, position 4.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at ArchiSteamFarm.Web.WebBrowser.UrlGetToJsonObject[T](Uri request, IReadOnlyCollection`1 headers, Uri referer, ERequestOptions requestOptions, Byte maxTries, Int32 rateLimitingDelay)
   at ArchiSteamFarm.Web.WebBrowser.UrlGetToJsonObject[T](Uri request, IReadOnlyCollection`1 headers, Uri referer, ERequestOptions requestOptions, Byte maxTries, Int32 rateLimitingDelay)

hopefully @maxisoft is still around and active, so he can hopefully fix and update whatever is going on.

@woctezuma
Copy link

It is a parsing error. The error happens at one of these two lines:

payload = await webBrowser.UrlGetToJsonObject<JToken>(GetUrl(), rateLimitingDelay: 500).ConfigureAwait(false);

var result = await webBrowser.UrlGetToJsonObject<JToken>(new Uri("https://httpbin.org/ip")).ConfigureAwait(false);

@maxisoft maxisoft pinned this issue Jun 7, 2023
@maxisoft maxisoft self-assigned this Jun 7, 2023
@maxisoft
Copy link
Owner

maxisoft commented Jun 7, 2023

Hello 👋,

I'll try to discuss the issues in a two-part follow-up.


❓ About the original issue

I think the original issue is something related to #3 (comment)

About found X free games on reddit

The found 22 free games on reddit message means that the internal parser has found 22 addlicense entries on reddit. That doesn't mean there is 22 free games going to be added for sure. For instance a game fee offer may have expired or it's a dlc for a paid game that you don't own.

There are three possible scenarios:

  • It may be a misunderstanding of the plugin's messages and currently available free games should be added to your library by the plugin anyway (like for this week Field of Glory II Limited Free Promotional Package - Jun 2023).
  • It may also be a misleading plugin's message but without any log posted I cannot look into this potential specific issue.
  • Last but not least, it may be the plugin which is buggy in some case/setup (because on my setup it successfully collected free games).

So I'll leave this issue open for some time to ensure (according to the comments) that the plugin is working as intended: for instance, for today Field of Glory II Limited Free Promotional Package - Jun 2023 should be added to one's game library. If it's not the case, it's definitely an issue ❗


🐛 About the recent errors

I keep getting errors. I think something bugged in the plugin.

Yea sadly getting errors now as well..

error is as followed:

 Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 2, position 4.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at ArchiSteamFarm.Web.WebBrowser.UrlGetToJsonObject[T](Uri request, IReadOnlyCollection`1 headers, Uri referer, ERequestOptions requestOptions, Byte maxTries, Int32 rateLimitingDelay)
   at ArchiSteamFarm.Web.WebBrowser.UrlGetToJsonObject[T](Uri request, IReadOnlyCollection`1 headers, Uri referer, ERequestOptions requestOptions, Byte maxTries, Int32 rateLimitingDelay)

hopefully @maxisoft is still around and active, so he can hopefully fix and update whatever is going on.

I believe those errors occur when reddit servers are showing 5xx internal errors which serve a html page instead of json payload hence the errors 😕.

As I think it's another issue I'll open a new issue ticket to track that 📝.

@maxisoft maxisoft added the bug Something isn't working label Jun 7, 2023
maxisoft added a commit that referenced this issue Aug 14, 2023
This commit refactors the ASFFreeGamesPlugin class to follow the
Single Responsibility Principle, which states that each class
should have one responsibility, one single purpose.

The main changes are:

- Extracted some methods from ASFFreeGamesPlugin to reduce its complexity
and increase cohesion.
- Moved some methods to other classes where they belong.
- Used more idiomatic C# patterns and features, such as string interpolation,
var keyword, using statements, null operators, LINQ, async/await, etc.
- Added XML documentation comments for public types and members.
- Added regular comments for private or complex code blocks.
- Added more unit tests to cover the refactored code.

This commit also fixes:

- Closes #28: Error when retrieving game list JSON data from reddit
- Resolves #27: Games don't add up
maxisoft added a commit that referenced this issue Aug 14, 2023
This commit adds error handling for reddit 5xx responses that return invalid JSON data, which caused the plugin to fail when retrieving game list from reddit. This fixes issue #28 and #27.

This commit also refactors the ASFFreeGamesPlugin class to follow the
Single Responsibility Principle, which states that each class
should have one responsibility, one single purpose.

The main changes are:

- Extracted some methods from ASFFreeGamesPlugin to reduce its complexity
and increase cohesion.
- Moved some methods to other classes where they belong.
- Used more idiomatic C# patterns and features, such as string interpolation,
var keyword, using statements, null operators, LINQ, async/await, etc.
- Added XML documentation comments for public types and members.
- Added regular comments for private or complex code blocks.
- Added more unit tests to cover the refactored code.
@maxisoft maxisoft unpinned this issue Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants