maxisoft / ASFFreeGames

Collect free steam games while asf is running
GNU Affero General Public License v3.0
141 stars 3 forks source link

Can't connect to the reddit #75

Closed GwynbleiddI closed 2 months ago

GwynbleiddI commented 6 months ago

2024-05-23 20:41:40|ArchiSteamFarm-22808|DEBUG|ASF|InternalRequest() Forbidden <- GET https://www.reddit.com/user/ASFinfo.json?sort=new 2024-05-23 20:41:40|ArchiSteamFarm-22808|WARN|ASF|UrlGetToStream() Запрос окончился неудачей после 1 попыток! 2024-05-23 20:41:40|ArchiSteamFarm-22808|DEBUG|ASF|UrlGetToStream() Запрос не удался: https://www.reddit.com/user/ASFinfo.json?sort=new 2024-05-23 20:41:41|ArchiSteamFarm-22808|DEBUG|ASF|InternalRequest() Forbidden <- GET https://www.reddit.com/user/ASFinfo.json?sort=new 2024-05-23 20:41:41|ArchiSteamFarm-22808|WARN|ASF|UrlGetToStream() Запрос окончился неудачей после 1 попыток! 2024-05-23 20:41:41|ArchiSteamFarm-22808|DEBUG|ASF|UrlGetToStream() Запрос не удался: https://www.reddit.com/user/ASFinfo.json?sort=new 2024-05-23 20:41:42|ArchiSteamFarm-22808|DEBUG|ASF|InternalRequest() Forbidden <- GET https://www.reddit.com/user/ASFinfo.json?sort=new 2024-05-23 20:41:42|ArchiSteamFarm-22808|WARN|ASF|UrlGetToStream() Запрос окончился неудачей после 1 попыток! 2024-05-23 20:41:42|ArchiSteamFarm-22808|DEBUG|ASF|UrlGetToStream() Запрос не удался: https://www.reddit.com/user/ASFinfo.json?sort=new 2024-05-23 20:41:44|ArchiSteamFarm-22808|DEBUG|ASF|InternalRequest() Forbidden <- GET https://www.reddit.com/user/ASFinfo.json?sort=new 2024-05-23 20:41:44|ArchiSteamFarm-22808|WARN|ASF|UrlGetToStream() Запрос окончился неудачей после 1 попыток! 2024-05-23 20:41:44|ArchiSteamFarm-22808|DEBUG|ASF|UrlGetToStream() Запрос не удался: https://www.reddit.com/user/ASFinfo.json?sort=new 2024-05-23 20:41:47|ArchiSteamFarm-22808|DEBUG|ASF|InternalRequest() Forbidden <- GET https://www.reddit.com/user/ASFinfo.json?sort=new 2024-05-23 20:41:47|ArchiSteamFarm-22808|WARN|ASF|UrlGetToStream() Запрос окончился неудачей после 1 попыток! 2024-05-23 20:41:47|ArchiSteamFarm-22808|DEBUG|ASF|UrlGetToStream() Запрос не удался: https://www.reddit.com/user/ASFinfo.json?sort=new 2024-05-23 20:41:47|ArchiSteamFarm-22808|ERROR|ASF|CollectGames() Unable to load json from reddit RedditServerException: content is null

ASF:

ASF: v6.0.2.6 Plugin: v1.5.3

maxisoft commented 6 months ago

Hello @GwynbleiddI,

Thank you for reporting this issue. After reviewing the logs, it's seems that the requests to Reddit are being denied, resulting in a Forbidden status. This could be attributed to a few potential causes:

To assist us in resolving this issue, could you please confirm if you can access the following URL from your regular browser: https://www.reddit.com/user/ASFinfo.json?sort=new

I will keep this issue open to collect more information and determine if this is affecting other users as well.

Best regards, maxisoft

GwynbleiddI commented 6 months ago

Really the problem was address blocking. My AFS is located on remote servers in the Netherlands. Connecting to a VPN solved the problem.

kaiserdj commented 6 months ago

First of all, thank you very much for the excellent work on this plugin.

I'd like to suggest a new feature that I think could benefit many users: the option to use a proxy for Reddit requests. Currently, some of us are looking at ASF on VPS whose IP is blocked by Reddit, preventing the plugin from working properly.

