
asean-lottery-check-number-history
Under maintenance
Pricing
$2.00 / 1,000 results

asean-lottery-check-number-history
Under maintenance
Returns the historical results for a specific number with a particular lottery provider. This endpoint is only available for Malaysian and Singaporean providers, with records dating back to the year 2000.
0.0 (0)
Pricing
$2.00 / 1,000 results
0
Total users
1
Monthly users
1
Last modified
11 days ago
ASEAN Lottery Check Number History Actor
This Apify actor retrieves the complete historical record of a specific 4D number for Malaysia and Singapore lottery providers. It tracks when and how often a number has appeared in draws since the year 2000.
π― What it does
The actor connects to a MySQL database and fetches the complete history of a specific 4D number, including:
- All dates when the number appeared
- Prize type for each occurrence (first, second, third, special, consolation)
- Complete chronological history since 2000
Note: This feature is only available for Malaysia and Singapore providers.
π 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
β Not Supported
- Cambodia providers (GDL, LHH, PDN)
- Vietnam provider (VIE)
- Philippines provider (PHL)
π₯ Input
The actor requires both a Provider ID (PID) and a 4-digit number:
{"pid": "MAG","number": "1234"}
Input Parameters
- pid (string, required): Provider ID from Malaysia/Singapore only
- number (string, required): 4-digit lottery number (e.g., "1234", "0001")
Input Validation
- PID: Must be from Malaysia or Singapore providers
- Number: Must be exactly 4 digits
- Format: Numbers with leading zeros supported (e.g., "0123")
π€ Output
The actor returns the complete history of the specified number:
{"success": true,"data": {"name": "Magnum","number": "1234","result": [{"draw_date": "20250520","prize": "first"},{"draw_date": "20241104","prize": "special"},{"draw_date": "20230815","prize": "consolation"},{"draw_date": "20200125","prize": "second"}]}}
Output Fields
- success (boolean): Operation success status
- data (object): Number history data
- name (string): Lottery company name
- number (string): The queried 4D number
- result (array): Array of historical occurrences
- draw_date (string): Date in YYYYMMDD format
- prize (string): Prize type - "first", "second", "third", "special", "consolation"
Prize Types
- first - First prize winner
- second - Second prize winner
- third - Third prize winner
- special - Special prize winner
- consolation - Consolation prize winner
βοΈ 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
number_history
company_id
(INT) - Foreign key to lottery_companiesnumber
(VARCHAR) - 4-digit lottery numberdraw_date
(DATE) - Date when number appearedprize_type
(VARCHAR) - Type of prize won
π Usage Examples
Run via Apify Console
- Go to the actor page
- Click "Start"
- Enter input:
{"pid": "MAG", "number": "1234"}
- 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", "number": "1234"}'
Run via Apify Client (Node.js)
const { ApifyApi } = require('apify-client');const client = new ApifyApi({token: 'YOUR_API_TOKEN'});const input = {pid: 'MAG',number: '1234'};const run = await client.actor('YOUR_ACTOR_ID').call(input);const dataset = await client.dataset(run.defaultDatasetId).listItems();console.log(dataset.items[0]);
Number Analysis Example
// Analyze multiple numbers for frequencyconst numbers = ['1234', '5678', '9999', '0001'];const results = {};for (const number of numbers) {const run = await client.actor('YOUR_ACTOR_ID').call({pid: 'MAG',number: number});const dataset = await client.dataset(run.defaultDatasetId).listItems();if (dataset.items[0]?.data?.result) {results[number] = {total_appearances: dataset.items[0].data.result.length,last_appearance: dataset.items[0].data.result[0]?.draw_date,prize_breakdown: {}};// Count prize typesdataset.items[0].data.result.forEach(entry => {const prize = entry.prize;results[number].prize_breakdown[prize] =(results[number].prize_breakdown[prize] || 0) + 1;});}}console.log('Number analysis:', results);
Lucky Number Checker
// Check if a number appeared in the last yearconst checkRecentAppearances = async (pid, number) => {const run = await client.actor('YOUR_ACTOR_ID').call({ pid, number });const dataset = await client.dataset(run.defaultDatasetId).listItems();if (!dataset.items[0]?.data?.result) return [];const oneYearAgo = new Date();oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);const cutoffDate = oneYearAgo.toISOString().slice(0, 10).replace(/-/g, '');return dataset.items[0].data.result.filter(entry =>entry.draw_date >= cutoffDate);};// Usageconst recentAppearances = await checkRecentAppearances('MAG', '1234');console.log(`Number 1234 appeared ${recentAppearances.length} times in the last year`);
π Statistical Analysis
Frequency Analysis
// Calculate number frequency and patternsconst analyzeNumberHistory = (historyData) => {const results = historyData.data.result;const analysis = {total_appearances: results.length,first_appearance: results[results.length - 1]?.draw_date,last_appearance: results[0]?.draw_date,prize_distribution: {},yearly_frequency: {},average_gap_days: 0};// Prize distributionresults.forEach(entry => {const prize = entry.prize;analysis.prize_distribution[prize] =(analysis.prize_distribution[prize] || 0) + 1;});// Yearly frequencyresults.forEach(entry => {const year = entry.draw_date.substring(0, 4);analysis.yearly_frequency[year] =(analysis.yearly_frequency[year] || 0) + 1;});// Calculate average gap between appearancesif (results.length > 1) {let totalGap = 0;for (let i = 0; i < results.length - 1; i++) {const date1 = new Date(results[i].draw_date.substring(0, 4),parseInt(results[i].draw_date.substring(4, 6)) - 1,results[i].draw_date.substring(6, 8));const date2 = new Date(results[i + 1].draw_date.substring(0, 4),parseInt(results[i + 1].draw_date.substring(4, 6)) - 1,results[i + 1].draw_date.substring(6, 8));totalGap += Math.abs(date1 - date2) / (1000 * 60 * 60 * 24);}analysis.average_gap_days = Math.round(totalGap / (results.length - 1));}return analysis;};
π Troubleshooting
Common Errors
Unsupported Provider
{"success": false,"message": "This endpoint is only available for Malaysia and Singapore game providers."}
- Only use PIDs: MAG, DMC, TOT, CSP, STC, S88, SGP
- Cambodia, Vietnam, Philippines not supported
Invalid Number Format
{"success": false,"message": "Invalid number format. Number must be exactly 4 digits."}
- Use exactly 4 digits
- Include leading zeros if needed (e.g., "0123")
- Numbers must be numeric only
Invalid PID
{"success": false,"message": "No lottery company found with pid XYZ"}
- Check PID spelling and case
- Use only supported Malaysia/Singapore PIDs
Empty History
{"success": true,"data": {"name": "Magnum","number": "1234","result": []}}
- Number has never appeared in draws
- Check if number is valid
- Try different numbers
π Use Cases
Personal Number Tracking
- Track your favorite numbers
- Check winning history
- Analyze patterns
Statistical Research
- Number frequency analysis
- Prize distribution studies
- Pattern recognition
Lucky Number Selection
- Find numbers with recent wins
- Avoid overdue numbers
- Historical performance analysis
Verification
- Verify old ticket claims
- Check historical results
- Confirm number appearances
π― Popular Numbers
Some commonly tracked numbers include:
- Birth dates (e.g., "0315" for March 15)
- Lucky numbers (e.g., "8888", "9999")
- Sequential numbers (e.g., "1234", "5678")
- Repeated digits (e.g., "1111", "2222")
π Data Insights
Historical Coverage
- Start Date: Records from year 2000
- Coverage: Complete draw history
- Updates: Real-time with new draws
- Accuracy: Direct from official sources
Prize Frequency Patterns
- First Prize: Rarest occurrences
- Special: More frequent than top 3 prizes
- Consolation: Most frequent category
- Distribution: Varies by provider and number
π Security Considerations
- Use read-only database access
- Secure credential storage
- Monitor for excessive queries
- Rate limiting for fair usage
π Performance Tips
- Results are cached for better performance
- Large histories may take longer to process
- Consider pagination for very active numbers
- Optimize queries for frequently checked numbers
π¨ Fair Usage
Please use responsibly:
- Avoid excessive automated queries
- Don't overload the system
- Consider implementing local caching
- Respect rate limits
π Support
Common issues and solutions:
- Wrong provider: Use only Malaysia/Singapore PIDs
- Invalid number: Use exactly 4 digits
- Empty results: Number may never have appeared
- Slow response: Large histories take time to process
π Sample Output Interpretation
{"success": true,"data": {"name": "Magnum","number": "1234","result": [{"draw_date": "20250315", "prize": "first"},{"draw_date": "20240820", "prize": "special"},{"draw_date": "20230505", "prize": "consolation"}]}}
Interpretation:
- Number "1234" has appeared 3 times in Magnum
- Most recent: March 15, 2025 (First Prize)
- Previous: August 20, 2024 (Special Prize)
- Earlier: May 5, 2023 (Consolation Prize)
- Results are sorted by date (newest first)
π License
This actor is provided for number history tracking and analysis purposes.