Maybe similar question was already asked but I couldn't find answer that would work for me. I want to get from website (https://www.fcbarcelona.com/football/first-team/schedule) only this informations (in red square) : date, time and name of clubs. I looked that there is a way to get informations with json parsing but I don't know how would that work here. Im new to this and don't even know what to search for, I don't need written code just help on how to do that.

            Asked
            
        
        
            Active
            
        
            Viewed 5,835 times
        
    3
            
            
        
        Vadim Kotov
        
- 8,084
 - 8
 - 48
 - 62
 
        Alen
        
- 949
 - 3
 - 17
 - 37
 
2 Answers
4
            
            
        We can get certain values from webview in android by loading the data in webview , You should need some knowledge in html and javascript.
- Open the website in browser and right click on the page click inspect element or inspect(chrome)
 - find the id/class/tag that you need from that webpage
 
In Android
webview.loadUrl("javascript:(function() { " +  
    "document.getElementsByClassName('match__main__date__dmy')[0].style.color = 'red'; " +  
    "})()");
webview1.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
    super.onPageFinished(view, url);
    StringBuilder sb = new StringBuilder();
    sb.append("document.getElementsByTagName('match__main__date__dmy')[0].onsubmit = function () {");
    sb.append(",// create your Json ");
    sb.append("};");
   //parse the json to get your desired output
}
});
Use the above code(need to change according to your needs)
        livemaker
        
- 464
 - 1
 - 9
 - 19
 
- 
                    Do you know if I can maybe use firebase database to acces that data. I can manualy put dates and times to databse and acces it from app? Is that one posibility ? – Alen Aug 06 '17 at 08:45
 
0
            
            
        I assume that the website doesn't provide some API to get those data.
Therefore the way i would suggest is HTML Scraping. This can be done with Java on the Android.
First Option
- Use jsoup library. An HTML parser
 
Example
Document document = Jsoup.connect(url).get();
Elements matchDate = doc.select("p".first); //<p> tag
Second Option
- Use build in tools like DOM Parser - Reference here
 
I would personally use jsoup since it's more convenient and easy to use. Of course all that requires a basic knowledge of HTML.
        Saurabh Kumar
        
- 437
 - 1
 - 5
 - 18
 
        Stamatis Stiliats
        
- 399
 - 7
 - 23
 
- 
                    Do you know if I can maybe use firebase database to acces that data. I can manualy put dates and times to databse and acces it from app? Is that one posibility ? – Alen Aug 06 '17 at 08:45
 
