News
The View News API provides comprehensive access to detailed news articles from BPS (Badan Pusat Statistik) Indonesia. This method enables applications to retrieve complete news content, including full text, multimedia content, category classifications, and publication metadata for news analysis, content management, and information dissemination purposes.
News articles from BPS serve as primary communication channels for statistical insights, data releases, policy announcements, and analytical commentary. The View News API ensures access to complete news content with rich formatting, enabling applications to provide users with comprehensive statistical communication and timely information updates.
Understanding the BPS News System
BPS news articles provide strategic communication and information dissemination:
- Official Communication: Primary channel for statistical announcements, data releases, and policy communications
- Contextual Analysis: Expert interpretation and analysis of statistical data and trends
- Multi-format Content: Rich text content with images, charts, and multimedia elements
- Category Organization: Structured classification system for efficient content discovery and navigation
- Temporal Relevance: Timely publication aligned with statistical release cycles and important events
News Content Categories
Statistical Data Releases
- Economic Releases: GDP announcements, inflation reports, trade statistics, and economic indicators
- Social Statistics: Population updates, education statistics, health indicators, and welfare reports
- Demographic News: Census results, population projections, and demographic trend analysis
- Regional Statistics: Province and local-level statistical releases and comparative analysis
Analytical Commentary
- Trend Analysis: Expert interpretation of statistical patterns and developments
- Policy Impact: Analysis of policy effects on statistical indicators and societal outcomes
- Comparative Studies: Inter-regional and temporal comparisons of statistical data
- Methodological Updates: Explanations of new statistical methods and data collection techniques
Institutional News
- BPS Activities: Agency updates, conferences, training programs, and institutional developments
- International Cooperation: Collaboration announcements, technical assistance, and global initiatives
- Technology Updates: Digital transformation, system upgrades, and innovation announcements
- Public Engagement: Community outreach, educational programs, and stakeholder communications
Parameters
| Parameter | Type | Description |
|---|---|---|
id | int | Required: The unique numerical identifier of the specific news article |
domain | String | Required: The domain (region) code specifying administrative context |
lang | DataLanguage | Optional: Language preference for localized content (default: DataLanguage.id) |
Examples
1. Basic News Retrieval

