package com.yeshi.buwan.videos.funtv;
|
|
import com.google.gson.Gson;
|
import com.google.gson.reflect.TypeToken;
|
import com.yeshi.buwan.util.HttpUtil;
|
import net.sf.json.JSONArray;
|
import net.sf.json.JSONObject;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* @author hxh
|
* @title: FunTVWebApiUtil
|
* @description: 风行网页爬虫接口
|
* @date 2024/9/2 17:32
|
*/
|
public class FunTVWebApiUtil {
|
public final static String MOVIE_FREE = "http://www.fun.tv/retrieve/c-e794b5e5bdb1.n-e5bdb1e78987.p-e5858de8b4b9.pg-{page}.uc-469.v-e5858de8b4b9?isajax=1";
|
|
|
public static List<String> requestList(String url) throws Exception {
|
String result = HttpUtil.get(url);
|
JSONObject root = JSONObject.fromObject(result);
|
if (root.optInt("status") != 200) {
|
throw new Exception("接口请求出错");
|
}
|
List<String> mediaIds=new ArrayList<>();
|
JSONArray array = root.optJSONObject("data").optJSONObject("data").optJSONArray("ritems");
|
for(int i=0;i<array.size();i++){
|
mediaIds.add(array.optJSONObject(i).optString("mediaid"));
|
}
|
return mediaIds;
|
}
|
|
private static List<FunTVWebEpisode> requestEpisodes(String aid, FunTVWebAlbum album) throws Exception {
|
String url = String.format("https://pm.funshion.com/v5/media/episode?id=%s&ves=1&fudid=%sa0f&cl=mweb&uc=471", aid, System.currentTimeMillis()/1000);
|
String result = HttpUtil.get(url);
|
JSONObject root = JSONObject.fromObject(result);
|
if(root.optInt("retcode")!=200){
|
throw new Exception(root.optString("retmsg"));
|
}
|
if(album!=null){
|
album.setTotalEpisodesCount(root.optInt("totalnum"));
|
album.setNowEpisodesCount(root.optInt("total"));
|
}
|
List<FunTVWebEpisode> episodes = new Gson().fromJson(root.optJSONArray("episodes").toString(),new TypeToken<List<FunTVWebEpisode>>(){}.getType());
|
if(album!=null) {
|
album.setEpisodes(episodes);
|
}
|
return episodes;
|
}
|
|
private static FunTVWebAlbum requestDetail(String aid) throws Exception {
|
String url = String.format(" https://pm.funshion.com/v5/media/profile?id=%s&ves=1&fudid=%sa0f&cl=mweb&uc=471", aid, System.currentTimeMillis()/1000);
|
String result = HttpUtil.get(url);
|
JSONObject root = JSONObject.fromObject(result);
|
if(root.optInt("retcode")!=200){
|
throw new Exception(root.optString("retmsg"));
|
}
|
return new Gson().fromJson(result, FunTVWebAlbum.class);
|
}
|
|
/**
|
* @author hxh
|
* @description 获取风行专辑详情
|
* @date 10:13 2024/9/3
|
* @param: aid
|
* @return com.yeshi.buwan.videos.funtv.FunTVWebApiUtil.FunTVWebAlbum
|
**/
|
public static FunTVWebAlbum getAlbumDetail(String aid) throws Exception {
|
FunTVWebAlbum album = requestDetail(aid);
|
requestEpisodes(aid, album);
|
return album;
|
}
|
|
|
public static void main(String[] args) throws Exception {
|
List<String> list = requestList(MOVIE_FREE.replace("{page}", "1"));
|
FunTVWebAlbum album = requestDetail(list.get(0));
|
FunTVFactory.create(album);
|
System.out.println(album);
|
}
|
|
public static class FunTVWebAlbum {
|
// 专辑详情
|
/**
|
* id : 312157
|
* name : 小熊的夏天
|
* score : 7.1
|
* still : https://img1.funshion.com/sdw?oid=bb6c4f9fc446b85b9773b4c7546153db&w=0&h=0
|
* poster : https://img1.funshion.com/sdw?oid=4f69ccc33c595a4ff6351e031c8ce1e0&w=0&h=0
|
* director : 杨铭
|
* actor : 姜超,陈婷,孙桂田,李大川,王怡婷,于泽凯,申屠韩茜,赵敏萱,徐振皓,向睿达,高昕玥
|
* aword : 马大哈老师和熊孩子
|
* description : 《小熊的夏天》:影片主要讲述了园长晨璐为了改变以往的幼儿教育方式,从而有了野外实地教育活动。大巴车载着孩子们伴随着歌声上了路,就在大家还沉浸在对体验式出游的无限憧憬和兴奋中时,班里的淘气大王丁哥却神秘失踪……
|
* release : 2016年10月14日
|
* update :
|
* area : 中国内地
|
* category : 喜剧
|
* channel : 电影
|
* channel_id : 1
|
* share : https://pm.funshion.com/v5/media/share?id=312157
|
* wx_share_icon :
|
* teacher_id :
|
* teacher :
|
* teachers : []
|
* detail :
|
* detail_pics : []
|
* pay : 0
|
* isvip : 0
|
* isfee : 0
|
* is_limitfree : 0
|
* inspiread_unlock_cnt : 0
|
* monetize :
|
* promotion_drain_info : null
|
* promotion_drain_app_qr :
|
* is_sole : 0
|
* isdisabled : 0
|
* isend : 1
|
* is_vip_copyright : 0
|
*/
|
|
private String id;
|
private String name;
|
private String score;
|
private String still;
|
private String poster;
|
private String director;
|
private String actor;
|
private String aword;
|
private String description;
|
private String release;
|
private String update;
|
private String area;
|
private String category;
|
private String channel;
|
private String channel_id;
|
private String share;
|
private String wx_share_icon;
|
private String teacher_id;
|
private String teacher;
|
private String detail;
|
private String pay;
|
private String isvip;
|
private String isfee;
|
private String is_limitfree;
|
private String inspiread_unlock_cnt;
|
private String monetize;
|
private Object promotion_drain_info;
|
private String promotion_drain_app_qr;
|
private String is_sole;
|
private String isdisabled;
|
private String isend;
|
private String is_vip_copyright;
|
private List<?> teachers;
|
private List<?> detail_pics;
|
|
// 新增加的数据
|
private List<FunTVWebEpisode> episodes;
|
private int totalEpisodesCount;
|
private int nowEpisodesCount;
|
|
|
public String getId() {
|
return id;
|
}
|
|
public void setId(String id) {
|
this.id = id;
|
}
|
|
public String getName() {
|
return name;
|
}
|
|
public void setName(String name) {
|
this.name = name;
|
}
|
|
public String getScore() {
|
return score;
|
}
|
|
public void setScore(String score) {
|
this.score = score;
|
}
|
|
public String getStill() {
|
return still;
|
}
|
|
public void setStill(String still) {
|
this.still = still;
|
}
|
|
public String getPoster() {
|
return poster;
|
}
|
|
public void setPoster(String poster) {
|
this.poster = poster;
|
}
|
|
public String getDirector() {
|
return director;
|
}
|
|
public void setDirector(String director) {
|
this.director = director;
|
}
|
|
public String getActor() {
|
return actor;
|
}
|
|
public void setActor(String actor) {
|
this.actor = actor;
|
}
|
|
public String getAword() {
|
return aword;
|
}
|
|
public void setAword(String aword) {
|
this.aword = aword;
|
}
|
|
public String getDescription() {
|
return description;
|
}
|
|
public void setDescription(String description) {
|
this.description = description;
|
}
|
|
public String getRelease() {
|
return release;
|
}
|
|
public void setRelease(String release) {
|
this.release = release;
|
}
|
|
public String getUpdate() {
|
return update;
|
}
|
|
public void setUpdate(String update) {
|
this.update = update;
|
}
|
|
public String getArea() {
|
return area;
|
}
|
|
public void setArea(String area) {
|
this.area = area;
|
}
|
|
public String getCategory() {
|
return category;
|
}
|
|
public void setCategory(String category) {
|
this.category = category;
|
}
|
|
public String getChannel() {
|
return channel;
|
}
|
|
public void setChannel(String channel) {
|
this.channel = channel;
|
}
|
|
public String getChannel_id() {
|
return channel_id;
|
}
|
|
public void setChannel_id(String channel_id) {
|
this.channel_id = channel_id;
|
}
|
|
public String getShare() {
|
return share;
|
}
|
|
public void setShare(String share) {
|
this.share = share;
|
}
|
|
public String getWx_share_icon() {
|
return wx_share_icon;
|
}
|
|
public void setWx_share_icon(String wx_share_icon) {
|
this.wx_share_icon = wx_share_icon;
|
}
|
|
public String getTeacher_id() {
|
return teacher_id;
|
}
|
|
public void setTeacher_id(String teacher_id) {
|
this.teacher_id = teacher_id;
|
}
|
|
public String getTeacher() {
|
return teacher;
|
}
|
|
public void setTeacher(String teacher) {
|
this.teacher = teacher;
|
}
|
|
public String getDetail() {
|
return detail;
|
}
|
|
public void setDetail(String detail) {
|
this.detail = detail;
|
}
|
|
public String getPay() {
|
return pay;
|
}
|
|
public void setPay(String pay) {
|
this.pay = pay;
|
}
|
|
public String getIsvip() {
|
return isvip;
|
}
|
|
public void setIsvip(String isvip) {
|
this.isvip = isvip;
|
}
|
|
public String getIsfee() {
|
return isfee;
|
}
|
|
public void setIsfee(String isfee) {
|
this.isfee = isfee;
|
}
|
|
public String getIs_limitfree() {
|
return is_limitfree;
|
}
|
|
public void setIs_limitfree(String is_limitfree) {
|
this.is_limitfree = is_limitfree;
|
}
|
|
public String getInspiread_unlock_cnt() {
|
return inspiread_unlock_cnt;
|
}
|
|
public void setInspiread_unlock_cnt(String inspiread_unlock_cnt) {
|
this.inspiread_unlock_cnt = inspiread_unlock_cnt;
|
}
|
|
public String getMonetize() {
|
return monetize;
|
}
|
|
public void setMonetize(String monetize) {
|
this.monetize = monetize;
|
}
|
|
public Object getPromotion_drain_info() {
|
return promotion_drain_info;
|
}
|
|
public void setPromotion_drain_info(Object promotion_drain_info) {
|
this.promotion_drain_info = promotion_drain_info;
|
}
|
|
public String getPromotion_drain_app_qr() {
|
return promotion_drain_app_qr;
|
}
|
|
public void setPromotion_drain_app_qr(String promotion_drain_app_qr) {
|
this.promotion_drain_app_qr = promotion_drain_app_qr;
|
}
|
|
public String getIs_sole() {
|
return is_sole;
|
}
|
|
public void setIs_sole(String is_sole) {
|
this.is_sole = is_sole;
|
}
|
|
public String getIsdisabled() {
|
return isdisabled;
|
}
|
|
public void setIsdisabled(String isdisabled) {
|
this.isdisabled = isdisabled;
|
}
|
|
public String getIsend() {
|
return isend;
|
}
|
|
public void setIsend(String isend) {
|
this.isend = isend;
|
}
|
|
public String getIs_vip_copyright() {
|
return is_vip_copyright;
|
}
|
|
public void setIs_vip_copyright(String is_vip_copyright) {
|
this.is_vip_copyright = is_vip_copyright;
|
}
|
|
public List<?> getTeachers() {
|
return teachers;
|
}
|
|
public void setTeachers(List<?> teachers) {
|
this.teachers = teachers;
|
}
|
|
public List<?> getDetail_pics() {
|
return detail_pics;
|
}
|
|
public void setDetail_pics(List<?> detail_pics) {
|
this.detail_pics = detail_pics;
|
}
|
|
public List<FunTVWebEpisode> getEpisodes() {
|
return episodes;
|
}
|
|
public void setEpisodes(List<FunTVWebEpisode> episodes) {
|
this.episodes = episodes;
|
}
|
|
public int getTotalEpisodesCount() {
|
return totalEpisodesCount;
|
}
|
|
public void setTotalEpisodesCount(int totalEpisodesCount) {
|
this.totalEpisodesCount = totalEpisodesCount;
|
}
|
|
public int getNowEpisodesCount() {
|
return nowEpisodesCount;
|
}
|
|
public void setNowEpisodesCount(int nowEpisodesCount) {
|
this.nowEpisodesCount = nowEpisodesCount;
|
}
|
}
|
|
|
public static class FunTVWebEpisode {
|
/**
|
* id : 1540857
|
* name : 惊涛迷局
|
* num : 1
|
* still : https://img.funshion.com/sdw?oid=f3b9cd457c64ec97934ad7ff3104e179&w=0&h=0
|
* duration : 102:39
|
* clip_duration : 6:00
|
* total_vv : 0
|
* isvip : 1
|
* isfee : 0
|
* license : 登记号:08290040004022803
|
* display_ratio : 2.437
|
* license_corner : http://img2.funshion.com/sdw?oid=d5af6f98846742719c26bf30349784f2&w=0&h=0
|
* isnew : 0
|
* is_watch_inspiread : 0
|
* is_limitfree : 0
|
* is_vip_copyright : 1
|
* highlight : null
|
* inspiread_arealimit : 0
|
* aword :
|
* third_media_id : 0
|
* third_episode_id : 0
|
* user_paid : 0
|
* need_pay : 1
|
*/
|
|
private String id;
|
private String name;
|
private String num;
|
private String still;
|
private String duration;
|
private String clip_duration;
|
private String total_vv;
|
private String isvip;
|
private String isfee;
|
private String license;
|
private String display_ratio;
|
private String license_corner;
|
private String isnew;
|
private String is_watch_inspiread;
|
private String is_limitfree;
|
private String is_vip_copyright;
|
private String inspiread_arealimit;
|
private String aword;
|
private int third_media_id;
|
private int third_episode_id;
|
private String user_paid;
|
private String need_pay;
|
|
public String getId() {
|
return id;
|
}
|
|
public void setId(String id) {
|
this.id = id;
|
}
|
|
public String getName() {
|
return name;
|
}
|
|
public void setName(String name) {
|
this.name = name;
|
}
|
|
public String getNum() {
|
return num;
|
}
|
|
public void setNum(String num) {
|
this.num = num;
|
}
|
|
public String getStill() {
|
return still;
|
}
|
|
public void setStill(String still) {
|
this.still = still;
|
}
|
|
public String getDuration() {
|
return duration;
|
}
|
|
public void setDuration(String duration) {
|
this.duration = duration;
|
}
|
|
public String getClip_duration() {
|
return clip_duration;
|
}
|
|
public void setClip_duration(String clip_duration) {
|
this.clip_duration = clip_duration;
|
}
|
|
public String getTotal_vv() {
|
return total_vv;
|
}
|
|
public void setTotal_vv(String total_vv) {
|
this.total_vv = total_vv;
|
}
|
|
public String getIsvip() {
|
return isvip;
|
}
|
|
public void setIsvip(String isvip) {
|
this.isvip = isvip;
|
}
|
|
public String getIsfee() {
|
return isfee;
|
}
|
|
public void setIsfee(String isfee) {
|
this.isfee = isfee;
|
}
|
|
public String getLicense() {
|
return license;
|
}
|
|
public void setLicense(String license) {
|
this.license = license;
|
}
|
|
public String getDisplay_ratio() {
|
return display_ratio;
|
}
|
|
public void setDisplay_ratio(String display_ratio) {
|
this.display_ratio = display_ratio;
|
}
|
|
public String getLicense_corner() {
|
return license_corner;
|
}
|
|
public void setLicense_corner(String license_corner) {
|
this.license_corner = license_corner;
|
}
|
|
public String getIsnew() {
|
return isnew;
|
}
|
|
public void setIsnew(String isnew) {
|
this.isnew = isnew;
|
}
|
|
public String getIs_watch_inspiread() {
|
return is_watch_inspiread;
|
}
|
|
public void setIs_watch_inspiread(String is_watch_inspiread) {
|
this.is_watch_inspiread = is_watch_inspiread;
|
}
|
|
public String getIs_limitfree() {
|
return is_limitfree;
|
}
|
|
public void setIs_limitfree(String is_limitfree) {
|
this.is_limitfree = is_limitfree;
|
}
|
|
public String getIs_vip_copyright() {
|
return is_vip_copyright;
|
}
|
|
public void setIs_vip_copyright(String is_vip_copyright) {
|
this.is_vip_copyright = is_vip_copyright;
|
}
|
|
public String getInspiread_arealimit() {
|
return inspiread_arealimit;
|
}
|
|
public void setInspiread_arealimit(String inspiread_arealimit) {
|
this.inspiread_arealimit = inspiread_arealimit;
|
}
|
|
public String getAword() {
|
return aword;
|
}
|
|
public void setAword(String aword) {
|
this.aword = aword;
|
}
|
|
public int getThird_media_id() {
|
return third_media_id;
|
}
|
|
public void setThird_media_id(int third_media_id) {
|
this.third_media_id = third_media_id;
|
}
|
|
public int getThird_episode_id() {
|
return third_episode_id;
|
}
|
|
public void setThird_episode_id(int third_episode_id) {
|
this.third_episode_id = third_episode_id;
|
}
|
|
public String getUser_paid() {
|
return user_paid;
|
}
|
|
public void setUser_paid(String user_paid) {
|
this.user_paid = user_paid;
|
}
|
|
public String getNeed_pay() {
|
return need_pay;
|
}
|
|
public void setNeed_pay(String need_pay) {
|
this.need_pay = need_pay;
|
}
|
}
|
|
|
}
|