// ==UserScript==
// @name 豆瓣助手
// @version 0.0.20
// @namespace airbash/DoubanAssistant
// @homepageURL https://github.com/AirBashX/UserScript
// @author airbash
// @description 恢复IMDB的链接,展示IMDB评分,以及增加快捷搜索SubHD、字幕库、射手网、opensubtitle、6V电影网、电影天堂、新电影天堂、WebHD、rargb、海盗湾、watchsomuch、tgx、EXT、腾讯视频、优酷视频、爱奇艺、哔哩哔哩、西瓜视频、欢喜首映中资源的功能
// @match *://movie.douban.com/subject/*
// @connect www.hao6v.me
// @connect www.imdb.com
// @connect dy2018.com
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// @license GPL-3.0
// @icon https://img1.doubanio.com/favicon.ico
// @require https://fastly.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.all.min.js
// @require https://fastly.jsdelivr.net/npm/encode-gb2312@0.0.2/encodeToGb2312.min.js
// @run-at document-end
// @downloadURL https://update.greasyfork.icu/scripts/456585/%E8%B1%86%E7%93%A3%E5%8A%A9%E6%89%8B.user.js
// @updateURL https://update.greasyfork.icu/scripts/456585/%E8%B1%86%E7%93%A3%E5%8A%A9%E6%89%8B.meta.js
// ==/UserScript==
/* global encodeToGb2312 Swal*/
///
";
imdb_id_item.after(div);
//删除原本的idmb链接
imdb_item.remove();
imdb_id_item.remove();
}
/**
* 获取IMDB评分
*/
function imdb_score() {
GM_xmlhttpRequest({
url: "https://www.imdb.com/title/" + imdb_id,
onload: function (response) {
let text = response.responseText;
let dp = new DOMParser();
let html = dp.parseFromString(text, "text/html");
let item = html.querySelector("[data-testid=hero-rating-bar__aggregate-rating__score] span");
let imdb_score = item.innerText;
let str = html.querySelector("#__NEXT_DATA__").textContent;
let json = JSON.parse(str);
let imdb_vote = json.props.pageProps.aboveTheFoldData.ratingsSummary.voteCount;
let self = document.querySelector(".rating_self").cloneNode(true);
let logo = document.querySelector(".rating_logo").cloneNode(true);
let sectl = document.querySelector("#interest_sectl");
sectl.append(logo);
sectl.append(self);
//增加IMDB名
logo.innerText = "IMDB评分";
//修改文字评分
self.querySelector(".rating_num").innerText = imdb_score;
//修改图形评分
let classList = self.querySelector(".bigstar").classList;
classList.replace(classList.item(2), "bigstar" + (Math.floor(imdb_score) / 2) * 10);
//修改IMDB人数
self.querySelector(".rating_people span").innerText = imdb_vote;
self.querySelector(".rating_people").href = "https://www.imdb.com/title/" + imdb_id + "/ratings";
// let div = document.createElement("div");
// div.innerHTML = "IMDb评分:" + score + "
";
// document.querySelector(".rating_wrap").after(div);
},
});
}
/**
* 侧边栏功能列表
*/
const webSites = [
{
id: "group1",
name: "字幕搜索",
links: [
{
name: "SubHD",
url: "subhd.tv",
search: "https://subhd.tv/search/" + douban_cn_name,
},
{
name: "射手网",
url: "assrt.net",
search: "https://assrt.net/sub/?searchword=" + douban_cn_name,
},
{
name: "字幕库",
url: "zimuku.org",
search: "https://so.zimuku.org/search?q=" + douban_cn_name,
},
{
name: "OpenSub",
url: "opensubtitles.org",
search: "https://www.opensubtitles.com/zh-CN/zh-CN/search-all/q-" + imdb_id + "/hearing_impaired-include/machine_translated-/trusted_sources-",
},
],
},
{
id: "group2",
name: "英文资源",
links: [
{
name: "rargb",
url: "rargb.to",
search: "https://rargb.to/search/?search=" + douban_en_name,
},
{
name: "海盗湾",
url: "thepiratebay10.xyz",
search: "https://thepiratebay10.xyz/search/" + douban_en_name,
},
{
name: "WSM",
url: "watchsomuch.to",
search: "https://watchsomuch.to/Movies/" + douban_en_name,
},
{
name: "tgx",
url: "tgx.rs",
search: "https://tgx.rs/torrents.php?search=" + douban_en_name,
},
{
name: "1377x",
url: "www.1377x.to",
search: "https://www.1377x.to/search/" + douban_en_name + "/1/",
},
{
name: "EXT",
url: "extranet.torrentbay.st",
search: "https://extranet.torrentbay.st/browse/?q=" + douban_en_name,
},
],
},
{
id: "group3",
name: "中文资源",
links: [
{
name: "6v电影网",
url: "www.hao6v.tv",
search: "https://www.hao6v.me/e/search/index.php",
data: "show=title%2Csmalltext&tempid=1&keyboard=" + douban_cn_name_gbk + "&tbname=article&x=0&y=0",
type: "xhr",
anonymous: true,
},
{
name: "电影天堂",
url: "www.dygod.net",
search: "https://www.dygod.net/",
},
{
name: "新电影天堂",
url: "www.xl720.com",
search: "https://www.xl720.com/?s=" + douban_cn_name,
},
],
},
{
id: "group4",
name: "正版资源",
links: [
{
name: "腾讯视频",
url: "v.qq.com",
search: "https://v.qq.com/x/search/?q=" + douban_cn_name,
},
{
name: "优酷视频",
url: "youku.com",
search: "https://so.youku.com/search_video/q_" + douban_cn_name,
},
{
name: "爱奇艺",
url: "iqiyi.com",
search: "https://so.iqiyi.com/so/q_" + douban_cn_name,
},
{
name: "哔哩哔哩",
url: "bilibili.com",
search: "https://search.bilibili.com/all?keyword=" + douban_cn_name,
},
{
name: "西瓜视频",
url: "www.ixigua.com",
search: "https://www.ixigua.com/search/" + douban_cn_name,
},
{
name: "欢喜首映",
url: "www.huanxi.com",
search: "https://www.huanxi.com/search.shtml?sv=" + douban_cn_name,
},
],
},
];
/**
* 功能列表
*/
const GMValues = [
{
id: "imdb_link",
name: "IMDB链接",
fun: imdb_link,
},
{
id: "imdb_score",
name: "IMDB评分",
fun: imdb_score,
},
];
if (imdb_id) {
for (let GMValue of GMValues) {
if (GM_getValue(GMValue.id, true)) {
GMValue.fun();
}
}
}
aside();
/**
* 脚本工具菜单
*/
GM_registerMenuCommand("配置", () => {
configuration();
});
/**
* 侧边栏功能
*/
function aside() {
let aside = document.querySelector(".aside");
for (let webSite of webSites) {
let div = document.createElement("div");
div.className = "resource";
if (GM_getValue(webSite.id, true)) {
div.innerHTML = "