// Retrieve detailed information for a specific news article
final news = await StadataFlutter.instance.view.news(
id: 12345, // Example: Economic news article ID
domain: '0000', // National level
lang: DataLanguage.id,
);
if (news != null) {
print('=== News Article Details ===');
print('Article ID: ${news.id}');
print('Title: ${news.title}');
print('Category: ${news.category ?? 'General'}');
print('Category ID: ${news.categoryId}');
// Publication information
print('\n=== Publication Information ===');
print('Release Date: ${news.releaseDate}');
print('Has Image: ${news.picture.isNotEmpty ? 'Yes' : 'No'}');
if (news.picture.isNotEmpty) {
print('Image URL: ${news.picture}');
}
// Content preview
print('\n=== Content Preview ===');
final contentPreview = news.content.length > 300
? '${news.content.substring(0, 300)}...'
: news.content;
print('Content: $contentPreview');
// Content analysis
print('\n=== Content Analysis ===');
print('Content Length: ${news.content.length} characters');
print('Word Count: ${news.content.split(' ').length} words');
// Check for statistical keywords
final contentLower = news.content.toLowerCase();
final statisticalKeywords = <String>[];
if (contentLower.contains('inflasi') || contentLower.contains('inflation')) {
statisticalKeywords.add('Inflation');
}
if (contentLower.contains('pdb') || contentLower.contains('gdp')) {
statisticalKeywords.add('GDP');
}
if (contentLower.contains('penduduk') || contentLower.contains('population')) {
statisticalKeywords.add('Population');
}
if (contentLower.contains('ekonomi') || contentLower.contains('economic')) {
statisticalKeywords.add('Economic');
}
if (statisticalKeywords.isNotEmpty) {
print('Statistical Topics: ${statisticalKeywords.join(', ')}');
}
} else {
print('News article not found or not accessible');
}
2. News Content Analysis Workflow
// Comprehensive news content analysis and categorization
class NewsContentAnalyzer {
static Future<void> analyzeNewsContent(
String domain,
String analysisTheme,
) async {
try {
// 1. Discover news articles using List API
final newsList = await StadataFlutter.instance.list.news(
domain: domain,
keyword: analysisTheme,
lang: DataLanguage.id,
);
print('=== News Content Analysis: "$analysisTheme" ===');
print('Found ${newsList.data.length} news articles');
if (newsList.data.isEmpty) {
print('No news articles found for theme: $analysisTheme');
return;
}
// 2. Analyze each article in detail
final contentAnalysis = <Map<String, dynamic>>[];
for (final newsSummary in newsList.data.take(10)) {
print('\n--- Analyzing: ${newsSummary.title} ---');
final detailedNews = await StadataFlutter.instance.view.news(
id: newsSummary.id,
domain: domain,
lang: DataLanguage.id,
);
if (detailedNews != null) {
final analysis = _analyzeNewsContent(detailedNews);
contentAnalysis.add({
'id': detailedNews.id,
'title': detailedNews.title,
'category': detailedNews.category,
'categoryId': detailedNews.categoryId,
'releaseDate': detailedNews.releaseDate,
'hasImage': detailedNews.picture.isNotEmpty,
'contentLength': detailedNews.content.length,
'wordCount': detailedNews.content.split(' ').length,
'analysis': analysis,
});
// Display key findings
print('Category: ${detailedNews.category ?? 'Uncategorized'}');
print('Release Date: ${detailedNews.releaseDate}');
print('Content Length: ${detailedNews.content.length} characters');
print('Has Image: ${detailedNews.picture.isNotEmpty ? 'Yes' : 'No'}');
print('Statistical Topics: ${analysis['topics'].join(', ')}');
print('Sentiment: ${analysis['sentiment']}');
print('Reading Level: ${analysis['readingLevel']}');
} else {
print('Failed to retrieve detailed information');
}
// Rate limiting
await Future.delayed(Duration(milliseconds: 500));
}
// 3. Analysis summary
print('\n=== Content Analysis Summary ===');
print('Total Articles Analyzed: ${contentAnalysis.length}');
// Category distribution
final categoryDistribution = <String?, int>{};
for (final article in contentAnalysis) {
final category = article['category'] as String?;
categoryDistribution[category] = (categoryDistribution[category] ?? 0) + 1;
}
print('\nCategory Distribution:');
for (final entry in categoryDistribution.entries) {
final category = entry.key ?? 'Uncategorized';
print(' $category: ${entry.value} articles');
}
// Content metrics
final avgContentLength = contentAnalysis.isNotEmpty
? contentAnalysis.map((a) => a['contentLength'] as int).reduce((a, b) => a + b) / contentAnalysis.length
: 0.0;
final avgWordCount = contentAnalysis.isNotEmpty
? contentAnalysis.map((a) => a['wordCount'] as int).reduce((a, b) => a + b) / contentAnalysis.length
: 0.0;
final withImages = contentAnalysis.where((a) => a['hasImage'] as bool).length;
print('\nContent Metrics:');
print('Average Content Length: ${avgContentLength.round()} characters');
print('Average Word Count: ${avgWordCount.round()} words');
print('Articles with Images: $withImages/${contentAnalysis.length}');
// Topic analysis
final allTopics = <String, int>{};
for (final article in contentAnalysis) {
final topics = article['analysis']['topics'] as List<String>;
for (final topic in topics) {
allTopics[topic] = (allTopics[topic] ?? 0) + 1;
}
}
final sortedTopics = allTopics.entries.toList()
..sort((a, b) => b.value.compareTo(a.value));
print('\nMost Common Topics:');
for (final entry in sortedTopics.take(5)) {
print(' ${entry.key}: ${entry.value} articles');
}
// Temporal analysis
final currentDate = DateTime.now();
final recentArticles = contentAnalysis.where((a) =>
(a['releaseDate'] as DateTime).isAfter(currentDate.subtract(Duration(days: 30)))
).length;
print('\nTemporal Analysis:');
print('Recent Articles (last 30 days): $recentArticles');
} catch (e) {
print('Content analysis error: $e');
}
}
static Map<String, dynamic> _analyzeNewsContent(News news) {
final content = news.content.toLowerCase();
final analysis = <String, dynamic>{};
// Topic detection
final topics = <String>[];
if (content.contains('inflasi') || content.contains('harga')) topics.add('Inflation');
if (content.contains('pdb') || content.contains('ekonomi')) topics.add('Economy');
if (content.contains('penduduk') || content.contains('demografi')) topics.add('Demographics');
if (content.contains('perdagangan') || content.contains('ekspor')) topics.add('Trade');
if (content.contains('kemiskinan') || content.contains('kesejahteraan')) topics.add('Welfare');
if (content.contains('pendidikan') || content.contains('sekolah')) topics.add('Education');
if (content.contains('kesehatan') || content.contains('medis')) topics.add('Health');
if (content.contains('teknologi') || content.contains('digital')) topics.add('Technology');
analysis['topics'] = topics.isNotEmpty ? topics : ['General'];
// Simple sentiment analysis
final positiveWords = ['meningkat', 'tumbuh', 'positif', 'baik', 'sukses', 'berhasil'];
final negativeWords = ['menurun', 'turun', 'negatif', 'buruk', 'gagal', 'masalah'];
final positiveCount = positiveWords.where((word) => content.contains(word)).length;
final negativeCount = negativeWords.where((word) => content.contains(word)).length;
if (positiveCount > negativeCount) {
analysis['sentiment'] = 'Positive';
} else if (negativeCount > positiveCount) {
analysis['sentiment'] = 'Negative';
} else {
analysis['sentiment'] = 'Neutral';
}
// Reading level assessment
final sentences = news.content.split(RegExp(r'[.!?]')).length;
final words = news.content.split(' ').length;
final avgWordsPerSentence = sentences > 0 ? words / sentences : 0;
if (avgWordsPerSentence < 15) {
analysis['readingLevel'] = 'Simple';
} else if (avgWordsPerSentence < 25) {
analysis['readingLevel'] = 'Moderate';
} else {
analysis['readingLevel'] = 'Complex';
}
return analysis;
}
}