'Kotlin Jsoup web scrapping
I'm practicing with Kotlin/Jsoup but I don't know what's wrong
Code to get:
<div class="player-container">
<script>
var tabsArray = new Object();
tabsArray['1'] = "<iframe width='100%' height='100%' src='/redirect.php?player=9&code=LmdHOcKJ4LMy3D5VQ8Nk1QxqZ4wPR2ni6nL8OMtdRHY&' frameborder='0' noresize scrolling='no' allowfullscreen></iframe>";
</script>
<div class="iframe-container" id="video_player">
</div>
My code:
app.get(data).document.select("is-9-desktop").forEach {
val urlDecoded = it.select("iframe").attr("src:containsOwn(redirect.php?player=9&)")
val url2 = (urlDecoded).replace("code=", "https://www.fembed.com/v/")
val url = (url2).substring(0,url2.indexOf("&thumbnail="));
if (url.startsWith("https://www.fembed.com")) {
val extractor = FEmbed()
extractor.getUrl(url).forEach { link ->
callback.invoke(link)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
