yqk_open.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. import { Crypto, load, _ } from 'assets://js/lib/cat.js';
  2. let key = '一起看APP';
  3. let deviceInfo = "app=ylys&devices=android&imei=&deviceModel=PCLM10&deviceVersion=9&appVersionName=1.0.9&deviceScreen=1920*1080&appVersionCode=9&deviceBrand=OPPO";
  4. let siteKey = '';
  5. let siteType = 0;
  6. const UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1';
  7. let nextVal = "";
  8. const appId = "e6ddefe09e0349739874563459f56c54";
  9. const reqDomain = "m.yqktv888.com";
  10. async function post(reqUrl, data) {
  11. let res = await req(reqUrl, {
  12. method: 'post',
  13. headers: {
  14. 'User-Agent': UA,
  15. },
  16. data: data,
  17. postType: 'json',
  18. });
  19. return res.content;
  20. }
  21. // cfg = {skey: siteKey, ext: extend}
  22. async function init(cfg) {
  23. siteKey = cfg.skey;
  24. siteType = cfg.stype;
  25. }
  26. async function home(filter) {
  27. try{
  28. let filterObj = [];
  29. let url = "https://api.gquaxhce.com/v1/api/home/header";
  30. const requestId = getRequestId();
  31. const udid = getUUID();
  32. const signData = 'appId='+appId+'&reqDomain='+reqDomain+'&requestId='+requestId+'&udid='+udid+'&appKey=3359de478f8d45638125e446a10ec541';
  33. const sign = Crypto.MD5(signData).toString();
  34. const params = {
  35. "appId": appId,
  36. "reqDomain": reqDomain,
  37. "requestId": requestId,
  38. "udid": udid,
  39. "sign": sign
  40. };
  41. const resp = await post(url,params);
  42. const navs = JSON.parse(resp).data.channelList;
  43. const classes = _.map(navs, (item) => {
  44. let typeId = item.channelId;
  45. let typeName = item.channelName;
  46. return {
  47. type_id: typeId,
  48. type_name: typeName
  49. };
  50. });
  51. return JSON.stringify({
  52. class: classes,
  53. filters: filterObj,
  54. });
  55. }catch(e){
  56. //TODO handle the exception
  57. console.debug("err " + e);
  58. }
  59. }
  60. async function homeVod() {}
  61. async function category(tid, pg, filter, extend) {
  62. const link = "https://api.gquaxhce.com/v1/api/search/queryNow";
  63. const queryJson = {};
  64. queryJson.filerName = "channelId";
  65. queryJson.filerValue = tid;
  66. const queryValueJson = "["+JSON.stringify(queryJson)+"]";
  67. const requestId = getRequestId();
  68. const udid = getUUID();
  69. const signData = "appId=e6ddefe09e0349739874563459f56c54&nextCount=18"+(nextVal.length === 0 ?"":"&nextVal="+nextVal)+"&queryValueJson="+queryValueJson+"&reqDomain=m.yqktv888.com&requestId="+requestId+"&udid="+udid+"&appKey=3359de478f8d45638125e446a10ec541";
  70. const sign = Crypto.MD5(signData).toString();
  71. const params = {
  72. "appId": appId,
  73. "reqDomain": reqDomain,
  74. "nextCount": 18,
  75. "nextVal": nextVal,
  76. "queryValueJson": queryValueJson,
  77. "requestId": requestId,
  78. "udid": udid,
  79. "sign": sign
  80. };
  81. const resp = await post(link,params);
  82. const items = JSON.parse(resp);
  83. nextVal = items.data.nextVal;
  84. let videos = _.map(items.data.items, (item) => {
  85. return {
  86. vod_id: item.vodId,
  87. vod_name: item.vodName,
  88. vod_pic: item.coverImg,
  89. vod_remarks: item.watchingCountDesc,
  90. };
  91. });
  92. return JSON.stringify({
  93. page: parseInt(pg),
  94. pagecount: 0,
  95. limit: 0,
  96. total: 0,
  97. list: videos,
  98. });
  99. }
  100. async function detail(id) {
  101. const link = "https://api.gquaxhce.com/v1/api/vodInfo/detail";
  102. const requestId = getRequestId();
  103. const udid = getUUID();
  104. const signData = "appId=e6ddefe09e0349739874563459f56c54&reqDomain=m.yqktv888.com&requestId="+requestId+"&udid="+udid+"&vodId="+id+"&appKey=3359de478f8d45638125e446a10ec541";
  105. const sign = Crypto.MD5(signData).toString();
  106. const params = {
  107. "appId": appId,
  108. "reqDomain": reqDomain,
  109. "requestId": requestId,
  110. "udid": udid,
  111. "vodId": id,
  112. "sign": sign
  113. };
  114. const resp = await post(link,params);
  115. const item = JSON.parse(resp).data;
  116. const vod = {
  117. vod_id: id,
  118. vod_name: item.vodName,
  119. vod_pic: item.coverImg,
  120. vod_remarks: item.tagList,
  121. vod_content: '[关注公众号:影视资源站] ' + item.intro,
  122. };
  123. const playMap = {};
  124. const tabs = item.playerList;
  125. _.each(tabs, (tab, i) => {
  126. const from = tab.playerName;
  127. let list = tab.epList;
  128. _.each(list, (it) => {
  129. const title = it.epName;
  130. const playUrl = it.epId;
  131. if (!playMap.hasOwnProperty(from)) {
  132. playMap[from] = [];
  133. }
  134. playMap[from].push(title + '$' + playUrl);
  135. });
  136. });
  137. vod.vod_play_from = _.keys(playMap).join('$$$');
  138. const urls = _.values(playMap);
  139. const vod_play_url = _.map(urls, (urlist) => {
  140. return urlist.join('#');
  141. });
  142. vod.vod_play_url = vod_play_url.join('$$$');
  143. return JSON.stringify({
  144. list: [vod],
  145. });
  146. }
  147. async function play(flag, id, flags) {
  148. try{
  149. let url = "https://api.gquaxhce.com/v1/api/vodInfo/getEpDetail";
  150. let requestId = getRequestId();
  151. let udid = getUUID();
  152. let signData = "appId=e6ddefe09e0349739874563459f56c54&epId="+id+"&reqDomain=m.yqktv888.com&requestId="+requestId+"&udid="+udid+"&appKey=3359de478f8d45638125e446a10ec541";
  153. let sign = Crypto.MD5(signData).toString();
  154. let params = {
  155. "appId": appId,
  156. "reqDomain": reqDomain,
  157. "requestId": requestId,
  158. "udid": udid,
  159. "epId": id,
  160. "sign": sign
  161. };
  162. let resp = await post(url,params);
  163. const resolutionItems = JSON.parse(resp).data.resolutionItems;
  164. const vodResolution = resolutionItems.length > 0 ? resolutionItems[resolutionItems.length - 1].vodResolution : "1";
  165. url = "https://api.gquaxhce.com/v1/api/vodInfo/getPlayUrl";
  166. requestId = getRequestId();
  167. udid = getUUID();
  168. signData = "appId=e6ddefe09e0349739874563459f56c54&epId="+id+"&reqDomain=m.yqktv888.com&requestId="+requestId+"&udid="+udid+"&vodResolution="+vodResolution+"&appKey=3359de478f8d45638125e446a10ec541";
  169. sign = Crypto.MD5(signData).toString();
  170. params = {
  171. "appId": appId,
  172. "reqDomain": reqDomain,
  173. "requestId": requestId,
  174. "udid": udid,
  175. "epId": id,
  176. "vodResolution": vodResolution,
  177. "sign": sign
  178. };
  179. resp = await post(url,params);
  180. const play = JSON.parse(resp);
  181. if(!play.result) return "";
  182. return JSON.stringify({
  183. parse: 0,
  184. url: play.data,
  185. header: {
  186. 'User-Agent': UA,
  187. },
  188. });
  189. }catch(e){
  190. console.debug("play err " + e);
  191. }
  192. }
  193. async function search(wd, quick) {
  194. const link = "https://api.gquaxhce.com/v1/api/search/search";
  195. let requestId = getRequestId();
  196. let udid = getUUID();
  197. let signData = "appId=e6ddefe09e0349739874563459f56c54&keyword="+wd+"&nextCount=15&reqDomain=m.yqktv888.com&requestId="+requestId+"&udid="+udid+"&appKey=3359de478f8d45638125e446a10ec541";
  198. let sign = Crypto.MD5(signData).toString();
  199. let params = {
  200. "appId": appId,
  201. "reqDomain": reqDomain,
  202. "requestId": requestId,
  203. "udid": udid,
  204. "nextCount": 15,
  205. "nextVal": "",
  206. "keyword": wd,
  207. "sign": sign
  208. };
  209. let data = JSON.parse(await post(link,params)).data.items;
  210. let videos = [];
  211. for (const vod of data) {
  212. videos.push({
  213. vod_id: vod.vodId,
  214. vod_name: vod.vodName,
  215. vod_pic: vod.coverImg,
  216. vod_remarks: vod.watchingCountDesc,
  217. });
  218. }
  219. return JSON.stringify({
  220. list: videos,
  221. });
  222. }
  223. function getRequestId() {
  224. const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
  225. let requestId = '';
  226. for (let i = 0; i < 32; i++) {
  227. let randomIndex = Math.floor(Math.random() * chars.length);
  228. requestId += chars[randomIndex];
  229. }
  230. return requestId;
  231. }
  232. function getUUID() {
  233. const uuid = Math.random().toString(16).substring(2) + Date.now().toString(16);
  234. return uuid;
  235. }
  236. export function __jsEvalReturn() {
  237. return {
  238. init: init,
  239. home: home,
  240. homeVod: homeVod,
  241. category: category,
  242. detail: detail,
  243. play: play,
  244. search: search,
  245. };
  246. }