-
-
Notifications
You must be signed in to change notification settings - Fork 526
/
Copy pathpvcep_rules.js
1704 lines (1696 loc) · 56.4 KB
/
pvcep_rules.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
PVCEP - Rules for Picviewer CE+
<https://github.com/hoothin/UserScripts/blob/master/Picviewer%20CE%2B/pvcep_rules.js>
(c) 2021-2024 Hoothin <rixixi [at] gmail.com>
Licenced under the MIT license.
minimum
{
name: site name
r: regular image url or string to be replaced
s: replacement target string
}
or
{
name: site name
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
}
Other parameter items can be added as needed.
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.
xhr is used to obtain the attributes of the pictures on the inner pages.
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.
2. And get pictures through xhr.
2.1 xhr.query is the picture (you can For multiple, multiple will be added to the gallery) selector or function
2.2 xhr.caption is the description of picture
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
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.
getExtSrc is the method for directly obtaining the image URL based on a non-image element.
*/
var siteInfo = [
{
name: "google 图片搜索",
//網址例子 ( 方便測試和查看 )
example: "http://www.google.com.hk/search?q=firefox&tbm=isch",
//是否啟用
enabled: true,
//站點正則,匹配站點url該條規則才會生效
url: /https?:\/\/www.google(\.\w{1,3}){1,3}\/search\?.*&(tbm=isch|udm=2)/,
//鼠標點擊直接打開(僅當高級規則的getImage()或者r/s替換有返回值的時候生效)
clickToOpen: {
enabled: false,
preventDefault: true,//是否嘗試阻止點擊的默認行為(比如如果是你點的是一個鏈接,默認行為是打開這個鏈接,如果是true,js會嘗試阻止鏈接的打開(如果想臨時打開這個鏈接,請使用右鍵的打開命令))
button: 0,//0:鼠標左鍵 1:滾輪按鈕或中間按鈕(如果有) 2:鼠標右鍵。默認為 0
alt: false,//是否需要按下alt鍵
ctrl: false,//是否需要按下ctrl鍵
shift: false,//是否需要按下shift鍵
meta: false,//是否需要按下meta鍵
type: 'actual',//默認的打開方式: 'actual'(彈出,原始圖片) 'magnifier'(放大鏡) 'current'(彈出,當前圖片)
},
getImage: function(a) {
//獲取圖片實際地址的處理函數,
//this 為當前鼠標懸浮圖片的引用,
//第一個參數為當前圖片的父元素中第一個a元素(可能不存在)
//第二個參數為保存當前圖片所有父元素的數組
if(!a) return;
let jsaction = a.getAttribute("jsaction");
if (a.href.match(/imgurl=(.*?)&/i)) {
return decodeURIComponent(RegExp.$1);
} else if (jsaction && jsaction.indexOf('touchstart') !== -1) {
const touchList = [new Touch({
identifier: 1,
target: document.documentElement,
clientX: 0,
clientY: 0
})];
var fakeEvent = new TouchEvent('touchstart', {bubbles: true, touches: touchList});
a.dispatchEvent(fakeEvent);
fakeEvent = new TouchEvent('touchend', {bubbles: true});
a.dispatchEvent(fakeEvent);
if (a.href.match(/imgurl=(.*?)&/i)) {
return decodeURIComponent(RegExp.$1);
}
}
}
// 自定義樣式
// css: '',
// 如果圖片藏在非img標籤後面,使用此項獲取被遮擋的img元素。
// 其中previous代表前面一個元素,previous-2代表前面第二個元素,next代表後面一個元素。
// 或者直接用函數獲取,傳入當前元素,返回查找到的元素或是null。
// ext: 'previous-2',
// 排除的圖片正則
// exclude: /weixin_code\.png$/i,
// 需要替換的圖片正則,匹配上圖片url該條規則才生效
// src: /avatar/i,
// 正則或字符串檢測內容,可以為含有多組規則的數組,若為字符串則只進行字符串替換
// r: /\?.*$/i,
// 正則或字符串替換內容,可以與上一條一一對應,也可以以數組對應檢測正則的其中一條,比如希望有多個結果嘗試顯示原圖
// s: ''
},
{
name: "123rf",
url: /123rf\.com/,
r: /us\.123rf\.com\/\d+wm\//i,
s: "previews.123rf.com/images/"
},
{
name: "126",
src: /\.126\.net/i,
r: /\/\d+\.\d+x\d+\.\d+\.([^\.]+)$/i,
s: '/5.5000x5000.100.$1'
},
{
name:"178.com",
enabled:true,
url:/^https?:\/\/(?:\w+\.)+178\.com\//i,
clickToOpen:{
enabled:true,
preventDefault:true,
type:'actual',
},
getImage:function(a){
if(!a)return;
var reg=/^https?:\/\/(?:\w+\.)+178\.com\/.+?(https?:\/\/img\d*.178.com\/[^.]+\.(?:jpg|jpeg|png|gif|bmp))/i;
return (a.href.match(reg) || [])[1];
}
},
{
name: "24meitu",
url: /24meitu\.com|25meinv\.com|aisimeinv\.com|24tupian\.com|24meinv\.|24mntp\.|24cos\.|24fh\.|24shipin\.|24mn\./,
r: [/\/m([^\/]+)$/i,
/imgs\./i],
s: ["/$1","bimg."]
},
{
name: "bing 图片搜索",
example:"http://cn.bing.com/images/search?q=%E7%BE%8E%E5%A5%B3",
enabled:true,
url: /^https?:\/\/[^.]*\.bing\.com\/images\//i,
getImage:function(a){
if (!a) return;
var oldsrc=this.src;
var $ = /,imgurl:"([^"]+)/.exec(a.getAttribute('m'));
var newsrc= $ ? $[1] : '';
if(newsrc!=oldsrc)return newsrc;
}
},
{
name:"百度贴吧",
enabled:true,
url:/^https?:\/\/tieba\.baidu\.[^\/]+\//i,
r: [/\/sys\/portrait/i,
/^(http:\/\/tiebapic\.baidu\.com\/forum\/)ab(pic\/item\/[\w.]+)/i],
s: ["/sys/portraitl", "$1$2"],
getImage: function(a, p) {
let bsrc = this.getAttribute('bpic');
return bsrc || null;
},
xhr: {
url: function(a, p) {
if (!this.src) return null;
let pid = this.src.match(/\.baidu\.com\/forum\/w.*\/(\w+)\./);
if (!pid) return null;
pid = pid[1];
let tid = 0;
let tidm = location.href.match(/\/p\/(\d+)/);
if (tidm) tid = tidm[1];
if (tid) {
let kw = document.querySelector(`#wd2`);
if (kw && kw.value) {
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`;
}
}
return null;
},
query: function(html, doc, url) {
let data = JSON.parse(html);
if (!data) return null;
let pid = url.match(/&pic_id=(\w+)/)[1];
for (let key in data.data.pic_list) {
let pic = data.data.pic_list[key];
if (pic.img.screen.id == pid) return pic.img.screen.waterurl;
}
return null;
}
}
},
{
name: "百度图片搜索",
example: "http://image.baidu.com/i?ie=utf-8&word=%E9%A3%8E%E6%99%AF&oq=%E9%A3%8E%E6%99",
enabled: true,
url: /^https?:\/\/image\.baidu\.com\/.*&word=/i,
getImage: function(a) {
if (!a) return;
var reg = /&objurl=(http.*?\.(?:jpg|jpeg|png|gif|bmp))/i;
if (a.href.match(reg)) {
return decodeURIComponent(RegExp.$1);
}
}
},
{
name:"豆瓣",
example:"http://movie.douban.com/photos/photo/1000656155/",
enabled: true,
url:/^https?:\/\/[^.]*\.douban\.com/i,
getImage:function(){
var oldsrc = this.src,
newsrc = oldsrc;
var pic = /\/view\/photo\/(?:photo|albumcover|albumicon|thumb|sqxs)\/public\//i;
var movieCover = /\/view\/movie_poster_cover\/[si]pst\/public\//i;
var bookCover = /\/view\/ark_article_cover\/cut\/public\//i;
var spic = /(img\d+.douban.com)\/[sm]pic\//i;
var ratio = /s_ratio_poster/i;
if(/\/subject\/\d+\/discussion/.test(location.href)){
} else if (pic.test(oldsrc)) {
newsrc = oldsrc.replace(pic, '/view/photo/raw/public/');
} else if (movieCover.test(oldsrc)) {
newsrc = oldsrc.replace(movieCover, '/view/photo/raw/public/');
} else if (bookCover.test(oldsrc)) {
newsrc = oldsrc.replace(bookCover, '/view/ark_article_cover/retina/public/');
} else if (spic.test(oldsrc)) {
newsrc = oldsrc.replace(spic, '$1/lpic/');
} else if (ratio.test(oldsrc)) {
newsrc = oldsrc.replace(ratio, 'l');
}
return newsrc == oldsrc ? null : [newsrc,newsrc.replace(/photo\/raw/,"photo/photo")];
}
},
{
name:"bilibili",
enabled:true,
url:/^https?:\/\/[^.]+\.bilibili.com/i,
r: /\d+_\d+\/|\d+_x\d+\.jpg$|@\d+w_\d+h.*\.webp$|_\d+x\d+\.jpg$/i,
s: ""
},
/*{
name: "deviantart",
example: "http://www.deviantart.com",
enabled:true,
url:/^https?:\/\/[^.]*\.deviantart\.com/i,
getImage:function(a, p){
let id,self=this;
if(p[1] && p[1].dataset.hook=="deviation_link"){
id=p[1].href.replace(/.*?(\d+)$/,"$1");
}else if(p[2] && p[2].dataset.hook=="deviation_link"){
id=p[2].href.replace(/.*?(\d+)$/,"$1");
}
if(/\?token/.test(this.src)){
if(!this.dataset.pvsrc && id){
this.dataset.pvsrc="t";
GM_xmlhttpRequest({
method: 'get',
responseType: "json",
url: '/_napi/shared_api/deviation/extended_fetch?deviationid='+id+'&type=art&include_session=false',
onload: function(d) {
var media = (d.response && d.response.deviation)?d.response.deviation.media:null;
var fullview = media && media.types && media.types.find(t=>{return t.t=='fullview'});
if(media && media.baseUri && fullview && media.token){
var resultUrl=media.baseUri+(fullview.c?fullview.c.replace("<prettyName>",media.prettyName).replace(/,q_\d+/,",q_100"):"")+"?token="+media.token[0];
self.dataset.pvsrc=resultUrl;
if(floatBar){
floatBar.update(self, self.dataset.pvsrc);
}
}
}
});
}else if(this.dataset.pvsrc!="t" && id){
return this.dataset.pvsrc;
}
}
return null;
},
},
{
name:"deviantart",
url:/^https?:\/\/[^.]*\.deviantart\.com/i,
xhr: {
url: 'a[data-hook = "deviation_link"]',
query: '[property="contentUrl"]'
}
},*/
{
name:"deviantart",
url:/^https?:\/\/[^.]*\.deviantart\.com/i,
getImage: function(a, p) {
if (!a) return;
let media =Object.keys(a).filter(prop => prop.indexOf("__reactProps") === 0);
if (!media || !a[media] || !a[media].children || !a[media].children.props || !a[media].children.props.deviation) return;
media = a[media].children.props.deviation.media;
let fullview = media.types.filter(d => d.t === "fullview");
let ext = media.baseUri.match(/\.\w+$/);
if (!fullview || !ext) return;
fullview = fullview[0];
ext = ext[0];
return media.baseUri + `/v1/fill/w_${fullview.w},h_${fullview.h}/${media.prettyName}-fullview${ext}?token=` + media.token[0];
}
},
{
name: '花瓣网',
enabled: true,
url: /^https?:\/\/huaban\.com\//i,
ext: 'previous-2',
r: /(.*img.hb.aicdn.com\/.*)_fw(?:236|320)$/i,
s: '$1_fw658',
description: './../following-sibling::p[@class="description"]',
// css: '.pin a.img .cover { display: none; }',
exclude: /weixin_code\.png$/i,
},
{
name: "wikipedia",
enabled:true,
url:/^https?:\/\/.+\.wikipedia\.org\//i,
r: /(https?:\/\/.*)\/thumb(\/.*)\/\d+px-.*/i,
s: "$1$2"
},
{
name:"沪江碎碎",
enabled:true,
url:/^https?:\/\/([^.]+\.)*(?:yeshj\.com|hjenglish\.com|hujiang\.com)/i,
r: /^(https?:\/\/(?:[^.]+\.)*hjfile.cn\/.+)(_(?:s|m))(\.\w+)$/i,
s: '$1$3'
},
{
name: '大众点评',
example: 'http://www.dianping.com/shop/17873296/photos',
url: /^https?:\/\/www.dianping.com\/shop/i,
r: /(.+?dpfile\.com\/.+)\(240c180\)\/(thumb\..+)/i,
s: '$1(700x700)/$2'
},
{
name: 'trakt.tv',
url: /^http:\/\/trakt\.tv\//i,
example: 'http://trakt.tv/shows',
r: /(.*\/images\/posters\/\d+)-(?:300|138)\.jpg\?(\d+)$/i,
s: "$1.jpg?$2"
},
{
name: '网易云音乐',
url: 'https://music.163.com/*',
ext: 'previous',
getImage: function() {
var oldsrc = this.src;
if(this.data){
var newsrc = this.data('src');
if (oldsrc != newsrc) {
return newsrc;
}
}
if (oldsrc.match(/(.*)\?param=\d+y\d+/)) {
return RegExp.$1;
}
}
},
{
name: "美女薄情馆",
url: /^http:\/\/boqingguan\.com\//i,
example: 'http://boqingguan.com/Picture/31637',
lazyAttr: 'data-original',
getImage: function(a) {
var oldsrc = this.getAttribute('data-original') || this.src;
if (oldsrc) {
var newsrc = oldsrc.replace(/![a-z\d]+$/, '');
return newsrc == oldsrc ? '' : newsrc;
}
}
},
{
name:"极限主题社区",
enabled:true,
url:/^https?:\/\/bbs\.themex\.net\/.+/i,
clickToOpen:{
enabled:true,
preventDefault:true,
type:'actual',
},
r: /^(https?:\/\/bbs\.themex\.net\/attachment\.php\?.+)&thumb=1(.+)/i,
s: '$1$2'
},
{
name:"opera官方论坛",
example:"http://bbs.operachina.com",
enabled:true,
url:/^http:\/\/bbs\.operachina\.com/i,
src: /file.php\?id=\d+$/i,
r: /.*/,
s: "$1&mode=view"
},
{
name: 'github 修正',
url: /^https?:\/\/github\.com\//i,
clickToOpen: {
enabled: false,
preventDefault: true,
type: 'actual',
},
getImage: function(a) {
if (a && a.href.indexOf('/blob/master/') > 0) {
return this.src;
}
}
},
{
name: '优美图',
url: /http:\/\/(?:www\.)?topit\.me\//,
lazyAttr: 'data-original',
xhr: {
url: /topit\.me\/item\/\d+/,
query: ['a[download]', 'a#item-tip'],
}
},
{
name: '半次元',
url: /^https?:\/\/bcy\.net\//,
r: [/\/\dX\d$|\/w\d+$/i,
"/cover/",
/\/(middle|small)\.jpg/i],
s: ["", "/post/", "/big.jpg"]
},
{
name: 'Steampowered',
url: /\.steampowered\.com/,
r: /\.\d+x\d+\.jpg/i,
s: ".jpg"
},
{
name: 'Steamcommunity',
url: /steamcommunity\.com/,
r: /output\-quality=\d+&fit=inside\|\d+\:\d+/i,
s: "output-quality=100&fit=inside|0:0"
},
{
name: '知乎',
url: /(zhihu|zhimg)\.com/,
r: /_(b|xs|s|l|\d+(x\d+|w))\./i,
s: "."
},
{
name: '500px',
url: /500px\./,
r: [/\/w%3D\d+_h%3D\d+\/v2.*/i,
/^((?:(?: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+\\./],
s: ["/m%3D2048_k%3D1_of%3D1/v2",
"$12048.jpg"]
},
{
name: 'Nyaa',
url: /nyaa\.se/,
r: /upload\/small\//i,
s: "upload/big/"
},
{
name: "itunes",
url: /itunes\.apple\.com/,
r: /\d+x\d+bb\./i,
s: "1400x1400bb."
},
{
name: "汽车之家",
url: /\.autohome\.com\.cn/,
r: /(\?imageView.*|\d+x\d+_\d+_|f_m_|t_|s_)/i,
s: ""
},
{
name: "易车",
url: /\.bitauto\.com/,
r: /_\d+\.jpg$/i,
s: "_12.jpg"
},
{
name: "爱卡",
url: /\.xcar\.com\.cn/,
r: /\-\d+x\d+\.jpg/i,
s: ""
},
{
name: "太平洋汽车",
url: /\.pcauto\.com\.cn/,
r: /_\d+x\d+\.jpg$/i,
s: ".jpg"
},
{
name: "新浪汽车",
url: /\.auto\.sina\.com\.cn/,
r: /_\d+\.jpg$/i,
s: "_src.jpg"
},
{
name: "greasyfork",
url: /(greasyfork|sleazyfork)\.org/,
getImage: function() {
if(this.parentNode && this.parentNode.nodeName=="A" && /amazonaws\.com/.test(this.parentNode.href)){
return this.parentNode.href;
}
return this.src && this.src.replace(/\/thumb\//i,"/original/").replace(/\/thumbnails\//i,"/").replace(/(\/forum\/uploads\/userpics\/.*\/)n([^\/]+)$/,"$1p$2");
}
},
{
name: "dribbble",
url: /dribbble\.com/,
r: [/_teaser(.[^\.]+)$/i,
/_1x\./i,
/\?compress=.*/],
s: ["$1",".",""]
},
{
name: "百度百科",
url: /baike\.baidu\.com/,
r: [/.*bdstatic\.com.*\/([^\/]+)\.jpg/i,
/(.*bkimg\.cdn\.bcebos\.com.*\?x-bce-process=image).*/i],
s: ["http://imgsrc.baidu.com/baike/pic/item/$1.jpg",
"$1"]
},
{
name: "nvshens",
url: /nvshens\.com|onvshen\.com/,
r: /(\img\.onvshen\.com.*)(?:thumb\/|_s)(.*)/i,
s: "$1$2"
},
{
name: "Tumblr",
url: /tumblr\.com/,
exclude: /\/avatar_/i,
r: /[^\/]*(media\.tumblr\.com.*_)\d+(\.[^\.]+)$/i,
s: "$1raw$2"
},
{
name: "Tumblr",
url: /tumblr\.com/,
src: /\/avatar_/i,
r: /(media\.tumblr\.com.*_)[^_]+(\.[^\.]+)$/i,
s: "$1512$2"
},
{
name: "Acgget",
url: /acg18\.us|acgget\./,
r: /(pic\.acgget\.com\/thumb\/)w\d+_h\d+\//i,
s: "$1w9999_h9999/"
},
{
name: "Pixiv",
url: /pixiv\.net|pximg\.net/,
src: /pximg\.net\/c\/\d+x\d+/i,
r: /pximg\.net\/c\/\d+x\d+.*\/img\/(.*)_.*$/i,
s: ["pximg.net/img-original/img/$1.jpg","pximg.net/img-original/img/$1.png"]
},
{
name: "Wallhaven",
url: /wallhaven\./,
src: /wallpapers\/thumb\/small\/th|th\.wallhaven\.cc\/(small|lg)\//i,
r: [/wallpapers\/thumb\/small\/th(.*)\./i,
/th\.wallhaven\.cc\/(small|lg)\/(.*)?\/(.*)\..*/i],
s: [["wallpapers/full/wallhaven$1.jpg","wallpapers/full/wallhaven$1.png"],
["w.wallhaven.cc/full/$2/wallhaven-$3.jpg","w.wallhaven.cc/full/$2/wallhaven-$3.png"]],
getImage() {
let srcReg1 = /wallpapers\/thumb\/small\/th(.*)\./i;
let srcReg2 = /th\.wallhaven\.cc\/(small|lg)\/(.*)?\/(.*)\..*/i;
let res1 = "wallpapers/full/wallhaven$1.";
let res2 = "w.wallhaven.cc/full/$2/wallhaven-$3.";
let png, ne;
if (this.nextElementSibling && this.nextElementSibling.nextElementSibling) {
ne = this.nextElementSibling.nextElementSibling;
if (ne.className != "thumb-info") ne = null;
else png = !!ne.querySelector('.png');
}
if (srcReg1.test(this.src)) {
return ne ? this.src.replace(srcReg1, res1 + (png ? "png" : "jpg")) : [this.src.replace(srcReg1, res1 + "jpg"), this.src.replace(srcReg1, res1 + "png")];
}
if (srcReg2.test(this.src)) {
return ne ? this.src.replace(srcReg2, res2 + (png ? "png" : "jpg")) : [this.src.replace(srcReg2, res2 + "jpg"), this.src.replace(srcReg2, res2 + "png")];
}
}
},
{
name: "lofter",
url: /lofter\./,
getImage: function(a) {
if(a && a.href && a.hasAttribute("bigimgsrc")){
return a.getAttribute("bigimgsrc");
}
return this.src.replace(/\?.*/i,"");
}
},
{
name: "sohu",
url: /(sohu|sohucs)\.com/,
r: /(sohucs\.com\/).*\/(images\/|os\/)/i,
s: "$1$2"
},
{
name: "moegirl",
url: /(moegirl|mengniang)\.org/,
r: /(common)\/thumb(.*)\/[^\/]+/i,
s: "$1$2"
},
{
name: "fanfou",
url: /fanfou\.com/,
r: /@.+/i,
s: ""
},
{
name: "meitudata",
url: /meipai\.com/,
r: /!thumb.+/i,
s: ""
},
{
name: "mafengwo",
url: /mafengwo\.cn/,
r: /\?imageMogr.*/i,
s: ""
},
{
name: "discordapp",
url: /(discordapp\.|discord\.)(com|net)/,
r: [/\?width=\d+&height=\d+$/i, /.*\/external\/.*\/(https?)\/(.*)\?format.*/],
s: ["", "$1://$2"]
},
{
name: "推特",
url: /https:\/\/(www\.)?(x|twitter)\.com|pbs\.twimg\.com/,
description: ["./..", "aria-label"],
getImage: function(a, p){
let newsrc = this.src.replace("_normal.",".").replace("_200x200.",".").replace("_mini.",".").replace("_bigger.",".").replace(/_x\d+\./,".");
if (newsrc != this.src) return newsrc;
if (/\.svg$/.test(newsrc)) return;
newsrc=newsrc.replace(/\?format=/i, ".").replace(/\&name=/i, ":").replace(/\.(?=[^\.\/]*$)/, "?format=").replace( /(:large|:medium|:small|:orig|:thumb|:[\dx]+)/i, "");
if (newsrc != this.src) {
if (a && a.role == 'link') {
let match = a.href.match(/\/([^\/]+)\/status\/([^\/]+)\/photo\/(\d+)/);
if (match) {
let time = p[14] && p[14].querySelector('time');
if (time) {
this.alt = match[1] + " - " + time.innerText + "_" + match[3];
}
}
}
return newsrc+"&name=orig";
}
},
ext: function(target) {
if(target.parentNode && target.parentNode.previousElementSibling){
let imgs=target.parentNode.previousElementSibling.querySelectorAll("img");
if(imgs.length==1)return imgs[0];
}
return null;
}
},
{
name: "Fandom",
url: /fandom\.com/,
r: [/scale\-to\-width\-down\/\d+/i,
/smart\/width\/\d+\/height\/\d+/i],
s: ["",""]
},
{
name: "yande",
url: /yande\.re|konachan\.(net|com)/,
getImage: function(a, p) {
if(p[1] && p[1].nextSibling && p[1].nextSibling.classList &&
p[1].nextSibling.classList.contains("largeimg")){
return p[1].nextSibling.href.replace(/\/(preview|jpeg|sample)\/(.*\.)jpg$/, "/image/$2png");
}
return this.src.replace(/\/(preview|jpeg|sample)\/(.*\.)jpg$/, "/image/$2png");
}
},
{
name:"绅士漫画",
url:/^https?:\/\/(www\.)?wnacg\./,
src: /\/\/t(\w\.qy.*data\/)t\//,
r: /\/\/t(\w\.qy.*data\/)t\//,
s: "//img$1",
xhr: {
url: function(a, p) {
if (p && p[1] && p[1].className === 'pic_box tb' && a && a.href) {
return a.href;
}
},
query: '#picarea'
}
},
{
name:"xlysauc",
url:/^https?:\/\/xlysauc\.com\//,
r: /\/x\/(\d+\.jpg)/,
s: "/d/$1",
ext: function(target) {
if (target.parentNode.className === 'imgbg' || target.className === 'pp_hoverContainer'){
let img = target.parentNode.querySelector("img");
if (img) return img;
}
return null;
}
},
{
name: "E621",
url: /e621\.net/,
getImage: function(a, p) {
if(p[2] && p[2].dataset.fileUrl){
return p[2].dataset.fileUrl;
}
return this.src;
}
},
{
name: "Pinterest",
url: /pinterest\.com/,
getImage: function(a, p) {
if(this.srcset){
var srcs=this.srcset.split(","),minSize=0,newSrc;
srcs.forEach(srci=>{
let srcInfo=srci.trim().split(" "),curSize=parseInt(srcInfo[1]);
if(srcInfo[1] && (curSize>minSize || minSize==0)){
minSize=curSize;
newSrc=srcInfo[0];
}
});
if(newSrc)return newSrc;
}
return this.src.replace(/\/\d+x\//i, "/736x/");
}
},
{
name: "Zhisheji",
url: /zhisheji\.com/,
r: /thumbnail\/.*/i,
s: ""
},
{
name: "imgbox",
src: /imgbox\.com/,
r: /thumbs(\d\.imgbox.*)_t\./i,
s: "images$1_o."
},
{
name: "Reddit",
url: /reddit\.com|redd\.it/,
getImage: function() {
if (this.srcset) {
var srcs = this.srcset.split(/[xw],/i);
for (let i = 0; i < srcs.length; i++) {
let srcInfo = srcs[i].trim().split(" ")[0];
if (srcInfo.indexOf("?width") == -1) return srcInfo;
}
} else if (/^https?:\/\/preview\./.test(this.src)){
return this.src.replace("preview", "i").replace(/\?.*/, "");
}
return this.src;
},
getExtSrc: function() {
if (/^https?:\/\/imgur\.com(\/a)?\/\w{5,}/.test(this.href)) {
return this.href.replace(/^https?:\/\/imgur\.com(\/a)?\/(\w+)/, "https://i.imgur.com/$2.webp");
}
},
xhr: {
url: function(a, p, self) {
if (a && a.href && /\/\/v.redd\.it\/\w+\/?$/.test(a.href)) {
return a.href + '/DASHPlaylist.mpd';
} else if (a && a.href && /^https:\/\/www\.reddit\.com\/gallery\//.test(a.href)) {
return a.href;
} else if (a && a.href && /redgifs\.com\//.test(a.href)) {
const apiUrl = 'https://api.redgifs.com/v2';
if (!self.redgifsToken) {
self.redgifsToken = "1";
fetch(`${apiUrl}/auth/temporary`).then(res => res.json()).then((data) => {
if (data && data.token) {
self.redgifsToken = data.token;
}
});
}
return apiUrl + "/gifs/" + a.href.replace(/.*redgifs.com\/(..\/)?(\w+\/)?(\w+)(?:\.\w+)?/, '$3');;
} else if (p[1] && p[1].classList.contains("search-result")) {
let link = p[1].querySelector("a.search-link");
if (link && link.href) {
if (/\/\/v.redd\.it\/\w+\/?$/.test(link.href)) {
return link.href + '/DASHPlaylist.mpd';
} else if (/^https:\/\/www\.reddit\.com\/gallery\//.test(link.href)) {
return link.href;
}
}
}
},
headers: (url, self) => {
if (/redgifs\.com\//.test(url)) {
return { Authorization:`Bearer ${self.redgifsToken}` };
}
},
query: function(html, doc, url) {
try {
if (/redgifs\.com\//.test(url)) {
let data;
try {
data = JSON.parse(html);
} catch (e) {
return;
}
if (data && data.gif) {
return data.gif.urls.gif || data.gif.urls.hd;
}
} else if (/^https:\/\/www\.reddit\.com\/gallery\//.test(url)) {
return [].reduce.call(doc.querySelectorAll("figure>a"), (total, cur) => {
return total.concat(cur.href);
}, []);
}
var xmlDoc = (new DOMParser()).parseFromString(html, 'application/xml');
var highestRes = [].slice.call(xmlDoc.querySelectorAll('Representation[frameRate]'))
.sort(function (r1, r2) {
var w1 = parseInt(r1.getAttribute('width')), w2 = parseInt(r2.getAttribute('width'));
return w1 > w2 ? -1 : (w1 < w2 ? 1 : 0);
})
.find(function (repr) { return !!repr.querySelector('BaseURL'); });
if (highestRes) {
var baseUrl = highestRes.querySelector('BaseURL').textContent.trim();
return baseUrl.indexOf('//') !== -1 ? baseUrl : url.replace('DASHPlaylist.mpd', baseUrl);
}
} catch (err) {
console.log(err);
}
}
}
},
{
name: "Rule34hentai",
url: /rule34hentai\.net/,
r: "/_thumbs/",
s: "/_images/"
},
{
name: "Rule34",
url: /rule34\.xxx/,
src: /\/(thumbnails|samples)\/(.*)\/(thumbnail|sample)_/i,
r: /\/(thumbnails|samples)\/(.*)\/(thumbnail|sample)_(.*)\..*/i,
s: ["/images/$2/$4.jpeg","/images/$2/$4.png","/images/$2/$4.jpg"]
},
{
name: "Photosight",
url: /photosight\.ru/,
r: /(cdny\.de.*\/)t\//i,
s: "$1x/"
},
{
name: "Xiaohongshu",
url: /xiaohongshu\.com/,
ext: function(target) {
if (target.className == 'change-pic') {
var imgs=target.previousElementSibling.querySelectorAll('li'),i=0;
for(i=0;i<imgs.length;i++){
if(imgs[i].style.display!="none")
return imgs[i].childNodes[0];
}
}
return target;
},
r: [/\/w\/\d+\/(h\/\d+\/)?(q\/\d+\/)?/i, /.*\.xhscdn\.com.*\/(\w+)(!.*|$)/i],
s: ["/w/1080/", "https://sns-img-bd.xhscdn.com/$1"]
},
{
name: "Youtube",
url: /youtube\.com/,
ext: function(target) {
if (target.tagName == "ytd-thumbnail" || target.id == "thumbnail-container") {
return target.querySelector("img");
}
},
getExtSrc: function() {
let newsrc = "";
if (this.id == "thumbnail-container" && this.children[0].hasAttribute("loaded")) {
let img = this.querySelector('img');
if (!img) return;
newsrc = img.src;
}
return newsrc.replace(/\?.*$/i,"");
},
getImage: function(a, p) {
var newsrc=this.src;
if(p[2] && this.classList.contains('ytd-moving-thumbnail-renderer')){
newsrc = p[2].querySelector("img").src;
}
if(!newsrc || newsrc.indexOf("i.ytimg.com") == -1) return;
return newsrc.replace(/\?.*$/i,"");
}
},
{
name: "588ku",
url: /588ku\.com/,
r: /!\/fw.*/,
s: ""
},
{
name: "ibaotu",
url: /ibaotu\.com/,
ext: 'previous',
r: "!fwc238",
s: "!ww7002"
},
{
name: "58pic",
url: /58pic\.com/,
ext: function(target){
if(target.className=="no-login" && target.style.opacity==""){
target.style.opacity=0.99;
setTimeout(()=>{target.style.display="none";},1000);
}
return null;
},
r: /!.*/i,
s: "!w1024"
},
{
name: "gelbooru",
url: /gelbooru\.com/,
src: /(thumbnails|samples)\/(.*)\/(thumbnail|sample)_/i,
r: /.*\/(thumbnails|samples)\/(.*)\/(thumbnail|sample)_(.*)\..*/i,
s: ["https://img3.gelbooru.com/images/$2/$4.png","https://img3.gelbooru.com/images/$2/$4.jpg"]
},
{
name: "donmai",
url: /donmai\.us/,
src: /(thumbnails|sample)\/(.*)\/(thumbnail|sample)_|\/\d+x\d+\//i,
r: [/\/(thumbnails|sample)\/(.*)\/(thumbnail|sample)_(.*)/i,
/\/\d+x\d+\/(.*)\..*/i
],
s: ["/original/$2/$4",["/original/$1.jpg", "/original/$1.png"]]
},
{
name: "erosberry",
url: /erosberry\.com/,
r: /(\/\d+\/)tn_(\d+\.[^\/]+)$/i,
s: "$1$2"
},
{
name: "javdb",
url: /javdb/,
r: "/thumbs/",
s: "/covers/"
},
{
name: "javbus",
url: /javbus\.|busjav\./,
r: /\/thumbs?(\/\w+)\.jpg$/i,
s: "/cover$1_b.jpg"
},
{
name: "avmoo",
url: /avmoo\./,
r: "ps.jpg",
s: "pl.jpg"
},
{
name: "asiansister",
url: /asiansister\.com/,
r: "_t.",
s: "."
},
{
name: "jianshu",
url: /jianshu\.com/,
r: /(upload-images\.jianshu\.io\/.*)\?.*/i,
s: "$1"
},
{
name: "artstation",
ext: 'next',
url: /artstation\.com/,
r: /\/(\d{14}\/)?smaller_square\//i,
s: "/large/",
xhr: {
url: function(a, p) {
if (a && a.href.match('/artwork/')) return a.href.replace('/artwork/', '/projects/') + '.json';
},
query: function(html) {
let datas = JSON.parse(html);
let urls = [];
datas.assets.forEach(d => {
urls.push(d.image_url)
});
return urls;
}
}
},
{
name: "flickr",
url: /flickr\.com/,
ext: function(target){
if(target.nodeName=="A" && target.className=="overlay" && target.parentNode && target.parentNode.parentNode && target.parentNode.parentNode.parentNode){
return target.parentNode.parentNode.parentNode;
}else if(target.nodeName=="DIV" && target.classList.contains("photo-notes-scrappy-view")){
return target.previousElementSibling.querySelector(".main-photo");
}else if(target.classList.contains("context-thumb")){
return target;
}
return null;
},
r: /_\w\./i,
s: "_c."
},
{
name: "wikiart",
url: /wikiart\.org/,
r: /!.*/i,
s: ''
},
{
name: "discuz",
r: [/(.+\/attachments?\/.+)\.thumb\.\w{2,5}$/i,