
asean-lottery-check-past-draw-result
Under maintenance
Pricing
$3.00/month + usage

asean-lottery-check-past-draw-result
Under maintenance
Returns the draw results for a specific lottery provider on a specific date.
0.0 (0)
Pricing
$3.00/month + usage
0
Total users
1
Monthly users
1
Last modified
11 days ago
ASEAN Lottery Check Past Draw Result Actor
This Apify actor retrieves historical draw results for a specific ASEAN lottery company and date. It supports querying results from the last 30 days across 12 different game providers from 5 ASEAN countries.
🎯 What it does
The actor connects to a MySQL database and fetches historical draw results for a specified lottery provider and date, including:
- Draw results for the specified date
- Prize winners (first, second, third)
- Special prize numbers
- Consolation prize numbers
Results are formatted according to each provider's specific structure, with a 30-day lookback limit.
🌏 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 both a Provider ID (PID) and date:
{"pid": "MAG","date": "20250520"}
Input Parameters
- pid (string, required): Provider ID from the supported list
- date (string, required): Draw date in YYYYMMDD format (within last 30 days)
Date Restrictions
- Format: YYYYMMDD (e.g., "20250520")
- Range: Only last 30 days from current date
- Validation: Invalid dates or dates older than 30 days will return an error
📤 Output
The output format is identical to the current draw result, but for the specified historical date:
Malaysia, Singapore & Cambodia Providers
{"success": true,"data": {"name": "Magnum","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","result": {"first_prize": "1234","second_prize": "5678","third_prize": "9012","special": "3456","consolation": "7890"}}}
Philippines Provider
{"success": true,"data": {"name": "PSCO 4D Lotto","result": {"first_prize": "1234"}}}
No Results Found
{"success": true,"message": "No records found on the specific date"}
⚙️ Configuration
Required Environment Variables
MYSQLHOST=your_database_hostMYSQLUSER=your_database_userMYSQLPASSWORD=your_database_passwordMYSQLDATABASE=your_database_nameMYSQLPORT=3306
Alternative Environment Variables (Fallback)
DB_HOST=your_database_hostDB_USER=your_database_userDB_PASSWORD=your_database_passwordDB_NAME=your_database_nameDB_PORT=3306
📊 Database Requirements
lottery_companies
company_id
(INT, PRIMARY KEY)pid
(VARCHAR) - Provider IDname
(VARCHAR) - Company name
draw_results
company_id
(INT) - Foreign key to lottery_companiesdraw_date
(DATE) - Date of the drawfirst_prize
(VARCHAR) - First prize numbersecond_prize
(VARCHAR) - Second prize numberthird_prize
(VARCHAR) - Third prize numberspecial_numbers
(TEXT) - Special prize numbers (comma/pipe separated)consolation_numbers
(TEXT) - Consolation prize numbers (comma/pipe separated)
🚀 Usage Examples
Run via Apify Console
- Go to the actor page
- Click "Start"
- Enter input:
{"pid": "MAG", "date": "20250520"}
- 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", "date": "20250520"}'
Run via Apify Client (Node.js)
const { ApifyApi } = require('apify-client');const client = new ApifyApi({token: 'YOUR_API_TOKEN'});const input = {pid: 'MAG',date: '20250520'};const run = await client.actor('YOUR_ACTOR_ID').call(input);const dataset = await client.dataset(run.defaultDatasetId).listItems();console.log(dataset.items[0]);
Historical Analysis Example
// Get last 7 days of results for Magnumconst dates = [];for (let i = 0; i < 7; i++) {const date = new Date();date.setDate(date.getDate() - i);dates.push(date.toISOString().slice(0, 10).replace(/-/g, ''));}const results = [];for (const date of dates) {const run = await client.actor('YOUR_ACTOR_ID').call({pid: 'MAG',date: date});const dataset = await client.dataset(run.defaultDatasetId).listItems();if (dataset.items[0]?.data?.result) {results.push({date: date,result: dataset.items[0].data.result});}}console.log('Last 7 days results:', results);
📅 Date Handling
Supported Date Formats
- Input: YYYYMMDD (e.g., "20250520")
- Database: Various formats supported automatically
- Validation: Automatic date format validation
Date Restrictions
- 30-Day Limit: Only results from the last 30 days
- Current Date: Cannot query future dates
- Weekend/Holiday: Results depend on provider's draw schedule
Provider-Specific Draw Days
Malaysia/Singapore:
- Wednesday, Saturday, Sunday
- Some providers have Tuesday special draws
Cambodia:
- Daily draws for all providers
Vietnam:
- Daily draws
Philippines:
- Monday, Wednesday, Friday
🔍 Troubleshooting
Common Errors
Invalid Date Format
{"success": false,"message": "Invalid date format. Use YYYYMMDD format."}
- Use exact format: YYYYMMDD
- No separators (-, /, etc.)
Date Too Old
{"success": false,"message": "Only results from the last 30 days are available"}
- Choose a date within the last 30 days
- Check current date and calculate backwards
Invalid PID
{"success": false,"message": "No lottery company found with pid XYZ"}
- Use exact PID from supported list
- Check spelling and case sensitivity
No Draw on Date
{"success": true,"message": "No records found on the specific date"}
- Check if the provider has draws on that day
- Verify date is within provider's draw schedule
📊 Use Cases
Historical Analysis
- Track number patterns over time
- Analyze prize distributions
- Compare provider performance
Verification
- Verify old lottery tickets
- Check historical results
- Confirm past draws
Research
- Statistical analysis of draws
- Pattern recognition
- Frequency analysis
🔒 Security Considerations
- Use read-only database user
- Secure database credentials
- Enable SSL/TLS connections
- Monitor query patterns for abuse
📈 Performance Tips
- Results are typically cached
- Batch requests for multiple dates
- Use connection pooling
- Monitor database performance
🚨 Rate Limiting
Consider implementing rate limiting for:
- Multiple date queries
- High-frequency access
- Bulk historical data retrieval
📞 Support
Common issues:
- Wrong date format: Use YYYYMMDD
- Date too old: Stay within 30-day limit
- No results: Check provider's draw schedule
- Invalid PID: Use supported provider IDs
📄 License
This actor is provided for historical lottery data retrieval purposes.