0

so i want to store the url of this image

i am searching for this html code:

<link rel="image_src" href="http://ex.com/Data/CLOCK/fb.jpg">

by

Elements el = doc.getElementsByAttribute("rel");
Element link = el.select("image_src").first();

the code above gives all the links in the html document which contains around 30+ links. is there a way to get that specific link above?

Thanks

1
  • It's been 5 years, have you found a solution? Commented Dec 25, 2020 at 16:47

1 Answer 1

1

You can start off with a Document and work with CSS selectors:

String selector = "link[rel=image_src][href=http://ex.com/Data/CLOCK/fb.jpg]";
Element theElement = doc.select(selector).first();
Sign up to request clarification or add additional context in comments.

2 Comments

the problem is that my code prints all the links in the html doc. I need a way to search for only that link above.
Sorry. I reviewed the answer.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.