我的工具箱-第2个工具影视搜索

预览成品

在这里插入图片描述

准备

在网上找了一个还算比较稳定的资源站接口。(要是小伙伴有好的地址可以评论分享一下 , 奉献的你最迷人)
网站:https://help.feisuzyapi.com/#JSONAPI
接口大概是这样的:

联盟资源分配唯一标识ID,用来区别绑定分类,这个ID一般由苹果CMS官方提供,不可随意修改设置,否则造成入库分类错乱。

1,视频列表地址https://www.feisuzyapi.com/api.php/provide/vod/?ac=list
2,视频详情地址https://www.feisuzyapi.com/api.php/provide/vod/?ac=detail
列表接收参数:
ac=list
t=类别ID
pg=页码
wd=搜索关键字
h=几小时内的数据
例如:https://www.feisuzyapi.com/api.php/provide/vod/?ac=list&t=1&pg=5 分类ID为1的列表数据第5页
内容接收参数:
参数 ids=数据ID,多个ID逗号分割。
t=类型ID
pg=页码
h=几小时内的数据

例如: https://www.feisuzyapi.com/api.php/provide/vod/?ac=detail&ids=123,567 获取ID为123和567的数据信息
https://www.feisuzyapi.com/api.php/provide/vod/?ac=detail&h=24 获取24小时内更新数据信息

编码

1.用java后台写了一个通用的请求转发

@Override
    public String httpProxy(ServiceContext serviceContext) throws Exception {
        String url = Format.formatStrNullForEmpty(serviceContext.getParameter("url"));
        if(StrUtil.isBlank(url)){
            throw new Exception("请输入url");
        }
        HttpServletRequest request = serviceContext.getRequest();
        Enumeration<String> headerNames = request.getHeaderNames();
        Map header = new HashMap();
        while (headerNames.hasMoreElements()) {
            String headerName = headerNames.nextElement();
            String headerValue = request.getHeader(headerName);
            header.put(headerName,new ArrayList(){{
                add(headerValue);
            }});
        }
        Cookie[] cookies = request.getCookies();
        String method = serviceContext.getRequest().getMethod();

        Map form = new HashMap();
        for (String s : request.getParameterMap().keySet()) {
            form.put(s,request.getParameter(s));
        }

        HttpRequest httpRequest = HttpRequest.of(url);
        ArrayList cookies_copy = new ArrayList<>();
        if(cookies!=null){
            for (Cookie cookie : Arrays.asList(cookies)) {
                HttpCookie httpCookie = new HttpCookie(cookie.getName(), cookie.getValue());
                httpCookie.setPath(cookie.getPath());
                httpCookie.setDomain(cookie.getDomain());
                httpCookie.setMaxAge(cookie.getMaxAge());
                cookies_copy.add(httpCookie);
            }
        }
        httpRequest.cookie(cookies_copy);
        String requestPostData = getRequestPostData(request);
        HttpResponse response = httpRequest
                .method(Method.valueOf(method))
                .header(header)
                .body(requestPostData)
                .form(form)
                .setReadTimeout(1000)
                .execute();
        if(response.getStatus() == 302){
            return response.header("Location");
        }
        return response.body();
    }

2.前端设计

a.先请求列表接口(支持分页)
b.点击列表播放按钮调用详情接口
c.如果是 m3u8 就用h5播放,云地址就直接打开浏览器
代码就不贴了,基本都是常规代码

成品体验地址

影视搜索

  • 7
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值