Skip to content

Commit

Permalink
Update scraper.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
BfB-Schenefeld committed Apr 22, 2024
1 parent 82408c4 commit dc8efb6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ def scrape_vorlagen_details(vorlagen_url)
document = Nokogiri::HTML(open(vorlagen_url))

# Extrahieren der Vorlagenbezeichnung
vorlagenbezeichnung = document.at_css('#header h1.title')&.text&.strip
vorlagenbezeichnung_element = document.at_css('#header h1.title')
vorlagenbezeichnung = vorlagenbezeichnung_element ? vorlagenbezeichnung_element.text.strip : "Keine Vorlagenbezeichnung gefunden"
puts "Vorlagenbezeichnung: #{vorlagenbezeichnung}"

# Extrahieren des gesamten Texts von mainContent
vorlagenprotokolltext = document.at_css('#mainContent')&.inner_text&.strip
vorlagenprotokolltext_element = document.at_css('#mainContent')
vorlagenprotokolltext = vorlagenprotokolltext_element ? vorlagenprotokolltext_element.inner_text.strip : "Kein Text im Hauptinhalt gefunden"
puts "Vorlagenprotokolltext: #{vorlagenprotokolltext}"
end

Expand All @@ -60,3 +62,4 @@ def scrape_vorlagen_details(vorlagen_url)




0 comments on commit dc8efb6

Please sign in to comment.