芒果搜索.js 943 B

1234567891011121314151617181920212223242526
  1. js:
  2. fetch_params.headers.Referer = 'https://www.mgtv.com';
  3. fetch_params.headers['User-Agent'] = UA;
  4. let d = [];
  5. let html = request(input);
  6. let json = JSON.parse(html);
  7. json.data.contents.forEach(function (data){
  8. if (data.data.sourceList || data.data.yearList) {
  9. let list = data.data.sourceList ? data.data.sourceList : data.data.yearList[0].sourceList;
  10. let desc = '';
  11. list.forEach(function (it){
  12. desc += it.name + '\t';
  13. });
  14. if (list[0].source === 'imgo') {
  15. let img = data.data.pic ? data.data.pic : data.data.yearList[0].pic;
  16. d.push({
  17. title: data.data.title ? data.data.title : data.data.yearList[0].title,
  18. img:img ,
  19. content: data.data.story ? data.data.story : data.data.yearList[0].story,
  20. desc: data.data.playTime,
  21. url: list[0].vid
  22. });
  23. }
  24. }
  25. });
  26. setResult(d);