pixiv.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // ==UserScript==
  2. // @Name QX每日Pixiv图脚本
  3. // @WebURL https://api.lolicon.app/#/setu
  4. // @Quota 300次/天
  5. // ==/UserScript==
  6. let userApikey = ''; //无需apikey了
  7. let userR18 = 2; //18禁为1 非为0 2是混合
  8. let userKeyword = ''; //搜索关键字
  9. let userNum = 1; //一次返回的结果数量,范围为1到10,数字的数量亦为弹框的次数
  10. let proxy = 'i.pixiv.re';
  11. var request = {
  12. url: encodeURI("https://api.lolicon.app/setu/v2?apikey=" + userApikey + "&r18=" + userR18 + "&keyword=" + userKeyword + "&num=" + userNum + "&proxy=" + proxy),
  13. header: {
  14. "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Mobile/15E148 Safari/604.1"
  15. },
  16. }
  17. $task.fetch(request).then(response => {
  18. let obj = JSON.parse(response.body);
  19. console.log(response.body);
  20. if (obj.data) {
  21. for (i = 0; i < obj.data.length; i++) {
  22. const setu = obj.data[i];
  23. let pictureURL = encodeURI(setu.urls["original"]);
  24. let title = setu.title || '';
  25. let author = setu.author || '';
  26. if(setu.aiType == 2){
  27. title = title + '(AI)';
  28. }
  29. $notify("Pixiv", title, author, { "open-url": pictureURL, "media-url": pictureURL }); // Success
  30. }
  31. } else {
  32. $notify("Title", "Subtitle", reason.error); // Error!
  33. }
  34. $done({});
  35. })