枝江反诈骗

Show titles according to BVs.

  1. // ==UserScript==
  2. // @name 枝江反诈骗
  3. // @namespace https://space.bilibili.com/2649561
  4. // @version 1.3
  5. // @description Show titles according to BVs.
  6. // @author Sela
  7. // @include https://*.bilibili.com/*
  8. // @exclude https://manga.bilibili.com/eden/bilibili-nav-panel.html
  9. // @exclude https://live.bilibili.com/blackboard/dropdown-menu.html
  10. // @exclude https://www.bilibili.com/page-proxy/game-nav.html
  11. // @exclude https://t.bilibili.com/pages/nav/index_new*
  12. // @exclude https://message.bilibili.com/*
  13. // @icon https://tse1-mm.cn.bing.net/th/id/OIP-C.D0J8yk3gtsBUFSYLpv90YwHaHa?pid=ImgDet&rs=1
  14. // @grant none
  15. // @require http://code.jquery.com/jquery-3.x-git.min.js
  16. /* globals jQuery, $, waitForKeyElements */
  17. // ==/UserScript==
  18.  
  19. (function() {
  20. var mybutton,beasetag;
  21. mybutton = document.createElement("div");
  22. beasetag = document.querySelector("body");
  23. beasetag.appendChild(mybutton);
  24. mybutton.innerHTML = "反诈骗";
  25. mybutton.style = "position:fixed;bottom:15px;right:15px;width:60px;height:60px;background:black;opacity:0.5;color:white;text-align:center;line-height:60px;cursor:pointer;";
  26. var reg = /b23.tv\/[0-9a-zA-Z]{6}/;
  27. $(mybutton).click(function(){
  28. //运行
  29. $('a').each(function(){
  30. var temp = $(this).text();
  31. if(reg.test(temp)){
  32. var href = reg.exec($(this).text());
  33. var title = setTitle(href);
  34. if(title.length > 1){
  35. $(this).text(title);
  36. }
  37. }
  38. });
  39. })
  40.  
  41. function setTitle(href){
  42. //获取标题
  43. var bv = getBv(href);
  44. var u = 'https://api.bilibili.com/x/web-interface/view?bvid=' + bv;
  45. var title = '';
  46. $.ajax({url:u,
  47. async:false,
  48. success:function(result){
  49. var text = JSON.stringify(result)
  50. title = getTitle(text);
  51. }});
  52. return title;
  53. }
  54. function getTitle(t){
  55. var reg = /"title":"(.+)","pubdate"/;
  56. if (reg.test(t)){
  57. var title = reg.exec(t);
  58. return title[1];
  59. }
  60. }
  61. function getBv(href){
  62. //获取bv号
  63. //接口来自https://res.abeim.cn/api/dwz_longurl/doc.php
  64. var tool = 'https://res.abeim.cn/api-dwz_longurl?url=http://';
  65. var reg = /video\/(.+)\?/;
  66. var bv = '';
  67. $.ajax({url:tool+href,
  68. async:false,
  69. success:function(result){
  70. var text = JSON.stringify(result);
  71. var temp = reg.exec(text)[1];
  72. bv = temp;
  73. }})
  74. return bv;
  75. }
  76. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址