-
Notifications
You must be signed in to change notification settings - Fork 1
This tool allows you to access the GMGN API by bypassing Cloudflare protection using browser cookies. We've successfully found a way to interact with the API even after the original IP-based method stopped working.
Malakia-sol/gmgn-api
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
# GMGN API Client ## Introduction This tool allows you to access the GMGN API by bypassing Cloudflare protection using browser cookies. We've successfully found a way to interact with the API even after the original IP-based method stopped working. ## How It Works The GMGN API is protected by Cloudflare, which blocks direct access from scripts. Our solution uses your browser's Cloudflare clearance cookie to authenticate API requests. ## Setup and Usage ### Prerequisites - Node.js installed - Required packages: `npm install node-fetch` ### Basic Usage ``` node gmgn.js [endpoint] ``` Example: ``` node gmgn.js swaps1h node gmgn.js pump1h ``` ### Available Endpoints - `swaps1h` - Get tokens ranked by swap volume in the last hour - `pump1h` - Get tokens ranked by price pump in the last hour - Add your own endpoints in the `endpoints` object ### Setting Up Your Cloudflare Cookies (REQUIRED) The script requires your personal Cloudflare cookies to bypass protection. Follow these steps: 1. Create a new config file named `config.js` (this file is gitignored for security) 2. Visit gmgn.ai in your browser 3. Open browser developer tools (F12) 4. Go to Network tab and refresh the page 5. Find a request to gmgn.ai 6. Look for 'Cookie' in the request headers 7. Find the 'cf_clearance' cookie value and copy it 8. Also note other cookies like GMGN_LOCALE, GMGN_CHAIN, GMGN_THEME 9. Add these to your config.js file (see template provided in the repo) **IMPORTANT: Never commit your cookie values to a public repository** ## How the Script Works 1. The script uses predefined endpoints (in the `endpoints` object) 2. It builds a proper URL with all query parameters 3. It sends the request with your browser cookies to bypass Cloudflare 4. It saves the JSON response to a file named `gmgn_[endpoint]_response.json` ## Key Features - Easily add new endpoints without changing the core code - Automatic parameter handling for arrays (like filters[] and platforms[]) - Detailed error messages when the cookie expires - Command-line support for different endpoints - Uses a separate config file to keep sensitive data private ## Notes - The Cloudflare cookie expires regularly (usually every 24 hours) - When you get a 403 error, you'll need to update your cookies in config.js - Previous IP-based method is no longer functional ## Example Response The API returns detailed information about tokens, including: - Price, volume, and market cap - Social media links - Creator information - Trading metrics - Security indicators ## Conclusion This tool successfully accesses the GMGN API from a script. The API is now accessible and can be integrated into your projects.
About
This tool allows you to access the GMGN API by bypassing Cloudflare protection using browser cookies. We've successfully found a way to interact with the API even after the original IP-based method stopped working.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published