All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.schoolwow.sdk.video.analyzer.IQiYiAnalyzer Maven / Gradle / Ivy

package cn.schoolwow.sdk.video.analyzer;

import cn.schoolwow.quickhttp.QuickHttp;
import cn.schoolwow.quickhttp.request.Request;
import cn.schoolwow.quickhttp.response.Response;
import cn.schoolwow.sdk.util.DigestUtil;
import cn.schoolwow.sdk.util.RegExpUtil;
import cn.schoolwow.sdk.video.domain.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

@Deprecated
public class IQiYiAnalyzer extends AbstractAnalyzer {
    private Logger logger = LoggerFactory.getLogger(IQiYiAnalyzer.class);
    private static final String src = "76f90cbd92f94a2e925d83e8ccd22cb7";
    private static final String key = "d5fb4bd9d50c4be6948c97edd7254b0e";

    @Override
    public PlayList getPlaylist(String url) throws IOException {
        String body = null;
        {
            Response response = QuickHttp.connect(url)
                    .userAgent(Request.UserAgent.ANDROID)
                    .execute();
            body = RegExpUtil.plainMatch(response.body(), "window.__INITIAL_STATE__=();\\(function\\(\\)");
            if(null==body){
                throw new IllegalArgumentException("提取专辑页面信息失败!url:"+url);
            }
        }
        JSONObject result = JSON.parseObject(body).getJSONObject("album").getJSONObject("albumInfo");

        PlayList playList = new PlayList();
        playList.url = url;
        playList.tv = TV.IQiYi;
        playList.name = result.getString("albumName");
        playList.cover = "https:"+result.getString("picUrl");
        playList.description = result.getString("desc");
        playList.videoListSupplier = ()->{
            switch(result.getInteger("channelId")){
                case 6:{
                    JSONArray array = result.getJSONArray("summaryInfo");
                    List




© 2015 - 2024 Weber Informatics LLC | Privacy Policy