Rank Tracker API Fundamentals: Implementing with IPFLY Residential Network using Python
Search engine ranking data forms the strategic bedrock of digital marketing, underpinning data-driven decisions that determine content investment, competitive positioning, and organic growth trajectories. Rank tracker APIs, whether custom-built or sourced commercially, provide programmatic access to this crucial intelligence, transforming manual position checks into automated, scalable monitoring systems. This article explores the critical aspects of developing and implementing a rank tracker API, focusing on leveraging Python and IPFLY’s robust residential proxy network to achieve accuracy and scalability.
The rank tracker API ecosystem encompasses various architectural approaches: third-party SaaS platforms (Ahrefs, SEMrush, Moz Pro), search engine official APIs (Google Search Console, Bing Webmaster Tools), and custom crawling infrastructures developed by organizations and enterprises with specific requirements. Each approach presents distinct trade-offs in terms of data freshness, geographical precision, cost structure, and customization flexibility. Understanding these trade-offs is essential for selecting the optimal solution for your specific needs.
For organizations with complex SEO operations, custom rank tracker API development often proves indispensable. Commercial platforms may lack the granular geo-targeting, specific SERP feature tracking, or integration flexibility offered by proprietary systems. Building an effective rank tracking infrastructure, however, presents formidable technical challenges, particularly in overcoming Google’s sophisticated anti-automation measures, which necessitate a professional-grade proxy infrastructure. This is where solutions like IPFLY become crucial, offering the residential IP addresses needed to mimic genuine user behavior and avoid detection.
This guide details the implementation of a rank tracker API using Python, a primary language for SEO tools, providing practical code examples and architectural guidance for a production-grade system leveraging the IPFLY residential proxy infrastructure. By combining Python’s versatility with IPFLY’s robust network, developers can create highly effective and reliable rank tracking solutions tailored to their unique needs. The key is to understand the core components of a rank tracker API and how to integrate them seamlessly.

