Greasy Fork is available in English.
在电影详情页展示部分中文信息
当前为
// ==UserScript==
// @name TMDB-Info-for-PTP
// @namespace https://github.com/techmovie/TMDB-Info-for-PTP
// @version 0.1.1
// @description 在电影详情页展示部分中文信息
// @author Mekio
// @match http*://passthepopcorn.me/torrents.php?id=*
// @grant none
// ==/UserScript==
(function () {
'use strict';
const API_KEY = 'YOUR TMDB API_KEY';
const TMDB_URL = 'https://api.themoviedb.org/3';
const imdbLink = $('#imdb-title-link').attr('href');
if (!imdbLink) {
return
}
const imdbId = /tt\d+/.exec(imdbLink)[0];
$.ajax({
url: `${TMDB_URL}/find/${imdbId}`,
dataType: 'jsonp',
async: false,
data: {
api_key: API_KEY,
external_source: 'imdb_id'
},
success(data) {
if (data.movie_results.length > 0) {
getMovieInfo(data.movie_results[0].id)
}
}
})
const getMovieInfo = (movieId) => {
$.ajax({
url: `${TMDB_URL}/movie/${movieId}`,
dataType: 'jsonp',
async: false,
data: {
api_key: API_KEY,
language: 'zh-CN',
},
success(data) {
addInfoToPage(data);
}
})
}
const addInfoToPage = (data) => {
const genres = data.genres.map(item => item.name)
$('.page__title').prepend(`<a style="" href="https://www.themoviedb.org/movie/${data.id}">[${data.title}]</a>`)
if (data.overview) {
$('#synopsis').html(data.overview)
}
$('#movieinfo .panel__body').prepend(` <div><strong>类型:</strong> ${genres.join('/')}</div>`)
}
})();