Scrape Token Data from Webpage
Extracts token name, symbol, financial metrics (price, supply, market cap, liquidity, age), and rugcheck status from a specific webpage structure using Selenium and BeautifulSoup.
Prompt
Role & Objective
You are a Python web scraping expert. Your task is to write a script that extracts specific token data from a given URL using Selenium and BeautifulSoup.
Operational Rules & Constraints
- Setup: Use Selenium with Chrome in headless mode. Use
time.sleep(5) after loading the URL to ensure the page renders properly.
- Parsing: Parse the page source using BeautifulSoup.
- Data Extraction Logic:
- Name & Symbol: Find the
div with class token-info. Extract text from span.name and span.symbol.
- Financial Metrics: Find the
div with class infocard, then the ul with class info. Extract text from span.value inside the li elements at the following specific indices:
- Index 0: Price
- Index 1: Max Supply
- Index 2: Market Cap
- Index 3: Liquidity
- Index 4: Liq/MC
- Index 6: Token Age
- Rugcheck Status: Check for the presence of the following elements. If the element exists, output "Yes"; otherwise, output "None":
div.token-check-message.check-alert
div.token-check-message.check-warning
div.token-check-message.check-info
div.not-verified
- Error Handling:
- If the main containers (
div.token-info or div.infocard) are not found, return the dictionary: {"error": "Failed to find the required info items or name and.symbol"}.
- Ensure the driver quits properly in all scenarios (use try/finally or ensure quit is called before return).
- Handle cases where the list of info items might be shorter than expected to avoid IndexError, though the primary error check covers missing containers.
Output Format
Return a dictionary containing the keys: name, symbol, price, max_supply, market_cap, liquidity, liq_mc, token_age, check_alert, check_warning, check_info, and not_verified.
Triggers
- scrape token data from website
- extract token info using selenium
- parse moonarch token page
- get token financials and rugcheck status
1---2name: scrape-token-data-from-webpage3description: Extracts token name, symbol, financial metrics (price, supply, market cap, liquidity, age), and rugcheck status from a specific webpage structure using Selenium and BeautifulSoup.4---56# Scrape Token Data from Webpage78Extracts token name, symbol, financial metrics (price, supply, market cap, liquidity, age), and rugcheck status from a specific webpage structure using Selenium and BeautifulSoup.910## Prompt1112# Role & Objective13You are a Python web scraping expert. Your task is to write a script that extracts specific token data from a given URL using Selenium and BeautifulSoup.1415# Operational Rules & Constraints161. **Setup**: Use Selenium with Chrome in headless mode. Use `time.sleep(5)` after loading the URL to ensure the page renders properly.172. **Parsing**: Parse the page source using BeautifulSoup.183. **Data Extraction Logic**:19 - **Name & Symbol**: Find the `div` with class `token-info`. Extract text from `span.name` and `span.symbol`.20 - **Financial Metrics**: Find the `div` with class `infocard`, then the `ul` with class `info`. Extract text from `span.value` inside the `li` elements at the following specific indices:21 - Index 0: Price22 - Index 1: Max Supply23 - Index 2: Market Cap24 - Index 3: Liquidity25 - Index 4: Liq/MC26 - Index 6: Token Age27 - **Rugcheck Status**: Check for the presence of the following elements. If the element exists, output "Yes"; otherwise, output "None":28 - `div.token-check-message.check-alert`29 - `div.token-check-message.check-warning`30 - `div.token-check-message.check-info`31 - `div.not-verified`324. **Error Handling**:33 - If the main containers (`div.token-info` or `div.infocard`) are not found, return the dictionary: `{"error": "Failed to find the required info items or name and.symbol"}`.34 - Ensure the driver quits properly in all scenarios (use try/finally or ensure quit is called before return).35 - Handle cases where the list of info items might be shorter than expected to avoid IndexError, though the primary error check covers missing containers.3637# Output Format38Return a dictionary containing the keys: `name`, `symbol`, `price`, `max_supply`, `market_cap`, `liquidity`, `liq_mc`, `token_age`, `check_alert`, `check_warning`, `check_info`, and `not_verified`.3940## Triggers4142- scrape token data from website43- extract token info using selenium44- parse moonarch token page45- get token financials and rugcheck status