Greasy Fork is available in English.

B站点赞姬

不白嫖,为观看时间超过10s的视频自动点赞

질문, 리뷰하거나, 이 스크립트를 신고하세요.
  1. // ==UserScript==
  2. // @name B站点赞姬
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.11
  5. // @description 不白嫖,为观看时间超过10s的视频自动点赞
  6. // @author kakasearch
  7. // @match https://www.bilibili.com/*
  8. // @icon data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiID8+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPg0KPHN2ZyB3aWR0aD0iODAwcHQiIGhlaWdodD0iODAwcHQiIHZpZXdCb3g9IjAgMCA4MDAgODAwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQo8ZyBpZD0iI2ZmN2YwMmZmIj4NCjxwYXRoIGZpbGw9IiNmZjdmMDIiIG9wYWNpdHk9IjEuMDAiIGQ9IiBNIDUzNi42OCAxNTYuMDYgQyA1MzYuODQgMTQ2Ljk3IDU0Mi4yNyAxMzguMTIgNTUwLjkyIDEzNC44NiBDIDU1Mi44NSAxNDMuODYgNTU0LjcyIDE1Mi44NyA1NTYuNjAgMTYxLjg3IEMgNTU3LjA2IDE2NS4yOSA1NTkuNTcgMTY3LjgxIDU2MS4zNiAxNzAuNTkgQyA1NzMuNjcgMTY5LjYzIDU4Ni41NCAxNzEuMzUgNTk3LjM0IDE3Ny42NSBDIDYwOC41MyAxODQuMDUgNjE2Ljk0IDE5NC44MSA2MjEuMjIgMjA2LjkwIEMgNjI2LjEyIDIxNy4wOCA2MzcuMjAgMjIzLjUyIDYzOS41NiAyMzUuMDUgQyA2MzcuNjIgMjQ3LjIzIDYzNS40OCAyNTkuOTgg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gwIDM1Ny40MSA2NTYuNDEgMzU0LjMzIFoiIC8+DQo8L2c+DQo8L3N2Zz4NCg==
  9. // @grant GM_setValue
  10. // @grant GM_getValue
  11. // @run-at document-end
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. function fireKeyEvent(el, evtType, keyCode){
  17. //参考自 https://blog.csdn.net/lovelyelfpop/article/details/52471878
  18. var doc = el.ownerDocument,
  19. win = doc.defaultView || doc.parentWindow,
  20. evtObj;
  21. if(doc.createEvent){
  22. if(win.KeyEvent) {
  23. evtObj = doc.createEvent('KeyEvents');
  24. evtObj.initKeyEvent( evtType, true, true, win, false, false, false, false, keyCode, 0 );
  25. }
  26. else {
  27. evtObj = doc.createEvent('UIEvents');
  28. Object.defineProperty(evtObj, 'keyCode', {
  29. get : function() { return this.keyCodeVal; }
  30. });
  31. Object.defineProperty(evtObj, 'which', {
  32. get : function() { return this.keyCodeVal; }
  33. });
  34. evtObj.initUIEvent( evtType, true, true, win, 1 );
  35. evtObj.keyCodeVal = keyCode;
  36. if (evtObj.keyCode !== keyCode) {
  37. console.log("keyCode " + evtObj.keyCode + " 和 (" + evtObj.which + ") 不匹配");
  38. }
  39. }
  40. el.dispatchEvent(evtObj);
  41. }
  42. else if(doc.createEventObject){
  43. evtObj = doc.createEventObject();
  44. evtObj.keyCode = keyCode;
  45. el.fireEvent('on' + evtType, evtObj);
  46. }
  47. }
  48. function main(){
  49. console.log("准备点赞")
  50. let tmp = setInterval(function(){
  51. let video= document.querySelector("video")
  52. if(video){
  53. clearInterval(tmp)
  54. let bv = /BV[a-zA-Z0-9]+/.exec(window.location.href)[0]
  55. if(bv && GM_getValue(bv)){
  56. console.log(bv,GM_getValue(bv))
  57. console.log("之前点过赞")
  58. }else{
  59. GM_setValue(bv,new Date().toLocaleString())
  60. setTimeout(function(){
  61. fireKeyEvent(window.document.body,"keydown",81)
  62. fireKeyEvent(window.document.body,"keyup",81) //点击1次Q键,删除此行变为长按q,即三连
  63. console.log("已点赞")},10000)
  64. }
  65. }
  66. },3000)
  67.  
  68. }
  69. let obser = setInterval(
  70. function(){
  71. let video= document.querySelector("video")
  72. if(video){
  73. clearInterval(obser)
  74. main()
  75. let observer = new MutationObserver(main)
  76. observer.observe(video, { attributes: true,childList: true });//检测video变化,防止中途切p失效
  77. }
  78.  
  79. },200
  80. )
  81. })();