admin
2024-09-05 ab35ac8b769b2d9816dffb33a64f2c6f7bd5dd6e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
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;
        }
    }
 
 
}