-1

I am using Jsoup library to read the content inside website using it's link, specifically the data from selected text on this image of site inspection: image I tried with no success,i don't understand which section or classes need to fetch in my code.

import java.io.*;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class ReadingWebPage {

    // Main method
    public static void main(String[] args) {
        try {
            // Here i create a document object and use JSoup to fetch the website
            Document doc = Jsoup.connect("https://efiskalizimi-app.tatime.gov.al/invoice-check/#/verify?iic=458B743C9A4B6252CD895077308A642A&tin=K22305002U&crtd=2023-08-25T08:39:31%2002:00&ord=747371&bu=nd748hb825&cr=qc431mv163&sw=sc782sw243&prc=16711.00")
                                .userAgent("Mozila/117.0")
                                .get();
            System.out.printf("Title: %s\n",doc.title());

            // the list of repositories
            Elements repositories = doc.getElementsByClass("invoice-items");

            for (Element repository : repositories) {
                String repositoryTitle = repository.data();
                String repositoryIssues = repository.getAllElements().text();
                String repositoryDescription = repository.getElementsByClass("invoice-item--price").text();
                String repositoryGithubName = repository.getElementsByClass("invoice-item--details").text();
                String repositoryGithubLink = "https://github.com/" + repositoryGithubName.replaceAll("[()]", "");
                System.out.println("\t" + repositoryDescription);
                System.out.println("\t" + repositoryTitle);
                System.out.println("\n");
            }
        } catch (IOException e) {
              e.printStackTrace();
        }
    }
}

I plan to use it in a delivery software project. I just need a small example that works. Can someone help please?

Abra
  • 19,142
  • 7
  • 29
  • 41
Cfo
  • 1
  • https://drive.google.com/file/d/15bz-tjm49VgvwygSwEgbyuMN4e-ujMCc/view – Cfo Sep 02 '23 at 09:26
  • The link above refers the image of site inspection that i mention first in my question , for some reason it is not shown in my question. – Cfo Sep 02 '23 at 09:30
  • 2
    The problem is that webpage is all JavaScript functions. Your [image](https://drive.google.com/file/d/15bz-tjm49VgvwygSwEgbyuMN4e-ujMCc/view) is what the browser (i.e. Google Chrome) sees **after** the webpage has loaded and all the JavaScript functions have run. _Jsoup_ sees only the raw HTML, i.e. the HTML **before** the JavaScript functions have run. There are similar questions to yours already answered, for example: [Page content is loaded with JavaScript and Jsoup doesn't see it](https://stackoverflow.com/questions/7488872/page-content-is-loaded-with-javascript-and-jsoup-doesnt-see-it) – Abra Sep 02 '23 at 10:23

0 Answers0