Adding an option to configure a proxy will allow you to bypass these restrictions and improve the accessibility of the plugin from different hosting environments.

I appreciate your attention and consideration for this request.

C4illin commented 5 months ago

Hello, I am the developer of the bot you are parsing https://github.com/C4illin/ASFinfo

Maybe you could use https://gist.github.com/C4illin/77a4bcb9a9a7a95e5f291badc93ec6cd instead, it's the same data as posted on reddit.

maxisoft commented 5 months ago

Hey guys,

Thanks for your comments!

@kaiserdj - You're welcome. Adding proxy support is a fantastic suggestion, and I'll definitely aim to incorporate that into the next version. The main challenge right now is ensuring compatibility with ASF's trimmed version to avoid further MissingMethodException issues.

@C4illin - Thanks for reaching out and offering your work! I trully appreciate you maintaining the ASFinfo bot.
While I can't directly swap the Reddit API call for your Gist due to needing the free-to-play or is a dlc data (which isn't included in the gist), it's a fantastic resource to have as a backup in case Reddit is not reachable.
That being said, there's always the possibility of GitHub blocking those same VPN/VPS IPs too.

Additional Ideas

In summary:

I'll keep this issue updated as I make progress.

maxisoft commented 3 months ago

Proxy support for Reddit requests is now live with release v1.6.1.

As per README:

Proxy Setup

The plugin can be configured to use a proxy (HTTP(S), SOCKS4 or SOCKS5) for its HTTP requests to Reddit. You can achieve this in two ways:

  1. Environment Variable: Set the environment variable FREEGAMES_RedditProxy with your desired proxy URL (e.g., http://yourproxy:port).
  2. freegames.json.config: Edit the redditProxy property within the JSON configuration file located at <asf>/config/freegames.json.config. Set the value to your proxy URL.

Example freegames.json.config with Proxy:

{
   ...
  "redditProxy": "http://127.0.0.1:1080"
}

Important Note: If you pass a proxy password, it will be stored in clear text in the freegames.json.config file, even when passing it via the environment variable.

Note: Whichever method you choose (environment variable or config file), only one will be used at a time. The environment variable takes precedence over the config file setting.

maxisoft commented 3 months ago

While proxy support for Reddit requests is now available in v1.6.1, this issue remains open because a separate solution is still required for integration testing.

eg The current integration tests, which I implemented previously, are affected by limitations imposed by the Reddit API.

maxisoft commented 2 months ago

Fixed/Mitigated with latest v1.7.0 release

The issue of failing to connect to Reddit due to potential rate limiting, IP bans, or temporary restrictions has been addressed in the recently released ASFFreeGames v1.7.0.

This version integrates Redlib, a powerful Reddit proxy, as a failover mechanism. In case of any Reddit API errors, Redlib will seamlessly take over, guaranteeing uninterrupted access to free game offerings.

For more details on this improvement and other changes, please refer to the release notes: link to v1.7.0 release notes

If you're still encountering connection issues after upgrading to v1.7.0, please feel free to provide additional information in a new issue.

Thanks!

JerryWn12 commented 3 days ago

Hi, still face this issue: ERROR ASF > Execute() An error occurred: AggregateException One or more errors occurred. (reddit http error code is Forbidden) (reddit http error code is Forbidden) (One or more errors occurred. (invalid status code NotFound for https://redlib.privacyredirect.com/user/ASFinfo?sort=new) (invalid status code NotFound for https://redlib.ducks.party/user/ASFinfo?sort=new) (invalid status code NotFound for https://red.artemislena.eu/user/ASFinfo?sort=new) (invalid status code NotFound for https://red.ngn.tf/user/ASFinfo?sort=new) (invalid status code NotFound for https://rl.bloat.cat/user/ASFinfo?sort=new) (invalid status code NotFound for https://redlib.privacy.com.de/user/ASFinfo?sort=new)) BTW, the issue appears after the bot restart: https://github.com/C4illin/ASFinfo/issues/84#issuecomment-2488106780 The plugin runs normal till that.

*edit: After restarting ASF, the plugin runs normally. **edit: It happens again, and here is the log, you can see the frequency. log.txt