优酷一级.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. js:
  2. let d = [];
  3. MY_FL.type = MY_CATE;
  4. let fl = stringify(MY_FL);
  5. fl = encodeUrl(fl);
  6. input = input.split('{')[0]+fl;
  7. if(MY_PAGE>1){
  8. let old_session = getItem('yk_session_'+MY_CATE,'{}');
  9. // print('本地访问session:'+old_session);
  10. if(MY_PAGE===2){
  11. input = input.replace('optionRefresh=1','session='+encodeUrl(old_session));
  12. }else{
  13. // input = input.replace(/session=.*?&/,'session='+encodeUrl(old_session)+'&');
  14. input = input.replace('optionRefresh=1','session='+encodeUrl(old_session));
  15. }
  16. }
  17. let html = fetch(input,fetch_params);
  18. // print(html);
  19. try {
  20. html = JSON.parse(html);
  21. let lists = html.data.filterData.listData;
  22. let session = html.data.filterData.session;
  23. session = stringify(session);
  24. // print(session);
  25. if(session!==getItem('yk_session_'+MY_CATE,'{}')){
  26. setItem('yk_session_'+MY_CATE,session);
  27. }
  28. lists.forEach(function (it){
  29. let vid;
  30. if (it.videoLink.includes('id_')) {
  31. vid = it.videoLink.split("id_")[1].split('.html')[0];
  32. // vid = it.videoLink.split("id_")[1].replace('.html','');
  33. } else {
  34. vid = 'msearch:'
  35. }
  36. d.push({
  37. title:it.title,
  38. img:it.img,
  39. desc:it.summary,
  40. url:'https://search.youku.com/api/search?appScene=show_episode&showIds='+vid,
  41. content:it.subTitle
  42. });
  43. });
  44. }catch (e) {
  45. log('一级列表解析发生错误:'+e.message);
  46. }
  47. // print(d);
  48. setResult(d)