籃球即時賠率API示例代碼

分享下之前調用過的籃球賠率代碼

 

```java
    /**
     * 獲取 籃球即時指數.籃球全場賠率接口
     * 在線接口文檔: https://www.feijing88.com/doc/list
     */
    public BasketballFullOdds fetchBasketballFullOdds()  {
        String content = fetchString("http://interface.win007.com/lq/LqOdds.aspx");
        MixString partMix = new MixString(content, "$");
        MixString rfMix = new MixString(partMix[2], ";");
        MixString opMix = new MixString(partMix[3], ";");
        MixString dxMix = new MixString(partMix[4], ";");

        return new BasketballFullOdds(
            rfMix.list.stream().map( it -> {
                MixString oddsMix = new MixString(it);
                return new BasketballYpOdds(
                    oddsMix[0],
                    oddsMix[1],
                    oddsMix[2],
                    oddsMix[3],
                    oddsMix[4],
                    oddsMix[5],
                    oddsMix[6],
                    oddsMix[7],
                    oddsMix[8],
                    oddsMix[9],
                    oddsMix[10]
                );
            }).collect(Collectors.toList()),
            opMix.list.stream().map( it -> {
                MixString oddsMix = new MixString(it)
                return new BasketballOpOdds(
                    oddsMix[0],
                    oddsMix[1],
                    oddsMix[2],
                    oddsMix[3],
                    oddsMix[4],
                    oddsMix[5]
                );
            }).collect(Collectors.toList()),
            dxMix.list.stream().map( it -> {
                MixString oddsMix = new MixString(it)
                return new BasketballDxOdds(
                    oddsMix[0],
                    oddsMix[1],
                    oddsMix[2],
                    oddsMix[3],
                    oddsMix[4],
                    oddsMix[5],
                    oddsMix[6],
                    oddsMix[7],
                    oddsMix[8],
                    oddsMix[9],
                    oddsMix[10]
                );
            }).collect(Collectors.toList())
        );
    }
```

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章