脚本无法发布新版本
// ==UserScript==
// @name 微博提取RIJUPAO链接
// @namespace http://tampermonkey.net/
// @version 0.1.3
// @description 很多字幕组在微博发布资源信息,使用脚本提取出来给RIJUPAO使用。
// @author imzhi <yxz_blue@126.com>
// @match https://weibo.com/mygroups?gid=4617547158655249
// @require https://cdn.staticfile.org/jquery/3.5.1/jquery.min.js
// @require https://cdn.staticfile.org/clipboard.js/2.0.6/clipboard.min.js
// @grant GM_addStyle
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
GM_addStyle('.imzhi_weibo_comm_copy {font-size: 11px;} .imzhi_weibo_item_create {margin-right: 10px;}');
// 点击【生成微博复制】按钮,每条微博加上【生成评论复制】按钮,并加上【复制链接】按钮。点击【生成评论复制按钮】,在评论区加上【复制链接】按钮。
const $button_create = $('<button class="imzhi_weibo_create">生成</button>');
$('a.Ctrls_alink_1L3hP').last().after($button_create);
$button_create.click(function() {
const $nickname_last = $('.woo-box-flex.woo-box-column.woo-box-justifyCenter > .woo-box-flex.woo-box-alignCenter:first-child');
$nickname_last.each(function(i, nickname_last_el) {
// 判断是否已添加按钮
if ($(nickname_last_el).find('.imzhi_weibo_item_create').length) {
return;
}
// 微博用户名后台追加【生成】按钮和【复制】按钮
const $weibo_create = $('<button class="imzhi_weibo_item_create">生成</button>');
const $weibo_copy = $('<button class="imzhi_weibo_item_copy">复制</button>');
$(nickname_last_el).append($weibo_create)
.append($weibo_copy);
});
});
function getCommentFirstBtn(el) {
const $comment = $(el).closest('.vue-recycle-scroller__item-view')
return $comment.find('.Feed_box_3fswx .opt.woo-box-flex > .wbpro-iconbed:first-child');
}
// 点击微博内容里的【生成】按钮
$('#homeWrap').on('click', '.imzhi_weibo_item_create', function() {
$(this).closest('.vue-recycle-scroller__item-view').find('.Feed_box_3fswx .opt.woo-box-flex > .wbpro-iconbed:first-child');
const $comment_first = getCommentFirstBtn(this);
if (!$comment_first.length) {
alert('没有展开评论!');
return false;
}
$comment_first.each(function (i, comm_first_btn) {
// 判断是否已添加按钮
if ($(comm_first_btn).find('.imzhi_weibo_comm_copy').length) {
return;
}
const $comm_copy = $('<button class="imzhi_weibo_comm_copy">复制</button>');
$(comm_first_btn).before($comm_copy);
});
});
// 点击微博内容里的【复制】按钮
$('#homeWrap').on('click', '.imzhi_weibo_item_copy', function() {
$(this).closest('.vue-recycle-scroller__item-view');
});
// 点击微博评论里的【复制】按钮
$('#homeWrap').on('click', '.imzhi_weibo_comm_copy', function() {
const $comm_main = $(this).closest('.con1.woo-box-item-flex');
const $author_link = comm_main.child('.text > a:first-child');
const html = $comm_main.child('.text > span').html();
if ($author_link.text().includes('幻月')) {
// html 测试数据
// html = `<span>下载地址: 115:<a target="_blank" href="http://t.cn/A6cZe9ps"><img class="icon-link" src="https://h5.sinaimg.cn/upload/2015/09/25/3/timeline_card_small_web_default.png">网页链接</a> 桃色 杏色 樱色 访问码:d7c8 微云:https:// share.weiyun.com/IafsAcRD(删掉空格) 度盘:<a target="_blank" href="http://t.cn/A6cZe90P"><img class="icon-link" src="https://h5.sinaimg.cn/upload/2015/09/25/3/timeline_card_small_web_default.png">网页链接</a> 提取码:588a</span>`
const mat_yiyiwu = html.match(/115.*?[::].+?href="(?<yiyiwu_url>.+?)".+码[::]\s*(?<yiyiwu_code>[\w]{4})/);
const mat_weiyun = html.match(/微云.+?(?<weiyun_url>https.+share\.weiyun\.com\/[\w]+)/);
const mat_baidu = html.match(/度盘?.*?[::].+?href="(?<baidu_url>.+?)".+码[::]\s*(?<baidu_code>[\w]{4})/);
// TODO:t.cn的链接获取真实地址
const arr_baidu = [];
if (mat_baidu) {
arr_baidu.push('百度网盘下载(幻月字幕):');
arr_baidu.push(`<a href="${mat_baidu.groups.baidu_url}" rel="noopener noreferrer" target="_blank" style="word-break: break-all;">${mat_baidu.groups.baidu_url}</a>,提取码:${mat_baidu.groups.baidu_code}`);
}
const arr_yiyiwu = [];
if (mat_yiyiwu) {
arr_yiyiwu.push('115网盘下载(幻月字幕):');
arr_yiyiwu.push(`<a href="${mat_yiyiwu.groups.yiyiwu_url}" rel="noopener noreferrer" target="_blank" style="word-break: break-all;">${mat_yiyiwu.groups.yiyiwu_url}</a>,提取码:${mat_yiyiwu.groups.yiyiwu_code}`);
}
const arr_weiyun = [];
if (mat_weiyun) {
arr_weiyun.push('微云网盘下载(幻月字幕):');
arr_weiyun.push(`<a href="${mat_weiyun.groups.weiyun_url}" rel="noopener noreferrer" target="_blank" style="word-break: break-all;">${mat_weiyun.groups.weiyun_url}</a>,提取码:${mat_weiyun.groups.weiyun_code}`);
}
}
});
})();
Here is my source code.
The 500 error occurred when I publish a new version.
I found the question code block:
// html 测试数据
// html = `<span>下载地址: 115:<a target="_blank" href="http://t.cn/A6cZe9ps"><img class="icon-link" src="https://h5.sinaimg.cn/upload/2015/09/25/3/timeline_card_small_web_default.png">网页链接</a> 桃色 杏色 樱色 访问码:d7c8 微云:https:// share.weiyun.com/IafsAcRD(删掉空格) 度盘:<a target="_blank" href="http://t.cn/A6cZe90P"><img class="icon-link" src="https://h5.sinaimg.cn/upload/2015/09/25/3/timeline_card_small_web_default.png">网页链接</a> 提取码:588a</span>`
The comment line is too long, when I deleted the two lines, I can submit a new version.
Thanks
提示500了,已经有两天无法发布新版本的脚本源码了