Core Components of a Rank Tracker API Architecture
A well-designed rank tracker API comprises three essential layers: the data collection layer, the processing and storage layer, and the API interface layer. Each layer performs specific functions and contributes to the overall effectiveness and reliability of the system. Understanding these components is essential for building a robust and scalable rank tracker API.
Data Collection Layer
The foundation of any rank tracker API is reliable SERP data acquisition. This layer must:
- Execute search queries across targeted keywords and geographic markets. This requires the ability to specify keywords and locations accurately.
- Parse results pages to extract ranking positions, URLs, titles, and descriptions. Accurate parsing ensures that the data extracted is relevant and reliable.
- Capture SERP features (featured snippets, People Also Ask, local packs, knowledge panels). These features significantly influence user behavior and should be tracked.
- Handle dynamic content and JavaScript-rendered results. Modern SERPs heavily rely on JavaScript, so the system must be able to render and extract data from these pages.
- Circumvent detection mechanisms that block or misdirect automated collection. This is where residential proxies like IPFLY become essential.
Processing and Storage Layer
Raw SERP data requires transformation and persistence:
- Normalization of result structures across different queries and time periods. This ensures consistency and comparability of data.
- Deduplication and change detection to identify ranking fluctuations. Identifying changes over time is crucial for understanding SEO performance.
- Time-series storage supporting historical trend analysis. Historical data allows for the identification of patterns and trends.
- Integration with business intelligence and reporting systems. Integrating the rank tracker API with other systems allows for comprehensive analysis.
API Interface Layer
The rank tracker API exposes functionality to consuming applications:
- RESTful endpoints for keyword management and ranking retrieval. RESTful APIs provide a standardized way to interact with the system.
- Authentication and authorization for multi-tenancy or client-specific access. Secure access is essential for protecting sensitive data.
- Rate limiting and quota management to ensure fair resource utilization. Rate limiting prevents abuse and ensures fair access for all users.
- Webhook support for real-time ranking change notifications. Real-time notifications allow for immediate response to changes in ranking.
Python Implementation: Building a Basic Rank Tracker API
This section provides a practical guide to building a basic rank tracker API using Python. The implementation focuses on core functionalities and demonstrates how to integrate with IPFLY’s residential proxy network. Understanding the code examples and architectural guidelines presented here will enable developers to create custom rank tracking solutions tailored to their specific needs.
Environment Setup and Dependencies
Start with the essential Python packages for rank tracker API development:
# requirements.txt
requests>=2.28.0
beautifulsoup4>=4.11.0
selenium>=4.8.0
webdriver-manager>=3.8.0
pydantic>=1.10.0
fastapi>=0.95.0
uvicorn>=0.20.0
sqlalchemy>=2.0.0
alembic>=1.10.0
redis>=4.5.0
celery>=5.2.0
python-dotenv>=1.0.0
Install the dependencies:
pip install -r requirements.txt
Basic SERP Scraping with Requests and Beautiful Soup
For rank tracker API implementations targeting static HTML results:
import requests
from bs4 import BeautifulSoup
from urllib.parse import quote_plus
from typing import List, Dict, Optional
import random
import time
class BasicRankTracker:
def __init__(self, proxy_config: Optional[Dict] = None):
self.session = requests.Session()
self.session.headers.update({'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.0'})
self.proxy_config = proxy_config
def construct_search_url(self, keyword: str, location: str = 'us',
language: str = 'en', start: int = 0) -> str:
"""Construct Google search URL with parameters."""
base_url = "https://www.google.com/search"
params = {'q': quote_plus(keyword), 'hl': language, 'gl': location, 'start': start, 'num': 100 # Results per page
}
query_string = '&'.join([f"{k}={v}" for k, v in params.items()])
return f"{base_url}?{query_string}"
def fetch_serp(self, keyword: str, location: str = 'us') -> Optional[str]:
"""Fetch SERP HTML with proxy rotation."""
url = self.construct_search_url(keyword, location)
proxies = None
if self.proxy_config:
# IPFLY proxy configuration
proxy_url = f"http://{self.proxy_config['username']}:{self.proxy_config['password']}@" \
f"{self.proxy_config['host']}:{self.proxy_config['port']}"
proxies = {'http': proxy_url, 'https': proxy_url
}
try:
# Random delay to mimic human behavior
time.sleep(random.uniform(2, 5))
response = self.session.get(
url,
proxies=proxies,
timeout=30,
allow_redirects=True)
response.raise_for_status()
return response.text
except requests.exceptions.RequestException as e:
print(f"Request failed for '{keyword}': {e}")
return None
def parse_results(self, html: str, keyword: str) -> List[Dict]:
"""Parse organic search results from SERP HTML."""
soup = BeautifulSoup(html, 'html.parser')
results = []
# Google result containers (selectors subject to change)
result_containers = soup.select('div.g, div[data-header-feature]')
for position, container in enumerate(result_containers, 1):
try:
title_elem = container.select_one('h3')
url_elem = container.select_one('a[href]')
desc_elem = container.select_one('div.VwiC3b, span.aCOpRe')
if title_elem and url_elem:
result = {'keyword': keyword, 'position': position, 'title': title_elem.get_text(strip=True),
'url': url_elem['href'], 'description': desc_elem.get_text(strip=True) if desc_elem else '',
'timestamp': time.time()}
results.append(result)
except Exception as e:
print(f"Parsing error at position {position}: {e}")
continue
return results
# Usage example with IPFLY residential proxy
if __name__ == "__main__":
ipfly_config = {'host': 'proxy.ipfly.com', 'port': '3128', 'username': 'your_ipfly_username',
'password': 'your_ipfly_password'}
tracker = BasicRankTracker(proxy_config=ipfly_config)
keywords = ["seo tools", "rank tracking software", "keyword research api"]
location = "us" # Target location
for keyword in keywords:
html = tracker.fetch_serp(keyword, location)
if html:
results = tracker.parse_results(html, keyword)
print(f"Found {len(results)} results for '{keyword}'")
for r in results[:5]: # Display top 5
print(f" {r['position']}. {r['title'][:60]}...")
Advanced Implementation with Selenium for JavaScript-Rendered Content
Modern SERPs heavily utilize JavaScript, requiring browser automation to obtain accurate rank tracker API data. Selenium provides a powerful tool for automating browser interactions and extracting data from dynamic web pages. The following code example demonstrates how to use Selenium to scrape SERPs and extract ranking data, including handling JavaScript-rendered content.
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from webdriver_manager.chrome import ChromeDriverManager
from typing import List, Dict, Optional
import json
import time
class SeleniumRankTracker:
def __init__(self, proxy_config: Optional[Dict] = None, headless: bool = True):
self.proxy_config = proxy_config
self.headless = headless
self.driver = None
def initialize_driver(self):
"""Initialize Chrome WebDriver with IPFLY proxy configuration."""
chrome_options = Options()
if self.headless:
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--disable-blink-features=AutomationControlled')
chrome_options.add_argument('--disable-web-security')
chrome_options.add_argument('--disable-features=IsolateOrigins,site-per-process')
# IPFLY residential proxy configuration
if self.proxy_config:
proxy_string = f"{self.proxy_config['host']}:{self.proxy_config['port']}"
chrome_options.add_argument(f'--proxy-server=http://{proxy_string}')
# Additional stealth measures
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
chrome_options.add_experimental_option('useAutomationExtension', False)
service = Service(ChromeDriverManager().install())
self.driver = webdriver.Chrome(service=service, options=chrome_options)
# Execute CDP commands to prevent detection
self.driver.execute_cdp_cmd('Page.addScriptToEvaluateOnNewDocument', {'source': '''
Object.defineProperty(navigator, 'webdriver', {
get: () => undefined
})
'''})
def search_and_extract(self, keyword: str, location: str = 'United States',
language: str = 'en') -> List[Dict]:
"""Execute search and extract ranking data with JavaScript rendering."""
if not self.driver:
self.initialize_driver()
try:
# Construct search URL with localization
search_url = f"https://www.google.com/search?q={keyword.replace(' ', '+')}"
search_url += f"&hl={language}≷={location[:2].lower()}"
self.driver.get(search_url)
# Wait for results to load
wait = WebDriverWait(self.driver, 10)
wait.until(EC.presence_of_element_located((By.ID, "search")))
# Additional wait for dynamic content
time.sleep(2)
# Extract organic results
results = []
result_elements = self.driver.find_elements(By.CSS_SELECTOR, "div.g")
for position, element in enumerate(result_elements, 1):
try:
title = element.find_element(By.CSS_SELECTOR, "h3").text
url = element.find_element(By.CSS_SELECTOR, "a").get_attribute("href")
# Extract description with multiple fallback selectors
desc_selectors = ["div.VwiC3b", "span.aCOpRe", "div.s3v94d"]
description = ""
for selector in desc_selectors:
try:
description = element.find_element(By.CSS_SELECTOR, selector).text
break
except:
continue
# Check for SERP features
featured_snippet = self._check_featured_snippet(element)
results.append({'keyword': keyword, 'position': position, 'title': title, 'url': url,
'description': description, 'featured_snippet': featured_snippet, 'location': location,
'timestamp': time.time()})
except Exception as e:
print(f"Extraction error at position {position}: {e}")
continue
# Extract People Also Ask
paa_questions = self._extract_paa()
# Extract related searches
related_searches = self._extract_related_searches()
return {'organic_results': results, 'people_also_ask': paa_questions, 'related_searches': related_searches,
'total_results': len(results)}
except Exception as e:
print(f"Search execution failed: {e}")
return {'error': str(e)}
def _check_featured_snippet(self, element) -> Optional[Dict]:
"""Detect and extract featured snippet content."""
try:
# Check for paragraph, list, or table snippets
snippet_selectors = {'paragraph': 'div.xpdopen div.VwiC3b', 'list': 'div.xpdopen ul',
'table': 'div.xpdopen table'}
for snippet_type, selector in snippet_selectors.items():
try:
snippet_elem = element.find_element(By.CSS_SELECTOR, selector)
return {'type': snippet_type, 'content': snippet_elem.text[:500]}
except:
continue
return None
except:
return None
def _extract_paa(self) -> List[str]:
"""Extract People Also Ask questions."""
questions = []
try:
paa_elements = self.driver.find_elements(
By.CSS_SELECTOR, "div.related-question-pair span")
for elem in paa_elements:
questions.append(elem.text)
except:
pass
return questions
def _extract_related_searches(self) -> List[str]:
"""Extract related search queries."""
related = []
try:
related_elements = self.driver.find_elements(
By.CSS_SELECTOR, "div.AJLUJb a")
for elem in related_elements:
related.append(elem.text)
except:
pass
return related
def close(self):
"""Clean up WebDriver resources."""
if self.driver:
self.driver.quit()
# Production usage with IPFLY residential rotation
class RotatingSeleniumTracker:
def __init__(self, ipfly_credentials: List[Dict]):
self.credentials = ipfly_credentials
self.current_index = 0
def get_next_proxy(self) -> Dict:
"""Rotate through IPFLY residential proxy pool."""
proxy = self.credentials[self.current_index]
self.current_index = (self.current_index + 1) % len(self.credentials)
return proxy
def execute_tracked_search(self, keyword: str, location: str) -> Dict:
"""Execute search with automatic proxy rotation on failure."""
max_retries = 3
for attempt in range(max_retries):
proxy = self.get_next_proxy()
tracker = SeleniumRankTracker(proxy_config=proxy)
try:
results = tracker.search_and_extract(keyword, location)
tracker.close()
if 'error' not in results:
return results
except Exception as e:
print(f"Attempt {attempt + 1} failed with proxy {proxy['host']}: {e}")
tracker.close()
time.sleep(5) # Cooldown before retry
return {'error': 'All retry attempts failed'}
FastAPI-Based Rank Tracker API Service
Expose rank tracker API functionality through a production-ready web service. FastAPI provides a modern, high-performance framework for building APIs with Python. The following code example demonstrates how to create a rank tracker API service using FastAPI, incorporating database integration, background task processing with Celery, and caching with Redis. This setup ensures scalability and reliability for handling large volumes of keyword tracking requests.
from fastapi import FastAPI, HTTPException, Depends, BackgroundTasks
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
from pydantic import BaseModel, Field
from typing import List, Optional, Dict
from datetime import datetime
from sqlalchemy import create_engine, Column, String, Integer, Float, DateTime, Text
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, Session
from celery import Celery
import redis
import json
import os
# Database setup
SQLALCHEMY_DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///./ranktracker.db")
engine = create_engine(SQLALCHEMY_DATABASE_URL)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()
# Redis for caching and task queue
redis_client = redis.Redis(
host=os.getenv("REDIS_HOST", "localhost"),
port=int(os.getenv("REDIS_PORT", 6379)),
decode_responses=True)
# Celery for background task processing
celery_app = Celery('rank_tracker',
broker=os.getenv("CELERY_BROKER_URL", "redis://localhost:6379/0"),
backend=os.getenv("CELERY_RESULT_BACKEND", "redis://localhost:6379/0"))
# Database models
class RankingData(Base):
__tablename__ = "rankings"
id = Column(Integer, primary_key=True, index=True)
keyword = Column(String, index=True)
domain = Column(String, index=True)
position = Column(Integer)
url = Column(Text)
title = Column(Text)
description = Column(Text)
location = Column(String, default="us")
device_type = Column(String, default="desktop")
search_volume = Column(Integer, nullable=True)
timestamp = Column(DateTime, default=datetime.utcnow)
serp_features = Column(Text, nullable=True) # JSON string
Base.metadata.create_all(bind=engine)
# Pydantic models
class KeywordRequest(BaseModel):
keywords: List[str] = Field(..., min_items=1, max_items=100)
location: str = Field(default="us", regex="^[a-z]{2}$")
language: str = Field(default="en", regex="^[a-z]{2}$")
device_type: str = Field(default="desktop", regex="^(desktop|mobile|tablet)$")
priority: int = Field(default=1, ge=1, le=5)
class RankingResponse(BaseModel):
keyword: str
position: int
url: str
title: str
description: Optional[str]
timestamp: datetime
class APICredentials(BaseModel):
api_key: str
# FastAPI application
app = FastAPI(
title="Rank Tracker API",
description="Enterprise-grade SEO ranking monitoring with IPFLY residential proxies",
version="1.0.0")
security = HTTPBearer()
# Dependency injection
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()
def verify_credentials(credentials: HTTPAuthorizationCredentials = Depends(security)):
"""Verify API key against stored credentials."""
# Implement proper authentication in production
if credentials.credentials != os.getenv("API_KEY", "test-key"):
raise HTTPException(status_code=401, detail="Invalid API key")
return credentials.credentials
# IPFLY proxy configuration loader
def load_ipfly_proxies() -> List[Dict]:
"""Load IPFLY residential proxy pool from configuration."""
# In production, load from secure configuration management
proxy_list = []
proxy_count = int(os.getenv("IPFLY_PROXY_COUNT", "10"))
for i in range(proxy_count):
proxy_list.append({
'host': os.getenv(f"IPFLY_HOST_{i}", "proxy.ipfly.com"),
'port': os.getenv(f"IPFLY_PORT_{i}", "3128"),
'username': os.getenv(f"IPFLY_USER_{i}", ""),
'password': os.getenv(f"IPFLY_PASS_{i}", ""),
'location': os.getenv(f"IPFLY_LOC_{i}", "us")
})
return proxy_list
ipfly_proxies = load_ipfly_proxies()
# Celery task for background ranking checks
@celery_app.task(bind=True, max_retries=3)
def fetch_rankings_task(self, keyword: str, location: str, device_type: str):
"""Background task to fetch rankings with IPFLY proxy rotation."""
from selenium_tracker import RotatingSeleniumTracker # Import from previous example
try:
tracker = RotatingSeleniumTracker(ipfly_proxies)
results = tracker.execute_tracked_search(keyword, location)
if 'error' in results:
raise Exception(results['error'])
# Store results in database
db = SessionLocal()
try:
for result in results.get('organic_results', []):
ranking = RankingData(
keyword=keyword,
domain=result['url'].split('/')[2],
position=result['position'],
url=result['url'],
title=result['title'],
description=result.get('description', ''),
location=location,
device_type=device_type,
serp_features=json.dumps({'people_also_ask': results.get('people_also_ask', []),
'related_searches': results.get('related_searches', [])}))
db.add(ranking)
db.commit()
finally:
db.close()
return {'status': 'success', 'keyword': keyword, 'results_count': len(results.get('organic_results', []))}
except Exception as exc:
# Retry with exponential backoff
self.retry(countdown=60 * (2 ** self.request.retries), exc=exc)
# API endpoints
@app.post("/track", response_model=Dict)
async def submit_tracking_request(
request: KeywordRequest,
background_tasks: BackgroundTasks,
credentials: str = Depends(verify_credentials),
db: Session = Depends(get_db)
):
"""
Submit keywords for ranking tracking.
Returns immediately with task IDs; processing occurs in background.
"""
task_ids = []
for keyword in request.keywords:
# Check cache for recent results
cache_key = f"ranking:{keyword}:{request.location}:{request.device_type}"
cached = redis_client.get(cache_key)
if cached:
task_ids.append({'keyword': keyword, 'status': 'cached', 'data': json.loads(cached)})
continue
# Submit background task
task = fetch_rankings_task.delay(
keyword=keyword,
location=request.location,
device_type=request.device_type
)
task_ids.append({'keyword': keyword, 'status': 'queued', 'task_id': task.id})
return {'submitted_at': datetime.utcnow(), 'tasks': task_ids, 'estimated_completion': '2-5 minutes per keyword'}
@app.get("/results/{keyword}", response_model=List[RankingResponse])
async def get_ranking_results(
keyword: str,
location: Optional[str] = "us",
limit: int = 10,
credentials: str = Depends(verify_credentials),
db: Session = Depends(get_db)
):
"""Retrieve stored ranking results for a specific keyword."""
results = db.query(RankingData).filter(
RankingData.keyword == keyword,
RankingData.location == location
).order_by(RankingData.timestamp.desc()).limit(limit).all()
if not results:
raise HTTPException(status_code=404, detail="No ranking data found for this keyword")
return results
@app.get("/history/{keyword}/{domain}")
async def get_ranking_history(
keyword: str,
domain: str,
days: int = 30,
credentials: str = Depends(verify_credentials),
db: Session = Depends(get_db)
):
"""Retrieve historical ranking trends for a specific keyword-domain combination."""
from datetime import timedelta
cutoff_date = datetime.utcnow() - timedelta(days=days)
history = db.query(RankingData).filter(
RankingData.keyword == keyword,
RankingData.domain == domain,
RankingData.timestamp >= cutoff_date
).order_by(RankingData.timestamp.asc()).all()
return {'keyword': keyword, 'domain': domain, 'period_days': days, 'data_points': len(history),
'rankings': [{'position': r.position, 'url': r.url, 'date': r.timestamp,
'serp_features': json.loads(r.serp_features) if r.serp_features else None}
for r in history
]}
@app.post("/batch-report")
async def generate_batch_report(
keywords: List[str],
competitors: List[str],
credentials: str = Depends(verify_credentials)
):
"""
Generate comprehensive competitive ranking report.
Compares target domain performance against competitors.
"""
# Implementation for batch competitive analysis
# Would integrate with stored data and generate comparative metrics
return {'report_type': 'competitive_analysis', 'keywords_analyzed': len(keywords),
'competitors_tracked': len(competitors), 'generated_at': datetime.utcnow()}
# Health check endpoint
@app.get("/health")
async def health_check():
"""Service health and proxy pool status."""
return {'status': 'healthy', 'proxy_pool_size': len(ipfly_proxies), 'database_connected': True,
'redis_connected': redis_client.ping(), 'celery_workers': celery_app.control.inspect().active() is not None}
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
IPFLY Integration: Ensuring Reliable Rank Tracker API Operation
The effectiveness of a rank tracker API hinges on the quality of its proxy infrastructure. Google’s anti-automation systems specifically target data center IP ranges, commercial VPN exit nodes, and cloud hosting provider IPs. These are easily identified and systematically blocked.
Why Residential Proxies are Crucial for Rank Tracking
The above rank tracker API implementations critically depend on proxy infrastructure quality. Google’s anti-automation systems are specifically tuned to target:
- Data center IP ranges (easily identified and systematically blocked).
- Commercial VPN exit nodes (known ranges with poor reputation).
- Cloud hosting provider IPs (associated with automation and abuse).
IPFLY’s residential proxy infrastructure counters these challenges by:
Real ISP-Assigned Addresses: IPFLY’s 90+ million residential IPs originate from real consumer internet connections across 190+ countries. These addresses appear indistinguishable from legitimate user searches, bypassing IP-based detection mechanisms.
Geographical Precision: Accurate local search results require genuine local presence. IPFLY’s city-level targeting ensures rank tracker API queries capture authentic regional SERPs, not distorted international views.
Unlimited Scale: Enterprise SEO operations track millions of keywords. IPFLY’s unlimited concurrency supports massive query distribution without rate limits or detection triggers.
Production Proxy Configuration
# config.py - IPFLY integration configuration
import os
from typing import List, Dict
class IPFLYConfig:
"""IPFLY residential proxy configuration for rank tracker API."""
BASE_HOST = "proxy.ipfly.com"
@classmethod
def get_rotating_proxy(cls) -> Dict:
"""Get rotating residential proxy configuration."""
return {'host': cls.BASE_HOST, 'port': os.getenv('IPFLY_ROTATING_PORT', '3128'),
'username': os.getenv('IPFLY_USERNAME'), 'password': os.getenv('IPFLY_PASSWORD'),
'type': 'rotating'}
@classmethod
def get_static_proxy(cls, location: str = 'us') -> Dict:
"""Get static residential proxy for specific location."""
return {'host': cls.BASE_HOST, 'port': os.getenv('IPFLY_STATIC_PORT', '3129'),
'username': f"{os.getenv('IPFLY_USERNAME')}-session-{location}",
'password': os.getenv('IPFLY_PASSWORD'), 'type': 'static', 'location': location
}
@classmethod
def get_proxy_pool(cls, size: int = 10) -> List[Dict]:
"""Generate diverse proxy pool for distributed queries."""
pool = []
locations = ['us', 'gb', 'ca', 'au', 'de', 'fr', 'sg', 'jp']
for i in range(size):
location = locations[i % len(locations)]
pool.append(cls.get_static_proxy(location))
return pool
# Usage in rank tracker
from config import IPFLYConfig
# Initialize with rotating proxy for general queries
rotating_proxy = IPFLYConfig.get_rotating_proxy()
tracker = SeleniumRankTracker(proxy_config=rotating_proxy)
# Or use location-specific static proxy for local SERP tracking
us_proxy = IPFLYConfig.get_static_proxy('us')
us_tracker = SeleniumRankTracker(proxy_config=us_proxy)
Advanced Rank Tracker API Features
Modern rank tracker API implementations must capture more than just basic organic results. They need to incorporate SERP feature detection and extraction, competitive intelligence integration, and sophisticated analysis capabilities.
SERP Feature Detection and Extraction
This involves identifying and extracting key SERP features such as featured snippets, People Also Ask sections, local packs, knowledge panels, and more. These features significantly influence user behavior and understanding them can provide valuable insights into SEO performance.
class SERPFeatureExtractor:
"""Extract and categorize Google SERP features."""
FEATURE_SELECTORS = {
'featured_snippet': 'div.xpdopen, div.g .xpdopen',
'people_also_ask': 'div.related-question-pair',
'local_pack': 'div#lclbox, div.dbg0pd',
'knowledge_panel': 'div.knowledge-panel, div#kp-wp-tab-overview',