pvcep_rules

Rules for /scripts/24204-Picviewer-CE-plus

Ekde 2024/10/29. Vidu La ĝisdata versio.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.sleazyfork.org/scripts/438080/1473715/pvcep_rules.js

  1. /*
  2. PVCEP - Rules for Picviewer CE+
  3. <https://github.com/hoothin/UserScripts/blob/master/Picviewer%20CE%2B/pvcep_rules.js>
  4.  
  5. (c) 2021-2024 Hoothin <rixixi [at] gmail.com>
  6. Licenced under the MIT license.
  7.  
  8. minimum
  9. {
  10. name: site name
  11. r: regular image url or string to be replaced
  12. s: replacement target string
  13. }
  14. or
  15. {
  16. name: site name
  17. getImage(a, p): Replace the image URL when pointing to an image, 'a' refers to the first parent A element, and 'p' is an array of all parent elements, see the example below for details
  18. }
  19. Other parameter items can be added as needed.
  20. Note that css/ext/xhr/lazyAttr (lazy loaded original image URL attribute name)/description (description when collecting images, support selector or xpath)/clickToOpen should only be used after specifying the url.
  21. xhr is used to obtain the attributes of the pictures on the inner pages.
  22. 1. First, use xhr.url() to filter and return the url of the parent a tag, and then the script will automatically grab the webpage pointed to by the url.
  23. 2. And get pictures through xhr.
  24. 2.1 xhr.query is the picture (you can For multiple, multiple will be added to the gallery) selector or function
  25. 2.2 xhr.caption is the description of picture
  26. If the mouse points to an object other than a picture, you can use getExtSrc to generate the desired picture url, see the youtube example below for details
  27. ext is the method for capturing nearby image elements when the mouse hovers over a non-image element. "previous" indicates detecting the previous sibling node, "previous-2" indicates detecting the second sibling node in reverse order, and "next" indicates detecting the next sibling node.
  28. getExtSrc is the method for directly obtaining the image URL based on a non-image element.
  29. */
  30. var siteInfo = [
  31. {
  32. name: "google 图片搜索",
  33. //網址例子 ( 方便測試和查看 )
  34. example: "http://www.google.com.hk/search?q=firefox&tbm=isch",
  35. //是否啟用
  36. enabled: true,
  37. //站點正則,匹配站點url該條規則才會生效
  38. url: /https?:\/\/www.google(\.\w{1,3}){1,3}\/search\?.*&(tbm=isch|udm=2)/,
  39. //鼠標點擊直接打開(僅當高級規則的getImage()或者r/s替換有返回值的時候生效)
  40. clickToOpen: {
  41. enabled: false,
  42. preventDefault: true,//是否嘗試阻止點擊的默認行為(比如如果是你點的是一個鏈接,默認行為是打開這個鏈接,如果是true,js會嘗試阻止鏈接的打開(如果想臨時打開這個鏈接,請使用右鍵的打開命令))
  43. button: 0,//0:鼠標左鍵 1:滾輪按鈕或中間按鈕(如果有) 2:鼠標右鍵。默認為 0
  44. alt: false,//是否需要按下alt鍵
  45. ctrl: false,//是否需要按下ctrl鍵
  46. shift: false,//是否需要按下shift鍵
  47. meta: false,//是否需要按下meta鍵
  48. type: 'actual',//默認的打開方式: 'actual'(彈出,原始圖片) 'magnifier'(放大鏡) 'current'(彈出,當前圖片)
  49. },
  50. getImage: function(a) {
  51. //獲取圖片實際地址的處理函數,
  52. //this 為當前鼠標懸浮圖片的引用,
  53. //第一個參數為當前圖片的父元素中第一個a元素(可能不存在)
  54. //第二個參數為保存當前圖片所有父元素的數組
  55. if(!a) return;
  56. let jsaction = a.getAttribute("jsaction");
  57. if (a.href.match(/imgurl=(.*?)&/i)) {
  58. return decodeURIComponent(RegExp.$1);
  59. } else if (jsaction && jsaction.indexOf('touchstart') !== -1) {
  60. const touchList = [new Touch({
  61. identifier: 1,
  62. target: document.documentElement,
  63. clientX: 0,
  64. clientY: 0
  65. })];
  66. var fakeEvent = new TouchEvent('touchstart', {bubbles: true, touches: touchList});
  67. a.dispatchEvent(fakeEvent);
  68. fakeEvent = new TouchEvent('touchend', {bubbles: true});
  69. a.dispatchEvent(fakeEvent);
  70. if (a.href.match(/imgurl=(.*?)&/i)) {
  71. return decodeURIComponent(RegExp.$1);
  72. }
  73. }
  74. }
  75. // 自定義樣式
  76. // css: '',
  77.  
  78. // 如果圖片藏在非img標籤後面,使用此項獲取被遮擋的img元素。
  79. // 其中previous代表前面一個元素,previous-2代表前面第二個元素,next代表後面一個元素。
  80. // 或者直接用函數獲取,傳入當前元素,返回查找到的元素或是null。
  81. // ext: 'previous-2',
  82.  
  83. // 排除的圖片正則
  84. // exclude: /weixin_code\.png$/i,
  85.  
  86. // 需要替換的圖片正則,匹配上圖片url該條規則才生效
  87. // src: /avatar/i,
  88.  
  89. // 正則或字符串檢測內容,可以為含有多組規則的數組,若為字符串則只進行字符串替換
  90. // r: /\?.*$/i,
  91.  
  92. // 正則或字符串替換內容,可以與上一條一一對應,也可以以數組對應檢測正則的其中一條,比如希望有多個結果嘗試顯示原圖
  93. // s: ''
  94. },
  95. {
  96. name: "123rf",
  97. url: /123rf\.com/,
  98. r: /us\.123rf\.com\/\d+wm\//i,
  99. s: "previews.123rf.com/images/"
  100. },
  101. {
  102. name: "126",
  103. src: /\.126\.net/i,
  104. r: /\/\d+\.\d+x\d+\.\d+\.([^\.]+)$/i,
  105. s: '/5.5000x5000.100.$1'
  106. },
  107. {
  108. name:"178.com",
  109. enabled:true,
  110. url:/^https?:\/\/(?:\w+\.)+178\.com\//i,
  111. clickToOpen:{
  112. enabled:true,
  113. preventDefault:true,
  114. type:'actual',
  115. },
  116. getImage:function(a){
  117. if(!a)return;
  118. var reg=/^https?:\/\/(?:\w+\.)+178\.com\/.+?(https?:\/\/img\d*.178.com\/[^.]+\.(?:jpg|jpeg|png|gif|bmp))/i;
  119. return (a.href.match(reg) || [])[1];
  120. }
  121. },
  122. {
  123. name: "24meitu",
  124. url: /24meitu\.com|25meinv\.com|aisimeinv\.com|24tupian\.com|24meinv\.|24mntp\.|24cos\.|24fh\.|24shipin\.|24mn\./,
  125. r: [/\/m([^\/]+)$/i,
  126. /imgs\./i],
  127. s: ["/$1","bimg."]
  128. },
  129. {
  130. name: "bing 图片搜索",
  131. example:"http://cn.bing.com/images/search?q=%E7%BE%8E%E5%A5%B3",
  132. enabled:true,
  133. url: /^https?:\/\/[^.]*\.bing\.com\/images\//i,
  134. getImage:function(a){
  135. if (!a) return;
  136. var oldsrc=this.src;
  137. var $ = /,imgurl:"([^"]+)/.exec(a.getAttribute('m'));
  138. var newsrc= $ ? $[1] : '';
  139. if(newsrc!=oldsrc)return newsrc;
  140. }
  141. },
  142. {
  143. name:"百度贴吧",
  144. enabled:true,
  145. url:/^https?:\/\/tieba\.baidu\.[^\/]+\//i,
  146. r: [/\/sys\/portrait/i,
  147. /^(http:\/\/tiebapic\.baidu\.com\/forum\/)ab(pic\/item\/[\w.]+)/i],
  148. s: ["/sys/portraitl", "$1$2"],
  149. getImage: function(a, p) {
  150. let bsrc = this.getAttribute('bpic');
  151. return bsrc || null;
  152. },
  153. xhr: {
  154. url: function(a, p) {
  155. if (!this.src) return null;
  156. let pid = this.src.match(/\.baidu\.com\/forum\/w.*\/(\w+)\./);
  157. if (!pid) return null;
  158. pid = pid[1];
  159. let tid = 0;
  160. let tidm = location.href.match(/\/p\/(\d+)/);
  161. if (tidm) tid = tidm[1];
  162. if (tid) {
  163. let kw = document.querySelector(`#wd2`);
  164. if (kw && kw.value) {
  165. return `https://tieba.baidu.com/photo/bw/picture/guide?kw=${kw.value}&tid=${tid}&pic_id=${pid}&see_lz=0&from_page=0&alt=jview`;
  166. }
  167. }
  168. return null;
  169. },
  170. query: function(html, doc, url) {
  171. let data = JSON.parse(html);
  172. if (!data) return null;
  173. let pid = url.match(/&pic_id=(\w+)/)[1];
  174. for (let key in data.data.pic_list) {
  175. let pic = data.data.pic_list[key];
  176. if (pic.img.screen.id == pid) return pic.img.screen.waterurl;
  177. }
  178. return null;
  179. }
  180. }
  181. },
  182. {
  183. name: "百度图片搜索",
  184. example: "http://image.baidu.com/i?ie=utf-8&word=%E9%A3%8E%E6%99%AF&oq=%E9%A3%8E%E6%99",
  185. enabled: true,
  186. url: /^https?:\/\/image\.baidu\.com\/.*&word=/i,
  187. getImage: function(a) {
  188. if (!a) return;
  189. var reg = /&objurl=(http.*?\.(?:jpg|jpeg|png|gif|bmp))/i;
  190. if (a.href.match(reg)) {
  191. return decodeURIComponent(RegExp.$1);
  192. }
  193. }
  194. },
  195. {
  196. name:"豆瓣",
  197. example:"http://movie.douban.com/photos/photo/1000656155/",
  198. enabled: true,
  199. url:/^https?:\/\/[^.]*\.douban\.com/i,
  200. getImage:function(){
  201. var oldsrc = this.src,
  202. newsrc = oldsrc;
  203. var pic = /\/view\/photo\/(?:photo|albumcover|albumicon|thumb|sqxs)\/public\//i;
  204. var movieCover = /\/view\/movie_poster_cover\/[si]pst\/public\//i;
  205. var bookCover = /\/view\/ark_article_cover\/cut\/public\//i;
  206. var spic = /(img\d+.douban.com)\/[sm]pic\//i;
  207. var ratio = /s_ratio_poster/i;
  208. if(/\/subject\/\d+\/discussion/.test(location.href)){
  209. } else if (pic.test(oldsrc)) {
  210. newsrc = oldsrc.replace(pic, '/view/photo/raw/public/');
  211. } else if (movieCover.test(oldsrc)) {
  212. newsrc = oldsrc.replace(movieCover, '/view/photo/raw/public/');
  213. } else if (bookCover.test(oldsrc)) {
  214. newsrc = oldsrc.replace(bookCover, '/view/ark_article_cover/retina/public/');
  215. } else if (spic.test(oldsrc)) {
  216. newsrc = oldsrc.replace(spic, '$1/lpic/');
  217. } else if (ratio.test(oldsrc)) {
  218. newsrc = oldsrc.replace(ratio, 'l');
  219. }
  220. return newsrc == oldsrc ? null : [newsrc,newsrc.replace(/photo\/raw/,"photo/photo")];
  221. }
  222. },
  223. {
  224. name:"bilibili",
  225. enabled:true,
  226. url:/^https?:\/\/[^.]+\.bilibili.com/i,
  227. r: /\d+_\d+\/|\d+_x\d+\.jpg$|@\d+w_\d+h.*\.webp$|_\d+x\d+\.jpg$/i,
  228. s: ""
  229. },
  230. /*{
  231. name: "deviantart",
  232. example: "http://www.deviantart.com",
  233. enabled:true,
  234. url:/^https?:\/\/[^.]*\.deviantart\.com/i,
  235. getImage:function(a, p){
  236. let id,self=this;
  237. if(p[1] && p[1].dataset.hook=="deviation_link"){
  238. id=p[1].href.replace(/.*?(\d+)$/,"$1");
  239. }else if(p[2] && p[2].dataset.hook=="deviation_link"){
  240. id=p[2].href.replace(/.*?(\d+)$/,"$1");
  241. }
  242. if(/\?token/.test(this.src)){
  243. if(!this.dataset.pvsrc && id){
  244. this.dataset.pvsrc="t";
  245. GM_xmlhttpRequest({
  246. method: 'get',
  247. responseType: "json",
  248. url: '/_napi/shared_api/deviation/extended_fetch?deviationid='+id+'&type=art&include_session=false',
  249. onload: function(d) {
  250. var media = (d.response && d.response.deviation)?d.response.deviation.media:null;
  251. var fullview = media && media.types && media.types.find(t=>{return t.t=='fullview'});
  252. if(media && media.baseUri && fullview && media.token){
  253. var resultUrl=media.baseUri+(fullview.c?fullview.c.replace("<prettyName>",media.prettyName).replace(/,q_\d+/,",q_100"):"")+"?token="+media.token[0];
  254. self.dataset.pvsrc=resultUrl;
  255. if(floatBar){
  256. floatBar.update(self, self.dataset.pvsrc);
  257. }
  258. }
  259. }
  260. });
  261. }else if(this.dataset.pvsrc!="t" && id){
  262. return this.dataset.pvsrc;
  263. }
  264. }
  265. return null;
  266. },
  267. },
  268. {
  269. name:"deviantart",
  270. url:/^https?:\/\/[^.]*\.deviantart\.com/i,
  271. xhr: {
  272. url: 'a[data-hook = "deviation_link"]',
  273. query: '[property="contentUrl"]'
  274. }
  275. },*/
  276. {
  277. name:"deviantart",
  278. url:/^https?:\/\/[^.]*\.deviantart\.com/i,
  279. getImage: function(a, p) {
  280. if (!a) return;
  281. let media =Object.keys(a).filter(prop => prop.indexOf("__reactProps") === 0);
  282. if (!media || !a[media] || !a[media].children || !a[media].children.props || !a[media].children.props.deviation) return;
  283. media = a[media].children.props.deviation.media;
  284. let fullview = media.types.filter(d => d.t === "fullview");
  285. let ext = media.baseUri.match(/\.\w+$/);
  286. if (!fullview || !ext) return;
  287. fullview = fullview[0];
  288. ext = ext[0];
  289. return media.baseUri + `/v1/fill/w_${fullview.w},h_${fullview.h}/${media.prettyName}-fullview${ext}?token=` + media.token[0];
  290. }
  291. },
  292. {
  293. name: '花瓣网',
  294. enabled: true,
  295. url: /^https?:\/\/huaban\.com\//i,
  296. ext: 'previous-2',
  297. r: /(.*img.hb.aicdn.com\/.*)_fw(?:236|320)$/i,
  298. s: '$1_fw658',
  299. description: './../following-sibling::p[@class="description"]',
  300. // css: '.pin a.img .cover { display: none; }',
  301. exclude: /weixin_code\.png$/i,
  302. },
  303. {
  304. name: "wikipedia",
  305. enabled:true,
  306. url:/^https?:\/\/.+\.wikipedia\.org\//i,
  307. r: /(https?:\/\/.*)\/thumb(\/.*)\/\d+px-.*/i,
  308. s: "$1$2"
  309. },
  310. {
  311. name:"沪江碎碎",
  312. enabled:true,
  313. url:/^https?:\/\/([^.]+\.)*(?:yeshj\.com|hjenglish\.com|hujiang\.com)/i,
  314. r: /^(https?:\/\/(?:[^.]+\.)*hjfile.cn\/.+)(_(?:s|m))(\.\w+)$/i,
  315. s: '$1$3'
  316. },
  317. {
  318. name: '大众点评',
  319. example: 'http://www.dianping.com/shop/17873296/photos',
  320. url: /^https?:\/\/www.dianping.com\/shop/i,
  321. r: /(.+?dpfile\.com\/.+)\(240c180\)\/(thumb\..+)/i,
  322. s: '$1(700x700)/$2'
  323. },
  324. {
  325. name: 'trakt.tv',
  326. url: /^http:\/\/trakt\.tv\//i,
  327. example: 'http://trakt.tv/shows',
  328. r: /(.*\/images\/posters\/\d+)-(?:300|138)\.jpg\?(\d+)$/i,
  329. s: "$1.jpg?$2"
  330. },
  331. {
  332. name: '网易云音乐',
  333. url: 'https://music.163.com/*',
  334. ext: 'previous',
  335. getImage: function() {
  336. var oldsrc = this.src;
  337. if(this.data){
  338. var newsrc = this.data('src');
  339. if (oldsrc != newsrc) {
  340. return newsrc;
  341. }
  342. }
  343. if (oldsrc.match(/(.*)\?param=\d+y\d+/)) {
  344. return RegExp.$1;
  345. }
  346. }
  347. },
  348. {
  349. name: "美女薄情馆",
  350. url: /^http:\/\/boqingguan\.com\//i,
  351. example: 'http://boqingguan.com/Picture/31637',
  352. lazyAttr: 'data-original',
  353. getImage: function(a) {
  354. var oldsrc = this.getAttribute('data-original') || this.src;
  355. if (oldsrc) {
  356. var newsrc = oldsrc.replace(/![a-z\d]+$/, '');
  357. return newsrc == oldsrc ? '' : newsrc;
  358. }
  359. }
  360. },
  361. {
  362. name:"极限主题社区",
  363. enabled:true,
  364. url:/^https?:\/\/bbs\.themex\.net\/.+/i,
  365. clickToOpen:{
  366. enabled:true,
  367. preventDefault:true,
  368. type:'actual',
  369. },
  370. r: /^(https?:\/\/bbs\.themex\.net\/attachment\.php\?.+)&thumb=1(.+)/i,
  371. s: '$1$2'
  372. },
  373. {
  374. name:"opera官方论坛",
  375. example:"http://bbs.operachina.com",
  376. enabled:true,
  377. url:/^http:\/\/bbs\.operachina\.com/i,
  378. src: /file.php\?id=\d+$/i,
  379. r: /.*/,
  380. s: "$1&mode=view"
  381. },
  382. {
  383. name: 'github 修正',
  384. url: /^https?:\/\/github\.com\//i,
  385. clickToOpen: {
  386. enabled: false,
  387. preventDefault: true,
  388. type: 'actual',
  389. },
  390. getImage: function(a) {
  391. if (a && a.href.indexOf('/blob/master/') > 0) {
  392. return this.src;
  393. }
  394. }
  395. },
  396. {
  397. name: '优美图',
  398. url: /http:\/\/(?:www\.)?topit\.me\//,
  399. lazyAttr: 'data-original',
  400. xhr: {
  401. url: /topit\.me\/item\/\d+/,
  402. query: ['a[download]', 'a#item-tip'],
  403. }
  404. },
  405. {
  406. name: '半次元',
  407. url: /^https?:\/\/bcy\.net\//,
  408. r: [/\/\dX\d$|\/w\d+$/i,
  409. "/cover/",
  410. /\/(middle|small)\.jpg/i],
  411. s: ["", "/post/", "/big.jpg"]
  412. },
  413. {
  414. name: 'Steampowered',
  415. url: /\.steampowered\.com/,
  416. r: /\.\d+x\d+\.jpg/i,
  417. s: ".jpg"
  418. },
  419. {
  420. name: 'Steamcommunity',
  421. url: /steamcommunity\.com/,
  422. r: /output\-quality=\d+&fit=inside\|\d+\:\d+/i,
  423. s: "output-quality=100&fit=inside|0:0"
  424. },
  425. {
  426. name: '知乎',
  427. url: /(zhihu|zhimg)\.com/,
  428. r: /_(b|xs|s|l|\d+(x\d+|w))\./i,
  429. s: "."
  430. },
  431. {
  432. name: '500px',
  433. url: /500px\./,
  434. r: [/\/w%3D\d+_h%3D\d+\/v2.*/i,
  435. /^((?:(?:pp?cdn|s\\d\\.amazonaws\\.com\/photos|gp\\d+\\.wac\\.edgecastcdn\\.net\/806614\/photos\/photos)\\.500px|djlhggipcyllo\\.cloudfront)\\.(?:net|org)\/\\d+\/[\\da-f]{40}\/)\\d+\\./],
  436. s: ["/m%3D2048_k%3D1_of%3D1/v2",
  437. "$12048.jpg"]
  438. },
  439. {
  440. name: 'Nyaa',
  441. url: /nyaa\.se/,
  442. r: /upload\/small\//i,
  443. s: "upload/big/"
  444. },
  445. {
  446. name: "itunes",
  447. url: /itunes\.apple\.com/,
  448. r: /\d+x\d+bb\./i,
  449. s: "1400x1400bb."
  450. },
  451. {
  452. name: "汽车之家",
  453. url: /\.autohome\.com\.cn/,
  454. r: /(\?imageView.*|\d+x\d+_\d+_|f_m_|t_|s_)/i,
  455. s: ""
  456. },
  457. {
  458. name: "易车",
  459. url: /\.bitauto\.com/,
  460. r: /_\d+\.jpg$/i,
  461. s: "_12.jpg"
  462. },
  463. {
  464. name: "爱卡",
  465. url: /\.xcar\.com\.cn/,
  466. r: /\-\d+x\d+\.jpg/i,
  467. s: ""
  468. },
  469. {
  470. name: "太平洋汽车",
  471. url: /\.pcauto\.com\.cn/,
  472. r: /_\d+x\d+\.jpg$/i,
  473. s: ".jpg"
  474. },
  475. {
  476. name: "新浪汽车",
  477. url: /\.auto\.sina\.com\.cn/,
  478. r: /_\d+\.jpg$/i,
  479. s: "_src.jpg"
  480. },
  481. {
  482. name: "greasyfork",
  483. url: /(greasyfork|sleazyfork)\.org/,
  484. getImage: function() {
  485. if(this.parentNode && this.parentNode.nodeName=="A" && /amazonaws\.com/.test(this.parentNode.href)){
  486. return this.parentNode.href;
  487. }
  488. return this.src && this.src.replace(/\/thumb\//i,"/original/").replace(/\/thumbnails\//i,"/").replace(/(\/forum\/uploads\/userpics\/.*\/)n([^\/]+)$/,"$1p$2");
  489. }
  490. },
  491. {
  492. name: "dribbble",
  493. url: /dribbble\.com/,
  494. r: [/_teaser(.[^\.]+)$/i,
  495. /_1x\./i,
  496. /\?compress=.*/],
  497. s: ["$1",".",""]
  498. },
  499. {
  500. name: "百度百科",
  501. url: /baike\.baidu\.com/,
  502. r: [/.*bdstatic\.com.*\/([^\/]+)\.jpg/i,
  503. /(.*bkimg\.cdn\.bcebos\.com.*\?x-bce-process=image).*/i],
  504. s: ["http://imgsrc.baidu.com/baike/pic/item/$1.jpg",
  505. "$1"]
  506. },
  507. {
  508. name: "nvshens",
  509. url: /nvshens\.com|onvshen\.com/,
  510. r: /(\img\.onvshen\.com.*)(?:thumb\/|_s)(.*)/i,
  511. s: "$1$2"
  512. },
  513. {
  514. name: "Tumblr",
  515. url: /tumblr\.com/,
  516. exclude: /\/avatar_/i,
  517. r: /[^\/]*(media\.tumblr\.com.*_)\d+(\.[^\.]+)$/i,
  518. s: "$1raw$2"
  519. },
  520. {
  521. name: "Tumblr",
  522. url: /tumblr\.com/,
  523. src: /\/avatar_/i,
  524. r: /(media\.tumblr\.com.*_)[^_]+(\.[^\.]+)$/i,
  525. s: "$1512$2"
  526. },
  527. {
  528. name: "Acgget",
  529. url: /acg18\.us|acgget\./,
  530. r: /(pic\.acgget\.com\/thumb\/)w\d+_h\d+\//i,
  531. s: "$1w9999_h9999/"
  532. },
  533. {
  534. name: "Pixiv",
  535. url: /pixiv\.net|pximg\.net/,
  536. src: /pximg\.net\/c\/\d+x\d+/i,
  537. r: /pximg\.net\/c\/\d+x\d+.*\/img\/(.*)_.*$/i,
  538. s: ["pximg.net/img-original/img/$1.jpg","pximg.net/img-original/img/$1.png"]
  539. },
  540. {
  541. name: "Wallhaven",
  542. url: /wallhaven\./,
  543. src: /wallpapers\/thumb\/small\/th|th\.wallhaven\.cc\/(small|lg)\//i,
  544. r: [/wallpapers\/thumb\/small\/th(.*)\./i,
  545. /th\.wallhaven\.cc\/(small|lg)\/(.*)?\/(.*)\..*/i],
  546. s: [["wallpapers/full/wallhaven$1.jpg","wallpapers/full/wallhaven$1.png"],
  547. ["w.wallhaven.cc/full/$2/wallhaven-$3.jpg","w.wallhaven.cc/full/$2/wallhaven-$3.png"]],
  548. getImage() {
  549. let srcReg1 = /wallpapers\/thumb\/small\/th(.*)\./i;
  550. let srcReg2 = /th\.wallhaven\.cc\/(small|lg)\/(.*)?\/(.*)\..*/i;
  551. let res1 = "wallpapers/full/wallhaven$1.";
  552. let res2 = "w.wallhaven.cc/full/$2/wallhaven-$3.";
  553. let png, ne;
  554. if (this.nextElementSibling && this.nextElementSibling.nextElementSibling) {
  555. ne = this.nextElementSibling.nextElementSibling;
  556. if (ne.className != "thumb-info") ne = null;
  557. else png = !!ne.querySelector('.png');
  558. }
  559. if (srcReg1.test(this.src)) {
  560. return ne ? this.src.replace(srcReg1, res1 + (png ? "png" : "jpg")) : [this.src.replace(srcReg1, res1 + "jpg"), this.src.replace(srcReg1, res1 + "png")];
  561. }
  562. if (srcReg2.test(this.src)) {
  563. return ne ? this.src.replace(srcReg2, res2 + (png ? "png" : "jpg")) : [this.src.replace(srcReg2, res2 + "jpg"), this.src.replace(srcReg2, res2 + "png")];
  564. }
  565. }
  566. },
  567. {
  568. name: "lofter",
  569. url: /lofter\./,
  570. getImage: function(a) {
  571. if(a && a.href && a.hasAttribute("bigimgsrc")){
  572. return a.getAttribute("bigimgsrc");
  573. }
  574. return this.src.replace(/\?.*/i,"");
  575. }
  576. },
  577. {
  578. name: "sohu",
  579. url: /(sohu|sohucs)\.com/,
  580. r: /(sohucs\.com\/).*\/(images\/|os\/)/i,
  581. s: "$1$2"
  582. },
  583. {
  584. name: "moegirl",
  585. url: /(moegirl|mengniang)\.org/,
  586. r: /(common)\/thumb(.*)\/[^\/]+/i,
  587. s: "$1$2"
  588. },
  589. {
  590. name: "fanfou",
  591. url: /fanfou\.com/,
  592. r: /@.+/i,
  593. s: ""
  594. },
  595. {
  596. name: "meitudata",
  597. url: /meipai\.com/,
  598. r: /!thumb.+/i,
  599. s: ""
  600. },
  601. {
  602. name: "mafengwo",
  603. url: /mafengwo\.cn/,
  604. r: /\?imageMogr.*/i,
  605. s: ""
  606. },
  607. {
  608. name: "discordapp",
  609. url: /(discordapp\.|discord\.)(com|net)/,
  610. r: [/\?width=\d+&height=\d+$/i, /.*\/external\/.*\/(https?)\/(.*)\?format.*/],
  611. s: ["", "$1://$2"]
  612. },
  613. {
  614. name: "推特",
  615. url: /https:\/\/(www\.)?(x|twitter)\.com|pbs\.twimg\.com/,
  616. description: ["./..", "aria-label"],
  617. getImage: function(a, p){
  618. let newsrc = this.src.replace("_normal.",".").replace("_200x200.",".").replace("_mini.",".").replace("_bigger.",".").replace(/_x\d+\./,".");
  619. if (newsrc != this.src) return newsrc;
  620. if (/\.svg$/.test(newsrc)) return;
  621. newsrc=newsrc.replace(/\?format=/i, ".").replace(/\&name=/i, ":").replace(/\.(?=[^\.\/]*$)/, "?format=").replace( /(:large|:medium|:small|:orig|:thumb|:[\dx]+)/i, "");
  622. if (newsrc != this.src) {
  623. if (a && a.role == 'link') {
  624. let match = a.href.match(/\/([^\/]+)\/status\/([^\/]+)\/photo\/(\d+)/);
  625. if (match) {
  626. let time = p[14] && p[14].querySelector('time');
  627. if (time) {
  628. this.alt = match[1] + " - " + time.innerText + "_" + match[3];
  629. }
  630. }
  631. }
  632. return newsrc+"&name=orig";
  633. }
  634. },
  635. ext: function(target) {
  636. if(target.parentNode && target.parentNode.previousElementSibling){
  637. let imgs=target.parentNode.previousElementSibling.querySelectorAll("img");
  638. if(imgs.length==1)return imgs[0];
  639. }
  640. return null;
  641. }
  642. },
  643. {
  644. name: "Fandom",
  645. url: /fandom\.com/,
  646. r: [/scale\-to\-width\-down\/\d+/i,
  647. /smart\/width\/\d+\/height\/\d+/i],
  648. s: ["",""]
  649. },
  650. {
  651. name: "yande",
  652. url: /yande\.re|konachan\.(net|com)/,
  653. getImage: function(a, p) {
  654. if(p[1] && p[1].nextSibling && p[1].nextSibling.classList &&
  655. p[1].nextSibling.classList.contains("largeimg")){
  656. return p[1].nextSibling.href.replace(/\/(preview|jpeg|sample)\/(.*\.)jpg$/, "/image/$2png");
  657. }
  658. return this.src.replace(/\/(preview|jpeg|sample)\/(.*\.)jpg$/, "/image/$2png");
  659. }
  660. },
  661. {
  662. name:"绅士漫画",
  663. url:/^https?:\/\/(www\.)?wnacg\./,
  664. src: /\/\/t(\w\.qy.*data\/)t\//,
  665. r: /\/\/t(\w\.qy.*data\/)t\//,
  666. s: "//img$1",
  667. xhr: {
  668. url: function(a, p) {
  669. if (p && p[1] && p[1].className === 'pic_box tb' && a && a.href) {
  670. return a.href;
  671. }
  672. },
  673. query: '#picarea'
  674. }
  675. },
  676. {
  677. name:"xlysauc",
  678. url:/^https?:\/\/xlysauc\.com\//,
  679. r: /\/x\/(\d+\.jpg)/,
  680. s: "/d/$1",
  681. ext: function(target) {
  682. if (target.parentNode.className === 'imgbg' || target.className === 'pp_hoverContainer'){
  683. let img = target.parentNode.querySelector("img");
  684. if (img) return img;
  685. }
  686. return null;
  687. }
  688. },
  689. {
  690. name: "E621",
  691. url: /e621\.net/,
  692. getImage: function(a, p) {
  693. if(p[2] && p[2].dataset.fileUrl){
  694. return p[2].dataset.fileUrl;
  695. }
  696. return this.src;
  697. }
  698. },
  699. {
  700. name: "Pinterest",
  701. url: /pinterest\.com/,
  702. getImage: function(a, p) {
  703. if(this.srcset){
  704. var srcs=this.srcset.split(","),minSize=0,newSrc;
  705. srcs.forEach(srci=>{
  706. let srcInfo=srci.trim().split(" "),curSize=parseInt(srcInfo[1]);
  707. if(srcInfo[1] && (curSize>minSize || minSize==0)){
  708. minSize=curSize;
  709. newSrc=srcInfo[0];
  710. }
  711. });
  712. if(newSrc)return newSrc;
  713. }
  714. return this.src.replace(/\/\d+x\//i, "/736x/");
  715. }
  716. },
  717. {
  718. name: "Zhisheji",
  719. url: /zhisheji\.com/,
  720. r: /thumbnail\/.*/i,
  721. s: ""
  722. },
  723. {
  724. name: "imgbox",
  725. src: /imgbox\.com/,
  726. r: /thumbs(\d\.imgbox.*)_t\./i,
  727. s: "images$1_o."
  728. },
  729. {
  730. name: "Reddit",
  731. url: /reddit\.com|redd\.it/,
  732. getImage: function() {
  733. if (this.srcset) {
  734. var srcs = this.srcset.split(/[xw],/i);
  735. for (let i = 0; i < srcs.length; i++) {
  736. let srcInfo = srcs[i].trim().split(" ")[0];
  737. if (srcInfo.indexOf("?width") == -1) return srcInfo;
  738. }
  739. } else if (/^https?:\/\/preview\./.test(this.src)){
  740. return this.src.replace("preview", "i").replace(/\?.*/, "");
  741. }
  742. return this.src;
  743. },
  744. getExtSrc: function() {
  745. if (/^https?:\/\/imgur\.com(\/a)?\/\w{5,}/.test(this.href)) {
  746. return this.href.replace(/^https?:\/\/imgur\.com(\/a)?\/(\w+)/, "https://i.imgur.com/$2.webp");
  747. }
  748. },
  749. xhr: {
  750. url: function(a, p, self) {
  751. if (a && a.href && /\/\/v.redd\.it\/\w+\/?$/.test(a.href)) {
  752. return a.href + '/DASHPlaylist.mpd';
  753. } else if (a && a.href && /^https:\/\/www\.reddit\.com\/gallery\//.test(a.href)) {
  754. return a.href;
  755. } else if (a && a.href && /redgifs\.com\//.test(a.href)) {
  756. const apiUrl = 'https://api.redgifs.com/v2';
  757. if (!self.redgifsToken) {
  758. self.redgifsToken = "1";
  759. fetch(`${apiUrl}/auth/temporary`).then(res => res.json()).then((data) => {
  760. if (data && data.token) {
  761. self.redgifsToken = data.token;
  762. }
  763. });
  764. }
  765. return apiUrl + "/gifs/" + a.href.replace(/.*redgifs.com\/(..\/)?(\w+\/)?(\w+)(?:\.\w+)?/, '$3');;
  766. } else if (p[1] && p[1].classList.contains("search-result")) {
  767. let link = p[1].querySelector("a.search-link");
  768. if (link && link.href) {
  769. if (/\/\/v.redd\.it\/\w+\/?$/.test(link.href)) {
  770. return link.href + '/DASHPlaylist.mpd';
  771. } else if (/^https:\/\/www\.reddit\.com\/gallery\//.test(link.href)) {
  772. return link.href;
  773. }
  774. }
  775. }
  776. },
  777. headers: (url, self) => {
  778. if (/redgifs\.com\//.test(url)) {
  779. return { Authorization:`Bearer ${self.redgifsToken}` };
  780. }
  781. },
  782. query: function(html, doc, url) {
  783. try {
  784. if (/redgifs\.com\//.test(url)) {
  785. let data;
  786. try {
  787. data = JSON.parse(html);
  788. } catch (e) {
  789. return;
  790. }
  791. if (data && data.gif) {
  792. return data.gif.urls.gif || data.gif.urls.hd;
  793. }
  794. } else if (/^https:\/\/www\.reddit\.com\/gallery\//.test(url)) {
  795. return [].reduce.call(doc.querySelectorAll("figure>a"), (total, cur) => {
  796. return total.concat(cur.href);
  797. }, []);
  798. }
  799. var xmlDoc = (new DOMParser()).parseFromString(html, 'application/xml');
  800. var highestRes = [].slice.call(xmlDoc.querySelectorAll('Representation[frameRate]'))
  801. .sort(function (r1, r2) {
  802. var w1 = parseInt(r1.getAttribute('width')), w2 = parseInt(r2.getAttribute('width'));
  803. return w1 > w2 ? -1 : (w1 < w2 ? 1 : 0);
  804. })
  805. .find(function (repr) { return !!repr.querySelector('BaseURL'); });
  806.  
  807. if (highestRes) {
  808. var baseUrl = highestRes.querySelector('BaseURL').textContent.trim();
  809. return baseUrl.indexOf('//') !== -1 ? baseUrl : url.replace('DASHPlaylist.mpd', baseUrl);
  810. }
  811. } catch (err) {
  812. console.log(err);
  813. }
  814. }
  815. }
  816. },
  817. {
  818. name: "Rule34hentai",
  819. url: /rule34hentai\.net/,
  820. r: "/_thumbs/",
  821. s: "/_images/"
  822. },
  823. {
  824. name: "Rule34",
  825. url: /rule34\.xxx/,
  826. src: /\/(thumbnails|samples)\/(.*)\/(thumbnail|sample)_/i,
  827. r: /\/(thumbnails|samples)\/(.*)\/(thumbnail|sample)_(.*)\..*/i,
  828. s: ["/images/$2/$4.jpeg","/images/$2/$4.png","/images/$2/$4.jpg"]
  829. },
  830. {
  831. name: "Photosight",
  832. url: /photosight\.ru/,
  833. r: /(cdny\.de.*\/)t\//i,
  834. s: "$1x/"
  835. },
  836. {
  837. name: "Xiaohongshu",
  838. url: /xiaohongshu\.com/,
  839. ext: function(target) {
  840. if (target.className == 'change-pic') {
  841. var imgs=target.previousElementSibling.querySelectorAll('li'),i=0;
  842. for(i=0;i<imgs.length;i++){
  843. if(imgs[i].style.display!="none")
  844. return imgs[i].childNodes[0];
  845. }
  846. }
  847. return target;
  848. },
  849. r: [/\/w\/\d+\/(h\/\d+\/)?(q\/\d+\/)?/i, /.*\.xhscdn\.com.*\/(\w+)(!.*|$)/i],
  850. s: ["/w/1080/", "https://sns-img-bd.xhscdn.com/$1"]
  851. },
  852. {
  853. name: "Youtube",
  854. url: /youtube\.com/,
  855. ext: function(target) {
  856. if (target.tagName == "ytd-thumbnail" || target.id == "thumbnail-container") {
  857. return target.querySelector("img");
  858. }
  859. },
  860. getExtSrc: function() {
  861. let newsrc = "";
  862. if (this.id == "thumbnail-container" && this.children[0].hasAttribute("loaded")) {
  863. let img = this.querySelector('img');
  864. if (!img) return;
  865. newsrc = img.src;
  866. }
  867. return newsrc.replace(/\?.*$/i,"");
  868. },
  869. getImage: function(a, p) {
  870. var newsrc=this.src;
  871. if(p[2] && this.classList.contains('ytd-moving-thumbnail-renderer')){
  872. newsrc = p[2].querySelector("img").src;
  873. }
  874. if(!newsrc || newsrc.indexOf("i.ytimg.com") == -1) return;
  875. return newsrc.replace(/\?.*$/i,"");
  876. }
  877. },
  878. {
  879. name: "588ku",
  880. url: /588ku\.com/,
  881. r: /!\/fw.*/,
  882. s: ""
  883. },
  884. {
  885. name: "ibaotu",
  886. url: /ibaotu\.com/,
  887. ext: 'previous',
  888. r: "!fwc238",
  889. s: "!ww7002"
  890. },
  891. {
  892. name: "58pic",
  893. url: /58pic\.com/,
  894. ext: function(target){
  895. if(target.className=="no-login" && target.style.opacity==""){
  896. target.style.opacity=0.99;
  897. setTimeout(()=>{target.style.display="none";},1000);
  898. }
  899. return null;
  900. },
  901. r: /!.*/i,
  902. s: "!w1024"
  903. },
  904. {
  905. name: "gelbooru",
  906. url: /gelbooru\.com/,
  907. src: /(thumbnails|samples)\/(.*)\/(thumbnail|sample)_/i,
  908. r: /.*\/(thumbnails|samples)\/(.*)\/(thumbnail|sample)_(.*)\..*/i,
  909. s: ["https://img3.gelbooru.com/images/$2/$4.png","https://img3.gelbooru.com/images/$2/$4.jpg"]
  910. },
  911. {
  912. name: "donmai",
  913. url: /donmai\.us/,
  914. src: /(thumbnails|sample)\/(.*)\/(thumbnail|sample)_|\/\d+x\d+\//i,
  915. r: [/\/(thumbnails|sample)\/(.*)\/(thumbnail|sample)_(.*)/i,
  916. /\/\d+x\d+\/(.*)\..*/i
  917. ],
  918. s: ["/original/$2/$4",["/original/$1.jpg", "/original/$1.png"]]
  919. },
  920. {
  921. name: "erosberry",
  922. url: /erosberry\.com/,
  923. r: /(\/\d+\/)tn_(\d+\.[^\/]+)$/i,
  924. s: "$1$2"
  925. },
  926. {
  927. name: "javdb",
  928. url: /javdb/,
  929. r: "/thumbs/",
  930. s: "/covers/"
  931. },
  932. {
  933. name: "javbus",
  934. url: /javbus\.|busjav\./,
  935. r: /\/thumbs?(\/\w+)\.jpg$/i,
  936. s: "/cover$1_b.jpg"
  937. },
  938. {
  939. name: "avmoo",
  940. url: /avmoo\./,
  941. r: "ps.jpg",
  942. s: "pl.jpg"
  943. },
  944. {
  945. name: "asiansister",
  946. url: /asiansister\.com/,
  947. r: "_t.",
  948. s: "."
  949. },
  950. {
  951. name: "jianshu",
  952. url: /jianshu\.com/,
  953. r: /(upload-images\.jianshu\.io\/.*)\?.*/i,
  954. s: "$1"
  955. },
  956. {
  957. name: "artstation",
  958. ext: 'next',
  959. url: /artstation\.com/,
  960. r: /\/(\d{14}\/)?smaller_square\//i,
  961. s: "/large/",
  962. xhr: {
  963. url: function(a, p) {
  964. if (a && a.href.match('/artwork/')) return a.href.replace('/artwork/', '/projects/') + '.json';
  965. },
  966. query: function(html) {
  967. let datas = JSON.parse(html);
  968. let urls = [];
  969. datas.assets.forEach(d => {
  970. urls.push(d.image_url)
  971. });
  972. return urls;
  973. }
  974. }
  975. },
  976. {
  977. name: "flickr",
  978. url: /flickr\.com/,
  979. ext: function(target){
  980. if(target.nodeName=="A" && target.className=="overlay" && target.parentNode && target.parentNode.parentNode && target.parentNode.parentNode.parentNode){
  981. return target.parentNode.parentNode.parentNode;
  982. }else if(target.nodeName=="DIV" && target.classList.contains("photo-notes-scrappy-view")){
  983. return target.previousElementSibling.querySelector(".main-photo");
  984. }else if(target.classList.contains("context-thumb")){
  985. return target;
  986. }
  987. return null;
  988. },
  989. r: /_\w\./i,
  990. s: "_c."
  991. },
  992. {
  993. name: "wikiart",
  994. url: /wikiart\.org/,
  995. r: /!.*/i,
  996. s: ''
  997. },
  998. {
  999. name: "discuz",
  1000. r: [/(.+\/attachments?\/.+)\.thumb\.\w{2,5}$/i,
  1001. /((wp-content|moecdn\.org)\/uploads\/.*)\-\d+x\d+(-c)?/i,
  1002. /.*(?:url|src)=(https?:\/\/.*\.(?:jpg|jpeg|png|gif|bmp)).*/i,
  1003. /.*thumb\.php\?src=([^&]*).*/i],
  1004. s: '$1'
  1005. },
  1006. {
  1007. name: "weibo 视频",
  1008. url: /^https:\/\/(www\.|s\.|m\.)?weibo\.com/,
  1009. getExtSrc: function() {
  1010. if (this.classList.contains('hoverMask')) {
  1011. let video = this.parentNode.firstElementChild;
  1012. if (video && video.nodeName == 'VIDEO') return [video.poster, video.src];
  1013. }
  1014. },
  1015. video: /video$/
  1016. },
  1017. {
  1018. name: "weibo",
  1019. r: /(\.sinaimg\.(cn|com)\/)(?:bmiddle|orj360|mw\d+)/i,
  1020. s: '$1large'
  1021. },
  1022. {
  1023. name: "weibo2",
  1024. r: /(\.sinaimg\.(cn|com)\/)(?:square|thumbnail)/i,
  1025. s: '$1mw1024'
  1026. },
  1027. {
  1028. name: "sina head",
  1029. r: /(\.sinaimg\.(cn|com)\/\d+)\/50\//i,
  1030. s: '$1/180/'
  1031. },
  1032. {
  1033. name: "新浪相册",
  1034. src: /\.sinaimg\.(cn|com)\/thumb\d+\/\w+/i,
  1035. r: /thumb\d+/,
  1036. s: 'mw690'
  1037. },
  1038. {
  1039. name: "sina sports",
  1040. src: /k\.sinaimg\.cn\/n\//i,
  1041. r: /k\.sinaimg\.cn\/n\/(.*)\/(w\d+)?h\d+[^\/]+$/,
  1042. s: 'n.sinaimg.cn/$1'
  1043. },
  1044. {
  1045. name: "gravatar",
  1046. src: /gravatar\.com\/avatar\/|\/gravatar\//i,
  1047. r: /(avatar\/.*[\?&]s=).*/,
  1048. s: '$11920'
  1049. },
  1050. {
  1051. name: "ucServerAvatar",
  1052. src: /uc_server\/avatar\.php/i,
  1053. r: /(uc_server\/avatar\.php\?uid=\d+&size=).*/,
  1054. s: '$1big'
  1055. },
  1056. {
  1057. name: "md",
  1058. src: /\.md\./i,
  1059. r: /\.md(\.[^\.]+)$/i,
  1060. s: '$1'
  1061. },
  1062. {
  1063. name: "ytimg",
  1064. src: /i\.ytimg\.com/i,
  1065. exclude: /mqdefault_6s/i,
  1066. r: /\?.*$/i,
  1067. s: ''
  1068. },
  1069. {
  1070. name: "meituan",
  1071. url: /\.meituan\.net/i,
  1072. r: /\/avatar\/\w{2}/i,
  1073. s: '/avatar/o0'
  1074. },
  1075. {
  1076. name: "hdslb",
  1077. src: /hdslb\.com\//i,
  1078. r: /@.*/i,
  1079. s: ''
  1080. },
  1081. {
  1082. name: "coolapk",
  1083. url: /\.coolapk\.com\//i,
  1084. r: /\.s\.\w+$/i,
  1085. s: ''
  1086. },
  1087. {
  1088. name: "aicdn",
  1089. src: /\.aicdn\.com\//i,
  1090. r: /_fw\d+$/i,
  1091. s: ''
  1092. },
  1093. {
  1094. name: "duitang",
  1095. url: /duitang\.com\//i,
  1096. r: /.thumb.(\d+_)?\d*(_c)?\./i,
  1097. s: '.'
  1098. },
  1099. {
  1100. name: "imgur",
  1101. src: /imgur\.com\//i,
  1102. r: [/h(\.[^\/]+)$/i,/maxwidth=\d+/i,/b\./],
  1103. s: ["$1","maxwidth=99999","."]
  1104. },
  1105. {
  1106. name: "dmm",
  1107. src: /pics\.dmm\.co\.jp/i,
  1108. r: "ps.jpg",
  1109. s: "pl.jpg"
  1110. },
  1111. {
  1112. name: "whd",
  1113. src: /\/w\/\d+\/h\/\d+($|\/|\?)/i,
  1114. r: /\/w\/\d+\/h\/\d+/i,
  1115. s: ""
  1116. },
  1117. {
  1118. name: "百度图片、贴吧等",
  1119. src: /(hiphotos|imgsrc)\.baidu\.com/i,
  1120. r: /(hiphotos|imgsrc)\.baidu\.com\/(.+?)\/.+?([0-9a-f]{40})/i,
  1121. s: "$1.baidu.com/$2/pic/item/$3"
  1122. },
  1123. {
  1124. name: "GoogleContent",
  1125. src: /\/w\/\d+\/h\/\d+($|\/|\?)/i,
  1126. getImage:function(){
  1127. var $ = /^((?:(?:lh|gp|yt)\d+\.g(?:oogleuserconten|gph)|\d\.bp\.blogspo)t\.com\/)(?:([_-](?:[\w\-]{11}\/){4})[^\/]+(\/[^?#]+)?|([^=]+)).*/i.exec(this.src);
  1128. var newsrc= $ ? ('http://' + $[1] + ($[4] ? $[4] + '=' : $[2]) + 's2634' + ($[3] || '')) : '';
  1129. if(newsrc!=this.src)return newsrc;
  1130. }
  1131. },
  1132. {
  1133. name: "pixiv",
  1134. src: /pixiv\.net/i,
  1135. r: /(pixiv.net\/img\d+\/img\/.+\/\d+)_[ms]\.(\w{2,5})$/i,
  1136. s: "$1.$2"
  1137. },
  1138. {
  1139. name: "douban",
  1140. url: /douban\.com/i,
  1141. getImage:function(){
  1142. var $ = /(img\d+\.douban\.com\/)(?:(view\/)(?:photo|movie_poster_cover)\/(?!large)[^\/]+|(icon\/u(?=\d))|[sm](?=pic\/))(.*)/i.exec(this.src);
  1143. var newsrc= $ ? ('http://' + $[1] + ($[2] ? $[2] + 'photo/photo' : (($[3]||'') + 'l')) + $[4]) : '';
  1144. if(newsrc!=this.src)return newsrc;
  1145. }
  1146. },
  1147. {
  1148. name: "taobaocdn",
  1149. src: /(taobaocdn|alicdn)\.com/i,
  1150. r: [/.*((?:img\d\d\.taobaocdn|img(?:[^.]*\.?){1,2}?\.alicdn)\.com\/)(?:img\/|tps\/http:\/\/img\d\d+\.taobaocdn\.com\/)?((?:imgextra|bao\/uploaded)\/.+\.(?:jpe?g|png|gif|bmp))_.+\.jpg$/i,
  1151. /(.*\.alicdn\.com\/.*?)((.jpg|.png)(\.|_)\d+x\d+.*)\.jpg(_\.webp)?$/i,
  1152. /(.*\.alicdn\.com\/.*?)((\.|_)\d+x\d+.*|\.search|\.summ)\.jpg(_\.webp)?$/i],
  1153. s: ["http://$1$2",
  1154. "$1$3",
  1155. "$1.jpg"]
  1156. },
  1157. {
  1158. name: "taobao",
  1159. url: /item\.taobao\.com/i,
  1160. r: [/.*((?:img\d\d\.taobaocdn|img(?:[^.]*\.?){1,2}?\.alicdn)\.com\/)(?:img\/|tps\/http:\/\/img\d\d+\.taobaocdn\.com\/)?((?:imgextra|bao\/uploaded)\/.+\.(?:jpe?g|png|gif|bmp))_.+\.jpg$/i,
  1161. /(.*\.alicdn\.com\/.*?)((.jpg|.png)(\.|_)\d+x\d+.*)\.jpg(_\.webp)?$/i,
  1162. /(.*\.alicdn\.com\/.*?)((\.|_)\d+x\d+.*|\.search|\.summ)\.jpg(_\.webp)?$/i],
  1163. s: ["http://$1$2",
  1164. "$1$3",
  1165. "$1.jpg"],
  1166. getExtSrc:function(){
  1167. if(this.tagName=='A' && this.style.background){
  1168. return this.style.background.replace(/.*url\(['"](https?:)?(.*)['"]\).*/,"https:$2").replace(/_\d+x\d+\.\w+$/,"")
  1169. }
  1170. }
  1171. },
  1172. {
  1173. name: "yihaodianimg",
  1174. url: /yhd\.com/i,
  1175. src: /yihaodianimg\.com/i,
  1176. r: /(.*\.yihaodianimg\.com\/.*)_\d+x\d+\.jpg$/i,
  1177. s: "$1.jpg"
  1178. },
  1179. {
  1180. name: "jd",
  1181. url: /jd\.com/i,
  1182. src: /360buyimg\.com/i,
  1183. r: [/(.*360buyimg\.com\/)n\d\/.+?\_(.*)/i,
  1184. /(.*360buyimg\.com\/)n\d\/(.*)/i,
  1185. /(.*360buyimg\.com\/.*)s\d+x\d+_(.*)/i],
  1186. s: ["$1imgzone/$2","$1n0/$2","$1$2"]
  1187. },
  1188. {
  1189. name: "dangdang",
  1190. url: /dangdang\.com/i,
  1191. src: /ddimg\.cn/i,
  1192. r: /(.*ddimg.cn\/.*?)_[bw]_(\d+\.jpg$)/i,
  1193. s: "$1_e_$2"
  1194. },
  1195. {
  1196. name: "duokan",
  1197. url: /duokan\.com/i,
  1198. r: /(cover.read.duokan.com.*?\.jpg)!\w+$/i,
  1199. s: "$1"
  1200. },
  1201. {
  1202. name: "yyets",
  1203. url: /yyets\.com/i,
  1204. r: /^(res\.yyets\.com.*?\/ftp\/(?:attachment\/)?\d+\/\d+)\/[ms]_(.*)/i,
  1205. s: "http://$1/$2"
  1206. },
  1207. {
  1208. name: "mozilla",
  1209. url: /addons\.mozilla\.org/i,
  1210. r: "addons.cdn.mozilla.net/user-media/previews/thumbs/",
  1211. s: "/thumbs/full/"
  1212. },
  1213. {
  1214. name: "firefox",
  1215. url: /firefox\.net\.cn/i,
  1216. r: "www.firefox.net.cn/attachment/thumb/",
  1217. s: "www.firefox.net.cn/attachment/"
  1218. },
  1219. {
  1220. name: "crsky",
  1221. url: /\.crsky\.com/i,
  1222. r: /pic\.crsky\.com.*_s\.gif$/i,
  1223. s: "/_s././",
  1224. example: "http://www.crsky.com/soft/5357.html"
  1225. },
  1226. {
  1227. name: "zol",
  1228. url: /\.zol\.com/i,
  1229. r: /(\w+\.zol-img\.com\.cn\/product\/\d+)_\d+x\d+\/(.*\.jpg)/i,
  1230. s: "$1/$2",
  1231. example: "http://detail.zol.com.cn/240/239857/pic.shtml"
  1232. },
  1233. {
  1234. name: "yesky",
  1235. url: /\.yesky\.com/i,
  1236. r: /_\d+x\d+\.([a-z]+)$/i,
  1237. s: ".$1",
  1238. example: "http://game.yesky.com/tupian/165/37968665.shtml"
  1239. },
  1240. {
  1241. name:"巴哈姆特",
  1242. url:/^https:\/\/\w+\.gamer\.com\.tw/,
  1243. src: /bahamut\.com\.tw/,
  1244. r: "/S/",
  1245. s: "/B/"
  1246. },
  1247. {
  1248. name: "sgamer",
  1249. url: /\.sgamer\.com/i,
  1250. r: /\/s([^\.\/]+\.[a-z]+$)/i,
  1251. s: "/$1",
  1252. example: "http://dota2.sgamer.com/albums/201407/8263_330866.html"
  1253. },
  1254. {
  1255. name: "nhentai",
  1256. url: /nhentai\./i,
  1257. r: [/(cdn\..*\d+)t(\.[a-z]+)$/, /\/\/\w+(\..*\/)(\d+)t(\.[a-z]+)$/i],
  1258. s: ["$1$2","//i$1$2$3"],
  1259. example: "http://nhentai.net/g/113475/"
  1260. },
  1261. {
  1262. name: "GithubAvatars",
  1263. url: /github\.com/i,
  1264. r: /(avatars\d*\.githubusercontent\.com.*)\?.*$/i,
  1265. s: "$1",
  1266. example: "https://avatars2.githubusercontent.com/u/3233275/"
  1267. },
  1268. {
  1269. name: "ggpht",
  1270. src: /ggpht\.com/i,
  1271. r: /=s\d+.*/i,
  1272. s: "=s9999"
  1273. },
  1274. {
  1275. name: "kodansha",
  1276. url: /kodansha\.co\.jp/i,
  1277. src: /kodansha\.co\.jp/i,
  1278. r: 't_og_image_center',
  1279. s: 'c_limit'
  1280. },
  1281. {
  1282. name: "fanseven",
  1283. url: /fanseven\.com/i,
  1284. src: /fanseven\.com/i,
  1285. r: /w=\d+&h=\d+/i,
  1286. s: 'w=9999&h=9999'
  1287. },
  1288. {
  1289. name: "appstore",
  1290. url: /^https:\/\/apps\.apple\.com\//i,
  1291. getImage:function(){
  1292. if(this.parentNode.nodeName=="PICTURE"){
  1293. let source=this.parentNode.querySelector("source:last-of-type");
  1294. let maxSize=0;
  1295. let result="";
  1296. source.srcset.split(", ").forEach(srcset=>{
  1297. let srcArr=srcset.split(" ");
  1298. let curSize=parseInt(srcArr[1]);
  1299. if(curSize>maxSize){
  1300. maxSize=curSize;
  1301. result=srcArr[0];
  1302. }
  1303. });
  1304. return result;
  1305. }
  1306. return null;
  1307. }
  1308. },
  1309. {
  1310. name:"coomer.party & kemono.party",
  1311. url:/^https:\/\/(coomer|kemono)\.party\/.*\/post\//,
  1312. getImage:function(a){
  1313. if(a) return a.href;
  1314. }
  1315. },
  1316. {
  1317. name:"instagram",
  1318. url:/^https?:\/\/[^.]+\.instagram\.com/i,
  1319. ext: function(target) {
  1320. if(target && target.previousElementSibling){
  1321. let imgs=target.previousElementSibling.querySelectorAll("img");
  1322. if(imgs && imgs.length==1)return imgs[0];
  1323. }else if(target.tagName=='UL' && target.parentNode && target.parentNode.parentNode && target.parentNode.parentNode.tagName=='A'){
  1324. return target.parentNode.parentNode.querySelector('img');
  1325. }
  1326. },
  1327. xhr: {
  1328. url: function(a, p) {
  1329. if (!a) return;
  1330. const re = /\/(p|reel)\/([^/]{1,})/
  1331. const m = a.href.match(re);
  1332. if (m && a.querySelector('svg')) {
  1333. const shortcode = m[2];
  1334. const lower = 'abcdefghijklmnopqrstuvwxyz';
  1335. const upper = lower.toUpperCase();
  1336. const numbers = '0123456789';
  1337. const ig_alphabet = upper + lower + numbers + '-_';
  1338. const o = shortcode.replace(/\S/g, m => (ig_alphabet.indexOf(m) >>> 0).toString(2).padStart(6, '0'));
  1339. let mediaId = BigInt('0b' + o).toString(10);
  1340. return `https://www.instagram.com/api/v1/media/${mediaId}/info/`;
  1341. }
  1342. },
  1343. headers: {"X-IG-App-ID":"936619743392459"},
  1344. cacheNum: 20,
  1345. query: function(html) {
  1346. try {
  1347. const o = JSON.parse(html);
  1348. const items0 = o.items[0];
  1349. const videos = items0.video_versions;
  1350. const images = items0.image_versions2;
  1351. const carousel = items0.carousel_media;
  1352. if (videos) {
  1353. const videoUrl = videos[0].url + '.video';
  1354. let videoAudioSubtitlesUrl = videoUrl;
  1355. const caption = (items0.caption ? items0.caption.text : (items0.accessibility_caption ? items0.accessibility_caption : items0.user.full_name));
  1356. return {url: [videoUrl], cap: caption};
  1357. } else if (carousel) {
  1358. let gallery = [];
  1359. const caption = (items0.caption ? items0.caption.text : (items0.accessibility_caption ? items0.accessibility_caption : items0.user.full_name));
  1360. carousel.map(c => { gallery.push(c.video_versions ? c.video_versions[0].url : c.image_versions2.candidates[0].url); });
  1361. return {url: gallery, cap: caption};
  1362. } else if (images) {
  1363. const imagesUrl = images.candidates[0].url;
  1364. return imagesUrl;
  1365. }
  1366. } catch { }
  1367. }
  1368. }
  1369. },
  1370. {
  1371. name: "hentai-cosplays",
  1372. url: /^https:\/\/(.*\.)?(hentai\-cosplays|porn\-images\-xxx)\.com/,
  1373. r: /\/p=[\dx]+(\/\d+\.\w+)$/i,
  1374. s: '$1'
  1375. },
  1376. {
  1377. name:"beta.kemono.party",
  1378. url:/^https:\/\/(\w+\.)?kemono\.party\/.*\/post\//,
  1379. getImage:function(a){
  1380. if(a) return a.href;
  1381. }
  1382. },
  1383. {
  1384. name:"imdb",
  1385. url:/^https?:\/\/www\.imdb\.com/,
  1386. src: /media\-amazon/,
  1387. r: /@.*(\.\w)/i,
  1388. s: '@$1'
  1389. },
  1390. {
  1391. name:"nsfw.xxx",
  1392. url:/^https?:\/\/nsfw\.xxx/,
  1393. src: /thumbnails/,
  1394. xhr: {
  1395. url: function(a,p) {
  1396. if (a && a.className==='slider_init_href' && a.href && !this.nextElementSibling) {
  1397. return a.href;
  1398. }
  1399. },
  1400. query: '.sh-section__image>img',
  1401. }
  1402. },
  1403. {
  1404. name: "雪球",
  1405. url: /^https?:\/\/xueqiu\.com\//,
  1406. src: /^https?:\/\/xqimg\.imedao\.com\//i,
  1407. r: /!\d+(x\d+[a-z]?)?\.\w+$/,
  1408. s: ''
  1409. },
  1410. {
  1411. name: "小众论坛",
  1412. url: /^https?:\/\/meta\.appinn\.net/,
  1413. src: /meta\-cdn/,
  1414. r: /\/optimized\/(.*)_\d+_\d+x\d+(\.\w+)$/,
  1415. s: "/original/$1$2"
  1416. },
  1417. {
  1418. name: "诱惑福利图",
  1419. url: /www\.yhflt\.com/,
  1420. src: /imgs\.yhflt\.com/,
  1421. r: /imgs(\..*\/)q/,
  1422. s: "pic$1"
  1423. },
  1424. {
  1425. name: "Sankaku Complex",
  1426. url:/sankakucomplex\.com/,
  1427. src:/\/data\/preview\//,
  1428. xhr:{
  1429. url: "a",
  1430. query: "img#image"
  1431. }
  1432. },
  1433. {
  1434. name:"极简壁纸",
  1435. url:/https:\/\/bz\.zzzmh\.cn\//i,
  1436. getImage: function(a,p){
  1437. if(p&&p[1]&&p[1].classList.contains("img-box")){
  1438. let saveEle=p[1].querySelector("a");
  1439. if(saveEle) return saveEle.href;
  1440. }
  1441. }
  1442. },
  1443. {
  1444. name: "blogger",
  1445. src: /blogger\.googleusercontent\.com\/img/,
  1446. r: /\/[sw]\d+\/.*/,
  1447. s: "/s0"
  1448. },
  1449. {
  1450. name: "煎蛋",
  1451. url: /^https:\/\/jandan\.net\//,
  1452. r: [/\/(thumb\d+|mw\d+)\//, /!square/],
  1453. s: ["/large/", ""]
  1454. },
  1455. {
  1456. name:"辉夜白兔",
  1457. url:/47\.101\.137\.235/,
  1458. r:"thumb",
  1459. s:"regular"
  1460. },
  1461. {
  1462. name: "Civitai",
  1463. url: /^https:\/\/civitai\.com\//,
  1464. r: /\/width=\d+\//,
  1465. s: "/"
  1466. },
  1467. {
  1468. name: "網易雲音樂",
  1469. url: /^https:\/\/music\.163\.com\//,
  1470. getExtSrc:function() {
  1471. if (this.tagName === 'A' && this.className === "msk") {
  1472. return this.previousElementSibling.src.replace(/\?param=\d+y\d+/, "");
  1473. }
  1474. },
  1475. r: /\?param=\d+y\d+/,
  1476. s: ""
  1477. },
  1478. {
  1479. name: "Dlsite",
  1480. src: /^https:\/\/img\.dlsite\.jp\//,
  1481. r: /\/resize\/(.*)_\d+x\d+/,
  1482. s: "/modpub/$1"
  1483. },
  1484. {
  1485. name: "postype",
  1486. url: /^https:\/\/www\.postype\.com\//,
  1487. r: [/\/resize(\/.*\/)\d+x\d+x\d+\/\w+?\//, /\?w=.*/],
  1488. s: ["$1", ""]
  1489. },
  1490. {
  1491. name: "piccoma jp",
  1492. url: /^https:\/\/piccoma\.com\//,
  1493. r: [/(thumbnail|cover)_x\d/, /x\d$/],
  1494. s: ["cover_x3", "x3"],
  1495. getExtSrc: function() {
  1496. if (this.children[0] && this.children[0].nodeName === "IMG") {
  1497. return this.children[0].src.replace(/(thumbnail|cover)_x\d/, "cover_x3").replace(/x\d$/, "x3");
  1498. }
  1499. }
  1500. },
  1501. {
  1502. name: "bunkr",
  1503. url: /bunkr\.si/,
  1504. r: /\/thumbs(\/.*)png/,
  1505. s: "$1jpg"
  1506. },
  1507. {
  1508. name:"vk",
  1509. url:/vk\.com/,
  1510. xhr:{
  1511. url: function() {
  1512. if (this.classList.contains("photos_row")) {
  1513. return this.firstElementChild && this.firstElementChild.href;
  1514. }
  1515. },
  1516. query: function(html, doc) {
  1517. let r = doc.querySelector('meta[name="og:image"]');
  1518. if (!r) return;
  1519. r = r.getAttribute("value");
  1520. if (!r) return;
  1521. r = r.match(/\/([\w\-]+)\.(jpg|png)/);
  1522. if (!r) return;
  1523. r = r[1];
  1524. r = html.match(new RegExp(`"z_src":"([^"]*?${r}[^"]*?)","z_"`));
  1525. return r && r[1];
  1526. }
  1527. }
  1528. },
  1529. {
  1530. name: "sspai",
  1531. url: /^https?:\/\/sspai\.com\//,
  1532. r: /\?imageMogr.*/,
  1533. s: ""
  1534. },
  1535. {
  1536. name: "la-croix",
  1537. url: /^https?:\/\/www\.la\-croix\.com\//,
  1538. r: /\/\d+x\d+\//,
  1539. s: "/x/"
  1540. },
  1541. {
  1542. name:"e-hentai",
  1543. url:/^https?:\/\/(e\-|ex)hentai\.org\//i,
  1544. xhr: {
  1545. url: function(a, p) {
  1546. if (!a || !/blank\.gif$/.test(this.src)) return;
  1547. const re = /\/s\//i;
  1548. const m = a.href.match(re);
  1549. return m && a.href;
  1550. },
  1551. query: function(html, doc) {
  1552. let img = doc.querySelector("#img");
  1553. return img && img.src;
  1554. }
  1555. }
  1556. },
  1557. {
  1558. name:"turboimagehost",
  1559. url:/^https?:\/\/www\.turboimagehost\.com\//i,
  1560. xhr: {
  1561. url: ".bbc_link",
  1562. query: "#imageid"
  1563. }
  1564. },
  1565. {
  1566. name:"freepik",
  1567. url:/^https?:\/\/www\.freepik\.com\//i,
  1568. xhr: {
  1569. url: ".showcase__link",
  1570. query: "img[fetchpriority]"
  1571. }
  1572. },
  1573. {
  1574. name: "imgtraffic",
  1575. r: /^(https:\/\/imgtraffic\.com\/\d+)s\//,
  1576. s: "$1/"
  1577. },
  1578. {
  1579. name: "dailymail",
  1580. url: /^https:\/\/(www\.)?dailymail\.co\.uk\//i,
  1581. xhr: {
  1582. url: "a[href*='/article']",
  1583. query: "video,img.img-share,[data-testid='image-component']>img"
  1584. }
  1585. },
  1586. {
  1587. name: "zerochan",
  1588. url: /^https:\/\/(www\.)?zerochan\.net\//i,
  1589. xhr: {
  1590. url: "a.thumb",
  1591. query: "#large>a.preview"
  1592. }
  1593. },
  1594. {
  1595. name: "rutracker",
  1596. url: /^https:\/\/rutracker\.net\//i,
  1597. getImage: function(a) {
  1598. if (a && /fastpic\.ru/.test(a.href)) {
  1599. let matched = a.href.match(/\.(\w+)\.html(&|$)/);
  1600. return matched && this.src.replace("/thumb/", "/big/").replace(/\w+(\?.*|$)/, matched[1]);
  1601. }
  1602. }
  1603. },
  1604. {
  1605. name: "rule34.paheal",
  1606. url: /^https:\/\/rule34\.paheal\.net\//,
  1607. getImage: function(a, p) {
  1608. let result = this.src.match(/.*\/_thumbs\/((..)(..).*)\//);
  1609. if (result) {
  1610. result = `https://r34i.paheal-cdn.net/${result[2]}/${result[3]}/${result[1]}`;
  1611. if (p[1] && p[1].dataset.ext === "mp4") result = "video:" + result;
  1612. return result;
  1613. }
  1614. }
  1615. },
  1616. {
  1617. name: "amazon",
  1618. url: /^https?:\/\/www\.amazon\./,
  1619. lazyAttr: "data-a-hires",
  1620. r: [/_?(_AC_|_CR0).*\./, /\._S.\d+\_?/],
  1621. s: ["", ""]
  1622. },
  1623. {
  1624. name: "hentaigifz",
  1625. url: /^https:\/\/hentaigifz\.com/,
  1626. r: /-thumbnail.*/,
  1627. s: ".gif"
  1628. },
  1629. {
  1630. name: "Bangumi",
  1631. url: /^https:\/\/bgm\.tv\//,
  1632. r: ["/c/","/m/"],
  1633. s: "/l/"
  1634. },
  1635. {
  1636. name: "porngifmag",
  1637. url: /^https:\/\/porngifmag\.com/,
  1638. xhr: {
  1639. url: ".thumb-image>a",
  1640. query: ".single-image>img"
  1641. }
  1642. },
  1643. {
  1644. name: "behance",
  1645. url: /^https:\/\/www\.behance\.net/,
  1646. xhr: {
  1647. url: "a[href^='/gallery/']",
  1648. query: "img[class^='ImageElement-image']"
  1649. },
  1650. getExtSrc: function() {
  1651. if (this.className && this.className.indexOf && this.className.indexOf("ProjectCoverNeue-link") !== -1) {
  1652. let img = this.parentNode.parentNode.querySelector("picture>img");
  1653. if (img) return img.src;
  1654. }
  1655. }
  1656. },
  1657. {
  1658. name: "postimg host",
  1659. src: /^https:\/\/i\.postimg\.cc/,
  1660. xhr: {
  1661. url: "a[href^='https://postimg.cc/']",
  1662. query: "#main-image"
  1663. }
  1664. },
  1665. {
  1666. name: "postimg",
  1667. url: /^https:\/\/postimg\.cc/,
  1668. xhr: {
  1669. url: ".thumb>a",
  1670. query: "#main-image"
  1671. }
  1672. },
  1673. {
  1674. name: "imagebam",
  1675. src: /^https:\/\/thumbs\d*\.imagebam\.com\//,
  1676. xhr: {
  1677. url: function(a, p) {
  1678. let imageId = this.src.match(/\/(\w+)\_\w\./);
  1679. if (!imageId) return null;
  1680. return `https://www.imagebam.com/view/${imageId[1]}`;
  1681. },
  1682. query: ".main-image"
  1683. }
  1684. },
  1685. {
  1686. name: "MAL Anime/Manga Search",
  1687. url: /^https:\/\/myanimelist\.net\/(anime|manga)\.php\?cat=(anime|manga).+/,
  1688. src: /^https:\/\/cdn\.myanimelist\.net/,
  1689. r: /\/r\/(\d+x\d+)(\/images\/(anime|manga)\/\d+\/\d+)\.webp.+/,
  1690. s: "$2l.jpg"
  1691. },
  1692. {
  1693. name: "afdiancdn",
  1694. url: /^https:\/\/afdian\.net\//,
  1695. r: "/(w/\\d+/)?h/\\d+/i",
  1696. s: ""
  1697. },
  1698. {
  1699. name: "携程",
  1700. url: /^https:\/\/(www\.|m\.)?ctrip\.com/,
  1701. r: /_(C|D)_\d[^\.]*/i,
  1702. s: ""
  1703. }
  1704. ];