The Steam Inventory Fetcher is a robust tool designed to efficiently retrieve Steam user inventories. It features an advanced smart proxy rotation system that effectively manages high request volumes and mitigates rate limiting issues. This system is optimized for use with proxies from WebShare, ensuring reliable performance and minimizing the risk of IP bans.
- WebShare Proxy Integration: Specifically designed to work with proxies from WebShare.
- Smart Proxy Rotation: Automatically rotates proxies to bypass rate limits and increase request success rates.
- Proxy Cooldown: Implements a cooldown mechanism for rate-limited proxies to prevent excessive retries.
- Proxy Caching: Caches successful proxies to improve efficiency and reduce lookup times for future requests.
- Fallback Mechanism: Reverts to the last successful proxy after multiple failed attempts with different proxies.
- Retry Limit: Limits the number of attempts to 20 before marking the request as failed, ensuring resilience.
The Steam Inventory Fetcher uses a sophisticated proxy management system to handle requests:
- Proxy Pool Initialization: On startup, the system initializes a pool of WebShare proxies.
- Request Handling: For each inventory fetch request, the system selects an available proxy from the pool.
- Rate Limit Management: If a proxy hits a rate limit, it is placed on cooldown, and a new proxy is selected for subsequent requests.
- Proxy Caching: Proxies that successfully complete requests are cached to speed up future requests.
- Fallback Mechanism: After 10 consecutive failed attempts with different proxies, the system reverts to the last successful proxy.
- Retry Limit: The system attempts to fetch inventory data up to 20 times before considering the request failed.
Before installing, ensure you have:
- Docker installed on your system.
- A WebShare API Key (obtain from WebShare API Keys).
Clone the repository and navigate to the project directory:
git clone https://github.com/dixon2004/steam-inventory-fetcher.git
cd steam-inventory-fetcher-
Create and Edit the
.envFile:-
Rename
template.envto.envin the root directory. -
Open
.envand update the following:WEBSHARE_API_KEY = "your_webshare_api_key_here" AUTH_TOKEN = "your_auth_token_here"
-
WEBSHARE_API_KEY: Insert your WebShare API key obtain from WebShare API Keys.
-
AUTH_TOKEN: If provided, the API will require this token for authentication. If left empty, authentication is disabled, allowing unrestricted access.
-
-
Build and Start the Service:
docker-compose up --build -d
This will build the necessary Docker image and start the Steam Inventory Fetcher as a background service on port 8080.
-
Stopping the Service:
To stop and remove the running containers, execute:
docker-compose down
-
Restarting the Service:
If you need to restart the service after making changes to the environment variables or code:
docker-compose down && docker-compose up --build -d -
Checking Logs:
To monitor the service logs in real-time:
docker-compose logs -f
The system includes auto-generated API documentation via Swagger. Access it at:
http://localhost:8080/docs
To integrate Steam Inventory Fetcher with TF2Autobot:
-
Update Inventory Fetch Logic:
-
Open
tf2autobot/src/classes/InventoryApis/SteamApis.ts. -
Replace the existing code:
import { UnknownDictionaryKnownValues } from 'src/types/common'; import Bot from '../Bot'; import InventoryApi from './InventoryApi'; export default class SteamApis extends InventoryApi { constructor(bot: Bot) { super(bot, 'steamApis'); } protected getURLAndParams( steamID64: string, appID: number, contextID: string ): [string, UnknownDictionaryKnownValues] { return [ `https://api.steamapis.com/steam/inventory/${steamID64}/${appID}/${contextID}`, { api_key: this.getApiKey() } ]; } }
with:
import { UnknownDictionaryKnownValues } from 'src/types/common'; import Bot from '../Bot'; import InventoryApi from './InventoryApi'; export default class SteamApis extends InventoryApi { constructor(bot: Bot) { super(bot, 'steamApis'); } protected getURLAndParams( steamID64: string, appID: number, contextID: string ): [string, UnknownDictionaryKnownValues] { return [ `http://localhost:8080/steam/inventory/${steamID64}/${appID}/${contextID}`, { api_key: 'your_actual_auth_token_here' } ]; } }
-
Replace
'your_actual_auth_token_here'with the Auth Token from your.envfile.
-
-
Handle Dependencies:
-
On Windows: Delete
node_modulesanddistdirectories by right-clicking and selecting delete or using:rmdir /s /q node_modules dist -
On Linux: Remove
node_modulesanddistdirectories with:rm -rf node_modules dist
-
Reinstall dependencies and rebuild the project:
npm install --no-audit && npm run build
-
-
Test Integration:
- Test the updated functionality with TF2Autobot to ensure proper interaction with the new API endpoint and Auth Token.
This project is licensed under the MIT License. See the LICENSE file for details.