How do I extract only the url from this element?

gson

What xpath should i use to extract only the url link from the below element?

<a class="url" rel="noreferrer" onclick="redirect('https://www.fotbollskanalen.se/allsvenskan/kujovic-siktar-pa-startplats-var-naturligt-att-agera-inhoppare---nu-vill-jag-s');">Läs mer på Fotbollskanalen</a>

I have tried using the below xpath, but it only returns "Läs mer på Fotbollskanalen" and not the url itself.

a[1]/child::node()

Also tried different versions attempting to set specify the class but unable to get it right.

adelriosantiago

Try this:

substring-before(substring-after(//a/@onclick, "'"),"'")

It will,

  • substring-before(substring-after(foo, "'"),"'"): Get in everything enclosed by ' in foo.
  • //a: Of the element a.
  • /@onclick: Inside the attribute onclick.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to extract only one allowed element from a stream?

How do I extract value from Json

How do I extract child element from XML to a string in Java?

How do I extract username from string?

How can I extract text content only from root element - java, com.gargoylesoftware.htmlunit.html

How do I extract the type from a field?

how do i extract only 5-digit strings from cells in excel?

How do I extract raw data from plot element in R

How do I extract text from a URL path in R?

How do I extract only the desired files from tar.gz?

How can I extract the id from the url?

How do I extract the underlying HTML dom element from a TestCafe Selector?

How do I extract data from a response to a callback URL?

How do I extract numbers only with regex?

How do I extract the information from the website?

How could I extract an id from a URL?

How do I remove only one element from an array from Redux? Not working for me currently

How do I extract data from a script?

How do I extract the value of a route variable from the URL in a Scala-Play app?

How do I extract an algorithm from these instructions?

How do I extract these values from an object

How do I extract an element from an array in javascript and then make it an entirely new, single-element array?new

How do i extract from a nested dictionary?

How do I extract dataframe from a string?

How do I extract only number from dynamic headline/text?

Pandas: How do I extract only the years from the age data in a column from my dataframe?

Ubuntu: How do I extract only specific columns from tab-delimited file if it contains a specific string?

How to extract class name as string from first element only?

How do i extract the image extension from URL even if some URL has no extension?