Skip to content

Instantly share code, notes, and snippets.

@wheeliechamp
Created October 18, 2021 15:06
Show Gist options
  • Save wheeliechamp/fedc5bc5237fe8347078fc6fd40983ab to your computer and use it in GitHub Desktop.
Save wheeliechamp/fedc5bc5237fe8347078fc6fd40983ab to your computer and use it in GitHub Desktop.
解析用メソッド追加
package com.example.webscrapingtest.viewmodel
import android.util.Log
import androidx.lifecycle.ViewModel
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.select.Elements
class MainViewModel : ViewModel() {
// TODO: Implement the ViewModel
fun analyzeHtml(src: String) {
var document: Document = Jsoup.parse(src)
var elements: Elements = document.getElementsByClass("LifeToolLocalWeatherItem__body")
Log.d("Test", elements.text())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment