如何修复部署链接在Heroku上不起作用

时间:2020-11-03 02:08:18

标签: java spring-boot heroku

我与SpringBoot一起使用,并使用Jsoup从另一个网站获取链接,但是当我的本地主机正常工作时,在heroku上取消链接时,出现错误。有人请帮助我

Here is the link on localhost

Heroku returns an empty string

重写fun getInfo(link:String?):可以吗? { ////登录CNS loginCNS(link)

    var singerSong = ""
    var authorSong = ""
    var albumSong = ""
    var lyricsSong = ""
    var yearSong = ""
    var imgSong = ""
    var category = ""
    var listenSong = ""
    var linkMusic = ""
    var nameSong = ""
    var lyricKaraoke = ""
    var txtAuthorSong = "Sáng tác"
    var txtYear = "Năm phát hành"
    var txtAlbum = "Album"

    var positonSinger: Int
    var positionAlbum: Int
    var positionYear: Int
    try {
        val c: Document = Jsoup.connect(link).get()
        val info: Elements = c.select("div.col-md-4")
        lyricKaraoke = doc.select("div.rabbit-lyrics").html().replace("[", "\n [")
        println(lyricKaraoke)
        var text = c.select("div.col-md-4").select("ul.list-unstyled").text()
        val els: Elements = c.select("div.tab-content").first().select("a.download_item")
        imgSong = info.select("img").attr("src")
        nameSong = info.select("h2.card-title").text()
        var findTextAuthor = text.contains(txtAuthorSong)
        var findTextYear = text.contains(txtYear)
        var findTextAlbum = text.contains(txtAlbum)
        positionYear = if (findTextYear) {
            text.indexOf(txtYear)
        } else {
            text.length
        }
        positionAlbum = if (findTextAlbum) {
            text.indexOf(txtAlbum)
        } else {
            positionYear
        }
        positonSinger = if (findTextAuthor) {
            text.indexOf(txtAuthorSong)
        } else {
            positionAlbum
        }

        singerSong = text.removeRange(positonSinger, text.length)
        authorSong = text.substring(positonSinger, positionAlbum)
        albumSong = text.substring(positionAlbum, positionYear)
        yearSong = text.substring(positionYear, text.length)


        lyricsSong = c.select("div.tab-content.tab-lyric").select("div[id]")[2].toString().replace("<br>", "").replace("<div id=\"fulllyric\">", "").replace("</div>", "")
        println(lyricsSong)
        var txtLine = c.select("span.d-flex.listen").text().replace("headset ", "")
        var findTxt = txtLine.indexOf(" ")
        category = "Thể loại: " + c.select("li.breadcrumb-item")[1].text().replace("...", "")

        listenSong = txtLine.removeRange(findTxt, txtLine.length)

        linkMusic = if (els.size >= 2) {
            els[1].attr("href")
        } else {
            els[0].attr("href").substring(0, linkMusic.length - 5)
        }


    } catch (e: IOException) {
        e.printStackTrace()
    } catch (e: NullPointerException) {
        e.printStackTrace()
    }
    return ItemInfo(linkMusic, imgSong, nameSong, singerSong, authorSong, albumSong, yearSong, lyricsSong, lyricKaraoke, listenSong, category)
}

我认为meta“ href”导致了此问题

0 个答案:

没有答案