Solved

How to extract substring from html code

  • 10 January 2023
  • 3 replies
  • 29 views

Badge +7

Hi ,

 

I have this attribute extracted from an url ressource:

<div class="bs-contact__image bs-fixed-size bs-asset--landscape" id="SP-MzI5ODA4MzUx"><div class="bs-fixed-size__raiser" style="padding-top:66.5625%;"><div class="[ js-bs-lazy-image-loading ] [ bs-fixed-size__content ]" data-noscript=""><noscript><div class="bs-contact__picture bs-fixed-size__content"><img alt="Foto:  / Rothe" class="bs-contact__picture__image" src="/leben/schule_bildung/schulportal/schulen/schulen/Abendgymnasium.JPG.scaled/7c140d3a1b0bf9ced7d5c55d4b3864ba.jpg"/></div></noscript></div></div><figcaption class="bs-asset__caption"><span class="bs-asset__caption__copyright">© Foto: / Rothe</span></figcaption></div> <div class="bs-contact__content"> <header class="bs-contact__header"> <h3 class="bs-contact__headline"> Abendgymnasium </h3> </header> <div class="bs-contact__section bs-contact__section--reach"> <div class="bs-contact__sub-section bs-contact__sub-section--main"> <div class="bs-contact__part--main-address"> <h4 class="bs-headline--offset [ bs-contact__sub-section-headline ]"> Anschrift </h4> <div class="bs-paragraph bs-paragraph--condensed"> <p> <a href="http://www.home.de/plan/?mapsight-link=f562a246dc424bbd85b980f2be41d3bd" rel="external" target="_blank" title=""> Straße 57 </a> <br/> 38124 Braunschweig <br/> </p> </div> </div> </div> <div class="bs-contact__sub-section bs-contact__sub-section--contact"> <h4 class="bs-headline--offset [ bs-contact__sub-section-headline ]"> Kontakt </h4> <div class="[ bs-paragraph bs-paragraph--condensed ]"><p> <span class="bs-contact__contact__line bs-contact__contact__line--phone"> <span class="bs-contact__contact__label bs-contact__contact__label--phone"> Tel.: </span> <a href="tel:+49-000"><span>000</span></a> </span><br/> <span class="bs-contact__contact__line bs-contact__contact__line--phone"> <span class="bs-contact__contact__label bs-contact__contact__label--phone"> Fax: </span> <span><span>000</span></span> </span><br/> <span class="bs-contact__contact__line bs-contact__contact__line--email"> <span class="visuallyhidden [ bs-contact__contact__label bs-contact__contact__label--email ]"> E-Mail-Adresse: </span> <a data-sp-email="" href="mailto:agy.%E2%9A%B9bsk-agy%E2%97%A6de"><span>agy.@bsk-agy.de</span></a> </span><br/> <span class="bs-contact__contact__line bs-contact__contact__line--website"> <span class="visuallyhidden [ bs-contact__contact__label bs-contact__contact__label--website ]"> Website: </span> <a class="bs-link" href="http://www.abendgymnasium.de/" rel="noopener" target="_blank"><span class="bs-link__text">http://www.abendgymnasium.de/<span class="visuallyhidden"> (Öffnet in einem neuen Tab)</span></span></a> </span><br/> </p></div> </div> </div> <div class="bs-contact__section bs-contact__section--opening-hours"> <h4 class="bs-headline--offset [ bs-contact__section-headline ]"> Öffnungszeiten </h4> <div class="[ bs-paragraph bs-paragraph--condensed ]"> <p>Mo bis Fr 14:00 - 19:00 Uhr</p> </div> </div> </div>

I wanna extract this part:  <p>Mo bis Fr 14:00 - 19:00 Uhr</p>

With html extractor it is not working for me. So is it possible to use a regular expression?

 

icon

Best answer by ebygomm 10 January 2023, 10:52

View original

3 replies

Userlevel 1
Badge +21

I think this CSS Selector should work in the HTMLExtractor

div.bs-contact__section--opening-hours p

Get p element in div with class bs-contact__section--opening-hours

Badge +7

this is working thanks a lot :)

 

Badge +7

@ebygomm​  do you have a hint for me how to get the postalcode and city (38124 Braunschweig)?

it is inside an div element but after an anchor element... I have been trying for a while but it doesn´t work...

 

<div class="bs-contact__section bs-contact__section--reach"> <div class="bs-contact__sub-section bs-contact__sub-section--main"> <div class="bs-contact__part--main-address"> <h4 class="bs-headline--offset [ bs-contact__sub-section-headline ]"> Anschrift </h4> <div class="bs-paragraph bs-paragraph--condensed"> <p> <a href="http://www.home.de/plan/?mapsight-link=f562a246dc424bbd85b980f2be41d3bd" rel="external" target="_blank" title=""> Straße 57 </a> <br/> 38124 Braunschweig <br/> </p> </div> </div> </div>

 

Reply