Dexscreener Tokens Scraper avatar
Dexscreener Tokens Scraper

Pricing

$10.00/month + usage

Go to Store
Dexscreener Tokens Scraper

Dexscreener Tokens Scraper

Developed by

Crypto Scraper

Crypto Scraper

Maintained by Community

Scrape token data from DexScreener.com and uncover the next big crypto gem. Stay ahead with live price changes, liquidity, and market cap across multiple chains. Integrate easily into your workflow and make data-driven investment decisions.

5.0 (1)

Pricing

$10.00/month + usage

25

Total users

469

Monthly users

64

Runs succeeded

>99%

Issues response

53 days

Last modified

a day ago

GG

My API requests are not working anymore

Open

ggabitbol1 opened this issue
4 days ago

I have been calling this actor via API for a while now, and it just recently stopped working - my script seems stuck in an endless loop.

Has anything changed recently with the way the API endpoint should be called?

Here is my code:

resp = requests.post("https://api.apify.com/v2/acts/GWfH8uzlNFz2fEjKj/run-sync-get-dataset-items", headers=headers, json=payload)

with:

headers = {'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer <my_apify_token>'}

payload = {"chainName": chain_name, "filterArgs": filter_args, "fromPage": 1, "toPage": 1}

crypto-scraper avatar

Hi, can you send me the whole request that is not working?

GG

ggabitbol1

a day ago

Sure, here is my full script:

#!/usr/bin/env python3 """ Prerequisites: export APIFY_TOKEN="your_apify_api_token" pip install requests """

import os import sys import json import requests from typing import Any, Dict, List

###############################################################################

1. Config

############################################################################### ACTOR_ID = "GWfH8uzlNFz2fEjKj"

Hard‑coded filterArgs (DexScreener query string)

FILTER_ARGS = [ "?rankBy=trendingScoreH6&order=desc" "&minLiq=30000" # if never apes more than 3% of liq: 3% of 30k = 900$ "&minMarketCap=100000" # min MC 100k "&maxMarketCap=15000000" # max MC 15M (avoid slow tokens) "&maxAge=24" ]

Extra guard‑rail constants

MAX_AGE_MINUTES = 48 * 60 MIN_LIQ_USD = 30_000 MAX_MCAP_USD = 15_000_000

###############################################################################

2. Public helper

###############################################################################

def fetch_trending_tokens( *, chain_name: str = "solana", actor_id: str = ACTOR_ID, filter_args: List[str] = FILTER_ARGS, max_age_minutes: int = MAX_AGE_MINUTES, min_liq_usd: int = MIN_LIQ_USD, max_mcap_usd: int = MAX_MCAP_USD, timeout: int = 120, ) -> List[Dict[str, str]]:

apify_token = os.getenv("APIFY_TOKEN")
if not apify_token:
raise RuntimeError("APIFY_TOKEN environment variable not set")
api_url = f"https://api.apify.com/v2/acts/{actor_id}/run-sync-get-dataset-items"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': f'Bearer {apify_token}',
}
payload = {
"chainName": chain_name,
"filterArgs": filter_args,
"fromPage": 1,
"toPage": 1,
}
try:
resp = requests.post(api_url, headers=headers, json=payload, timeout=timeout)
resp.raise_for_status()
items: List[Dict[str, Any]] = resp.json()
except requests.RequestException as err:
raise RuntimeError(f"Request failed: {err}") from err
except json.JSONDecodeError as err:
raise RuntimeError("Invalid JSON in response") from err
if not items:
return [] # Nothing matched; return empty list instead of exiting
# ---------------------------------------------------------------------
# Extra guard‑rail filtering
# ---------------------------------------------------------------------
seen_addresses = set() # Deduplicate by token mint address
results: List[Dict[str, str]] = []
for item in items:
# Field name variants
name = item.get("tokenName") or item.get("name")
address = item.get("address") or item.get("contractAddress")
age_min = item.get("age") or 999_999
liq = item.get("liquidityUsd") or 0
mcap = item.get("marketCapUsd") or 0
symbol = item.get("tokenSymbol")
if (
name
and address
and age_min <= max_age_minutes
and liq >= min_liq_usd
and mcap <= max_mcap_usd
and address not in seen_addresses
and liq > mcap / 30 # exclude tokens with extremely low liq
):
seen_addresses.add(address)
results.append({"name": name, "address": address, "liquidityUsd": liq, "marketCapUsd": mcap})
return results

###############################################################################

3. Main

###############################################################################

def _main() -> None: try: tokens = fetch_trending_tokens() except RuntimeError as exc: sys.stderr.write(str(exc) + "\n") sys.exit(1)

# Print out the table exactly as before
for t in tokens:
print(f"{t['name']} {t['address']}")

if name == "main": _main()

crypto-scraper avatar

Could you please check whether it works with version 2.2?