German folk songs archive from volksliederarchiv.de

πŸ“Š Stats

MetricValue
🎢 Songs11,594
πŸ‘€ With author9,131 (79%)
πŸ“… With year10,880 (94%)
πŸ“ Categories835
πŸ’Ύ Clean output55 MB
πŸ—„οΈ Raw HTML2.9 GB

πŸ“ Directory Structure

/home/dv/scrapez/volkslieder/
β”œβ”€β”€ clean/              # ✨ Cleaned markdown (V2)
β”‚   β”œβ”€β”€ kinderlieder/   # 609 songs
β”‚   β”œβ”€β”€ soldatenlieder/ # 1,140 songs
β”‚   β”œβ”€β”€ liebeslieder/   # 859 songs
β”‚   β”œβ”€β”€ geistliche-lieder/ # 639 songs
β”‚   └── ... (835 categories)
β”œβ”€β”€ output/             # πŸ“„ Original conversion
β”œβ”€β”€ raw_html/           # πŸ—„οΈ Original HTML (2.9 GB)
β”œβ”€β”€ scripts/            # πŸ”§ Pipeline scripts
β”œβ”€β”€ index.json          # πŸ” Search index
β”œβ”€β”€ authors.json        # πŸ‘€ Top 100 authors
β”œβ”€β”€ categories.json     # πŸ“ Category counts
β”œβ”€β”€ years.json          # πŸ“… Decade distribution
└── volkslieder-complete.md  # πŸ“š Consolidated

πŸ”§ Scripts

ScriptPurpose
collect_urls.pyParse sitemaps β†’ urls.json
scrape_pages.pyAsync HTTP fetch with retries
convert_to_md.pyHTML β†’ Markdown (parallel)
cleanup_v2.pyπŸ†• Extract metadata, clean links
generate_index.pyπŸ†• Build JSON search index
fix_links.pyURL β†’ local path
consolidate.pySingle file + TOC

πŸš€ Quick Commands

# Activate environment
source /home/dv/scrapez/.venv/bin/activate
cd /home/dv/scrapez/volkslieder/scripts
 
# Full pipeline
./run_scrape.sh
 
# Individual steps
python collect_urls.py     # πŸ“‹ ~12K URLs from sitemaps
python scrape_pages.py     # πŸ•·οΈ Async download (~1h)
python convert_to_md.py    # πŸ“„ HTML β†’ MD (parallel)
python cleanup_v2.py       # ✨ Enhanced cleanup
python generate_index.py   # πŸ” Build search index

πŸ“ Markdown Format (V2)

---
title: "Song Title"
url: https://www.volksliederarchiv.de/slug/
themes: ["Kinderlieder", "Weihnachtslieder"]
periods: ["19. Jahrhundert"]
text_author: "Hoffmann von Fallersleben"
musik_author: "Volksweise"
year: 1840
---
Song lyrics here...
(lexikon links converted to plain text)

πŸ” Index Files

{
  "title": "Der Mond ist aufgegangen",
  "path": "abendlieder/der-mond-ist-aufgegangen.md",
  "url": "https://...",
  "incipit": "Der Mond ist aufgegangen...",
  "themes": ["Abendlieder", "Geistliche Lieder"],
  "text_author": "Matthias Claudius",
  "musik_author": "Johann Abraham Peter Schulz",
  "year": 1779
}

authors.json - Top 100 Authors

{
  "Verfasser unbekannt": 3877,
  "Hoffmann von Fallersleben": 156,
  "Hermann LΓΆns": 76,
  ...
}

categories.json - All Categories

{
  "Soldatenlieder": 1140,
  "Liebeslieder": 859,
  "Geistliche Lieder": 639,
  "Kinderlieder": 609,
  ...
}

πŸ“Š Top Categories

CategoryCount
πŸͺ– Soldatenlieder1,140
πŸ’• Liebeslieder859
β›ͺ Geistliche Lieder639
πŸ‘Ά Kinderlieder609
🍺 Trinklieder430
🚢 Wanderlieder287
🏠 Heimatlieder281
πŸ’ƒ Tanzlieder280
βš’οΈ Arbeiterlieder271
πŸ“– Balladen253

πŸ‘€ Top Authors

AuthorSongs
Verfasser unbekannt3,877
Hoffmann von Fallersleben156
Hermann LΓΆns76
Ernst Moritz Arndt37
Ludwig Uhland30
Georg Herwegh25
Erich MΓΌhsam23
Wilhelm MΓΌller23
Theodor KΓΆrner23

βš™οΈ Config

Edit /home/dv/scrapez/volkslieder/scripts/config.py:

CONFIG = {
    "base_url": "https://www.volksliederarchiv.de",
    "download_delay": 0.3,      # Rate limiting
    "concurrent_requests": 4,   # Parallel fetches
    "content_selector": "article",
    "remove_selectors": [       # Elements to strip
        "nav", "header", "footer", "aside",
        ".ad-inserter", ".yarpp", ...
    ],
}

πŸ”— Useful Queries

# Find songs by author
grep -l "Hoffmann von Fallersleben" clean/**/*.md
 
# Count songs per category
jq 'to_entries | sort_by(-.value) | .[:20]' categories.json
 
# Search by title
jq '.[] | select(.title | test("Mond"; "i"))' index.json
 
# Songs from specific decade
jq '.[] | select(.year >= 1840 and .year < 1850)' index.json