I'd like to import plaintext found within paragraph blocks nested anywhere inside certain div's. Here's a page to try it on:

Import @ "https://trailhead.salesforce.com/content/learn/modules/european-union-privacy-law-basics/get-to-know-eu-privacy-law?trail_id=learn-privacy-and-data-protection-law"

I'm trying to extract strings text1, text2, etc. from <p> blocks whenever nested inside any <div>'s of class "unit-content":

... <div class="unit-content"> ... <p> text1 </p> ... <p> text2 </p> ... </div> ...

Is there an easier way than using the nasty 'XML' functions?


1 Answer 1


You can use jsoupLink for this:


html = Import[

texts = #["AllText"] & /@ html["Select", ".unit-content p"];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.