Extract and display information from Wikipedia articles using the Wikipedia API and web scraping. Search topics, get summaries, full content, infoboxes, and images.
- Search Wikipedia topics
- Get article summaries
- Extract full article content
- Parse infobox data
- Get article images
- Handle disambiguation pages
- Related links extraction
- References listing
- Clean CLI interface
- Language: Python
- Libraries:
wikipedia==1.4.0(Wikipedia API)beautifulsoup4==4.12.2(HTML parsing)requests==2.31.0(HTTP requests)
- Complexity: Intermediate
pip install -r requirements.txt
python main.py- Search Wikipedia for topics
- Returns top 5 results
- Handles typos and suggestions
- Get concise summary (3 sentences)
- Quick overview of topic
- Handles disambiguation
- Complete article content
- Related links (first 20)
- References (first 10)
- Article URL
- Structured data extraction
- Key facts and figures
- Formatted display
- List all images from article
- Direct image URLs
- First 10 images shown
1. Search topics → Find articles
2. Get article summary → Quick info
3. Get full article → Complete content
4. Get infobox data → Key facts
5. Get article images → Visual content
6. Exit → Close program
Enter search query: Python programming
SEARCH RESULTS
1. Python (programming language)
2. History of Python
3. Python Software Foundation
4. CPython
5. Python syntax
Enter topic name: Python (programming language)
PYTHON (PROGRAMMING LANGUAGE)
Python is a high-level, interpreted programming language.
It was created by Guido van Rossum and first released in 1991.
Python emphasizes code readability with significant indentation.
PYTHON (PROGRAMMING LANGUAGE) - QUICK FACTS
Designer:
Guido van Rossum
First appeared:
1991
Stable release:
3.12.0
Typing discipline:
Duck, dynamic, strong
License:
Python Software Foundation License
- Wikipedia API usage
- Web scraping with BeautifulSoup
- HTML parsing
- Data extraction
- Error handling
- CLI application design
- API integration
- Research: Quick information gathering
- Education: Learning tool
- Content Creation: Fact checking
- Data Collection: Wikipedia data extraction
- Reference: Quick lookups
- ✅ Fast and reliable
- ✅ Structured data
- ✅ No rate limiting issues
- ✅ Easy to use
- ✅ Access to infobox data
- ✅ Custom data extraction
⚠️ May break if HTML changes
⚠️ 'Python' is ambiguous. Did you mean:
1. Python (programming language)
2. Python (genus)
3. Pythonidae
❌ Page 'XYZ123' does not exist.
- Save articles to file
- Export to PDF
- Multiple language support
- Category browsing
- Random article feature
- Article comparison
- Citation extraction
- Table data extraction
- Image downloading
- Batch processing
- GUI version
- Use specific topic names
- Check disambiguation options
- Use quotes for exact matches
- Try different search terms
- Explore related links
- Requires internet connection
- Wikipedia API rate limits
- Some data may be incomplete
- Infobox format varies
- Large articles truncated in display
summary = scraper.get_summary(topic, sentences=5)results = scraper.search_topic(query, results=10)wikipedia.set_lang("es") # Spanish
wikipedia.set_lang("fr") # FrenchOpen source for educational purposes.