Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

java - Trying to scrape webpage using JSOUP. But the selector is returning the wrong src

I'm currently trying to scrape the manga image from this website to see if I can.

URL: http://fanfox.net/manga/tales_of_demons_and_gods/c110.5/1.html

Using Developer Options I can see that the img tag is where the image I want to download.

Image Tag Example

I then used JSOUP to fetch the document, then select all the images with the class tag with the matching class name "reader-main-img".

Connection currentConnection = Jsoup.connect(url);
currentConnection = currentConnection.timeout(100000);
Document downloadedDocument = currentConnection.get();

Elements imageElements = downloadedDocument.select("img.read-main-img");

But when I print the image element toString for it's attributes. Sorry for the stretched size. Essentially it shows that the sources are both loading.gif and not the image file shown above.

Attributes Example

So my confusion was why was the image not displaying. I think it might be something to do with it not loading yet. And since this is happening through http/https requests. I can't access this dynamic data.

Any advice or suggestions are appreciated.

question from:https://stackoverflow.com/questions/65883119/trying-to-scrape-webpage-using-jsoup-but-the-selector-is-returning-the-wrong-sr

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...