How I extract the source of video tag in html document using jsoup in android. Video Tag in html is hidden and when user press on img of video than it start playing and video tag is appeared in web But How to do in The Android using JSOUP?
Here Is Some Code
public class MainActivity extends AppCompatActivity {
TextView textView;
String fullString = "";
URL url;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView=(TextView)findViewById(R.id.textView) ;
getWebsite();
// url = null;
// new gettingUrl().execute();
}
private void getWebsite() {
new Thread(new Runnable() {
@Override
public void run() {
final StringBuilder builder = new StringBuilder();
try {
Document doc = Jsoup.connect("http://vm.tiktok.com/JNga1H/").get();
String title = doc.title();
Elements links = doc.select("video");
builder.append(title).append("\n");
for (Element link : links) {
builder.append("\n").append("Link : ").append(link.attr("src"))
.append("\n").append("Text : ").append(link.text());
}
} catch (IOException e) {
builder.append("Error : ").append(e.getMessage()).append("\n");
}
runOnUiThread(new Runnable() {
@Override
public void run() {
textView.setText(builder.toString());
}
});
}
}).start();
}