asean-lottery-check-draw-result avatar
asean-lottery-check-draw-result

Under maintenance

Pricing

$3.00/month + usage

Go to Store
asean-lottery-check-draw-result

asean-lottery-check-draw-result

Under maintenance

Developed by

Zhen Kai

Zhen Kai

Maintained by Community

Returns the latest draw results for a specific lottery provider.

0.0 (0)

Pricing

$3.00/month + usage

0

Total users

1

Monthly users

1

Last modified

11 days ago

ASEAN Lottery Check Draw Result Actor

This Apify actor retrieves the latest draw result for a specific ASEAN lottery company. It supports 12 different game providers across 5 ASEAN countries with provider-specific result formatting.

🎯 What it does

The actor connects to a MySQL database and fetches the most recent draw results for a specified lottery provider, including:

  • Latest draw date
  • Prize winners (first, second, third)
  • Special prize numbers
  • Consolation prize numbers

Results are formatted according to each provider's specific structure.

🌏 Supported Providers

Malaysia (6 providers)

  • MAG - Magnum 4D
  • DMC - Da Ma Cai 4D
  • TOT - Sports Toto 4D
  • CSP - Cashsweep 4D
  • STC - Sandakan 4D
  • S88 - Sabah 88 4D

Singapore (1 provider)

  • SGP - Singapore Pools 4D

Cambodia (3 providers)

  • GDL - GD Lotto 4D
  • LHH - Lucky Hari Hari 4D
  • PDN - Perdana 4D

Vietnam (1 provider)

  • VIE - Vietnam Lottery 4D

Philippines (1 provider)

  • PHL - PCSO 4D Lotto

📥 Input

The actor requires a Provider ID (PID) as input:

{
"pid": "MAG"
}

Input Parameters

  • pid (string, required): Provider ID from the supported list above

📤 Output

The output format varies by provider:

Malaysia, Singapore & Cambodia Providers

{
"success": true,
"data": {
"name": "Magnum",
"draw_date": "20250529",
"result": {
"first_prize": "1234",
"second_prize": "5678",
"third_prize": "9012",
"special": ["3456", "7890", "1234", "5678", "9012", "3456", "7890", "1234", "5678", "9012"],
"consolation": ["2345", "6789", "0123", "4567", "8901", "2345", "6789", "0123", "4567", "8901"]
}
}
}

Vietnam Provider

{
"success": true,
"data": {
"name": "Vietnam Lottery VN4D",
"draw_date": "20250529",
"result": {
"first_prize": "1234",
"second_prize": "5678",
"third_prize": "9012",
"special": "3456",
"consolation": "7890"
}
}
}

Philippines Provider

{
"success": true,
"data": {
"name": "PSCO 4D Lotto",
"draw_date": "20250529",
"result": {
"first_prize": "1234"
}
}
}

⚙️ Configuration

Required Environment Variables

MYSQLHOST=your_database_host
MYSQLUSER=your_database_user
MYSQLPASSWORD=your_database_password
MYSQLDATABASE=your_database_name
MYSQLPORT=3306

Alternative Environment Variables (Fallback)

DB_HOST=your_database_host
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_NAME=your_database_name
DB_PORT=3306

📊 Database Requirements

lottery_companies

  • company_id (INT, PRIMARY KEY)
  • pid (VARCHAR) - Provider ID
  • name (VARCHAR) - Company name

draw_results

  • company_id (INT) - Foreign key to lottery_companies
  • draw_date (DATE) - Date of the draw
  • first_prize (VARCHAR) - First prize number
  • second_prize (VARCHAR) - Second prize number
  • third_prize (VARCHAR) - Third prize number
  • special_numbers (TEXT) - Special prize numbers (comma/pipe separated)
  • consolation_numbers (TEXT) - Consolation prize numbers (comma/pipe separated)

🚀 Usage Examples

Run via Apify Console

  1. Go to the actor page
  2. Click "Start"
  3. Enter input: {"pid": "MAG"}
  4. View results in the Dataset

Run via API

curl -X POST https://api.apify.com/v2/acts/YOUR_ACTOR_ID/runs \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"pid": "MAG"}'

Run via Apify Client (Node.js)

const { ApifyApi } = require('apify-client');
const client = new ApifyApi({
token: 'YOUR_API_TOKEN'
});
const input = { pid: 'MAG' };
const run = await client.actor('YOUR_ACTOR_ID').call(input);
const dataset = await client.dataset(run.defaultDatasetId).listItems();
console.log(dataset.items[0]);

Multiple Providers Example

const providers = ['MAG', 'SGP', 'VIE', 'PHL'];
for (const pid of providers) {
const run = await client.actor('YOUR_ACTOR_ID').call({ pid });
const result = await client.dataset(run.defaultDatasetId).listItems();
console.log(`${pid} latest result:`, result.items[0]);
}

🎲 Result Format Details

Prize Structure Differences

Malaysia/Singapore/Cambodia:

  • 10 special numbers (array)
  • 10 consolation numbers (array)
  • Full prize hierarchy

Vietnam:

  • 1 special number (string)
  • 1 consolation number (string)
  • Simplified structure

Philippines:

  • Only first prize
  • No special or consolation prizes

Number Format

  • All numbers are 4-digit strings
  • Leading zeros preserved (e.g., "0123")
  • Numbers stored as strings to maintain format

🔍 Troubleshooting

Common Issues

Invalid PID Error

{
"success": false,
"message": "No lottery company found with pid XYZ"
}
  • Check if PID is in the supported list
  • Verify PID spelling and case sensitivity

No Results Found

{
"success": true,
"message": "No draw results found for this lottery company",
"data": {
"name": "Company Name",
"result": {}
}
}
  • Check if draw_results table has data
  • Verify company_id relationships
  • Check date ranges in database

Database Connection Issues

  • Verify database credentials
  • Check network connectivity
  • Ensure database accepts external connections

📅 Draw Frequencies

Different providers have different draw schedules:

  • Malaysia/Singapore: 3 times per week
  • Cambodia: Daily draws
  • Vietnam: Daily draws
  • Philippines: 3 times per week

The actor always returns the most recent available result.

🔒 Security Considerations

  • Use read-only database user
  • Secure database credentials
  • Enable SSL/TLS connections
  • Monitor for unusual access patterns

📈 Performance Tips

  • Results are typically cached for a few hours
  • Consider implementing caching layer for high-frequency access
  • Monitor database query performance
  • Use connection pooling for production

📞 Support

Common issues and solutions:

  1. Wrong PID: Use exact PID from supported list
  2. No recent results: Check database for recent draws
  3. Format issues: Verify database schema matches requirements

📄 License

This actor is provided for lottery data retrieval purposes.