Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
8 年前
差異永不過期
清除
匯出
分享
解釋
0 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
176 行
全部複製
12 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
184 行
全部複製
'use strict';
'use strict';
var _ = require('lodash');
var _ = require('lodash');
var Generic = require('butter-provider');
var Generic = require('butter-provider');
var inherits = require('util').inherits;
var inherits = require('util').inherits;
var Q = require('q');
var Q = require('q');
var querystring = require('querystring');
var querystring = require('querystring');
var request = require('request');
var request = require('request');
var sanitize = require('butter-sanitize');
var sanitize = require('butter-sanitize');
var AnimeApi = function (args) {
var AnimeApi = function (args) {
var that = this;
var that = this;
AnimeApi.super_.call(this);
AnimeApi.super_.call(this);
if (args.apiURL) {
if (args.apiURL) {
this.apiURL = args.apiURL.split(',');
this.apiURL = args.apiURL.split(',');
}
}
};
};
inherits(AnimeApi, Generic);
inherits(AnimeApi, Generic);
AnimeApi.prototype.config = {
AnimeApi.prototype.config = {
name: 'AnimeApi',
name: 'AnimeApi',
uniqueId: 'mal_id',
uniqueId: 'mal_id',
tabName: 'AnimeApi',
tabName: 'AnimeApi',
type: 'anime',
type: 'anime',
metadata: 'trakttv:anime-metadata'
metadata: 'trakttv:anime-metadata'
};
};
function formatFetch(animes) {
function formatFetch(animes) {
var results = _.map(animes, function (anime) {
var results = _.map(animes, function (anime) {
return {
return {
複製
已複製
複製
已複製
images: anime.images,
//
images: anime.images,
images: {
poster: 'https://media.kitsu.io/anime/poster_images/' + anime._id + '/large.jpg',
fanart: 'https://media.kitsu.io/anime/cover_images/' + anime._id + '/original.jpg',
},
mal_id: anime._id,
mal_id: anime._id,
haru_id: anime._id,
haru_id: anime._id,
tvdb_id: 'mal-' + anime._id,
tvdb_id: 'mal-' + anime._id,
imdb_id: anime._id,
imdb_id: anime._id,
slug: anime.slug,
slug: anime.slug,
title: anime.title,
title: anime.title,
year: anime.year,
year: anime.year,
type: anime.type,
type: anime.type,
item_data: anime.type,
item_data: anime.type,
rating: anime.rating
rating: anime.rating
};
};
});
});
return {results: sanitize(results), hasMore: true};
return {results: sanitize(results), hasMore: true};
};
};
function formatDetail(anime) {
function formatDetail(anime) {
var result = {
var result = {
mal_id: anime._id,
mal_id: anime._id,
haru_id: anime._id,
haru_id: anime._id,
tvdb_id: 'mal-' + anime._id,
tvdb_id: 'mal-' + anime._id,
imdb_id: anime._id,
imdb_id: anime._id,
slug: anime.slug,
slug: anime.slug,
title: anime.title,
title: anime.title,
item_data: anime.type,
item_data: anime.type,
country: 'Japan',
country: 'Japan',
genre: anime.genres,
genre: anime.genres,
genres: anime.genres,
genres: anime.genres,
num_seasons: 1,
num_seasons: 1,
runtime: anime.runtime,
runtime: anime.runtime,
status: anime.status,
status: anime.status,
synopsis: anime.synopsis,
synopsis: anime.synopsis,
network: [], //FIXME
network: [], //FIXME
rating: anime.rating,
rating: anime.rating,
複製
已複製
複製
已複製
images: anime.images,
//
images: anime.images,
images: {
poster: 'https://media.kitsu.io/anime/poster_images/' + anime._id + '/large.jpg',
fanart: 'https://media.kitsu.io/anime/cover_images/' + anime._id + '/original.jpg',
},
backdrop: anime.images.fanart,
backdrop: anime.images.fanart,
poster: anime.images.poster,
poster: anime.images.poster,
year: anime.year,
year: anime.year,
type: anime.type
type: anime.type
};
};
if (anime.type === 'show') {
if (anime.type === 'show') {
result = _.extend(result, {episodes: anime.episodes});
result = _.extend(result, {episodes: anime.episodes});
} else {
} else {
// ret = _.extend(ret, {
// ret = _.extend(ret, {
// cover: img,
// cover: img,
// rating: item.score,
// rating: item.score,
// subtitle: undefined,
// subtitle: undefined,
// torrents: movieTorrents(item.id, item.episodes)
// torrents: movieTorrents(item.id, item.episodes)
// });
// });
}
}
return sanitize(result);
return sanitize(result);
};
};
function processCloudFlareHack(options, url) {
function processCloudFlareHack(options, url) {
var req = options;
var req = options;
var match = url.match(/^cloudflare\+(.*):\/\/(.*)/);
var match = url.match(/^cloudflare\+(.*):\/\/(.*)/);
if (match) {
if (match) {
req = _.extend(req, {
req = _.extend(req, {
uri: match[1] + '://cloudflare.com/',
uri: match[1] + '://cloudflare.com/',
headers: {
headers: {
'Host': match[2],
'Host': match[2],
'User-Agent': 'Mozilla/5.0 (Linux) AppleWebkit/534.30 (KHTML, like Gecko) PT/3.8.0'
'User-Agent': 'Mozilla/5.0 (Linux) AppleWebkit/534.30 (KHTML, like Gecko) PT/3.8.0'
}
}
});
});
}
}
return req;
return req;
};
};
function get(index, url, that) {
function get(index, url, that) {
var deferred = Q.defer();
var deferred = Q.defer();
var options = {
var options = {
url: url,
url: url,
json: true
json: true
};
};
var req = processCloudFlareHack(options, that.apiURL[index]);
var req = processCloudFlareHack(options, that.apiURL[index]);
console.info('Request to AnimeApi', req.url);
console.info('Request to AnimeApi', req.url);
request(req, function (err, res, data) {
request(req, function (err, res, data) {
if (err || res.statusCode >= 400) {
if (err || res.statusCode >= 400) {
console.warn('AnimeAPI endpoint \'%s\' failed.', that.apiURL[index]);
console.warn('AnimeAPI endpoint \'%s\' failed.', that.apiURL[index]);
if (index + 1 >= that.apiURL.length) {
if (index + 1 >= that.apiURL.length) {
return deferred.reject(err || 'Status Code is above 400');
return deferred.reject(err || 'Status Code is above 400');
} else {
} else {
return get(index + 1, url, that);
return get(index + 1, url, that);
}
}
} else if (!data || data.error) {
} else if (!data || data.error) {
err = data ? data.status_message : 'No data returned';
err = data ? data.status_message : 'No data returned';
console.error('API error:', err);
console.error('API error:', err);
return deferred.reject(err);
return deferred.reject(err);
} else {
} else {
return deferred.resolve(data);
return deferred.resolve(data);
}
}
});
});
return deferred.promise;
return deferred.promise;
};
};
AnimeApi.prototype.extractIds = function (items) {
AnimeApi.prototype.extractIds = function (items) {
return _.map(items.results, 'mal_id');
return _.map(items.results, 'mal_id');
};
};
AnimeApi.prototype.fetch = function (filters) {
AnimeApi.prototype.fetch = function (filters) {
var that = this;
var that = this;
var params = {};
var params = {};
params.sort = 'seeds';
params.sort = 'seeds';
params.limit = '50';
params.limit = '50';
if (filters.keywords) {
if (filters.keywords) {
params.keywords = filters.keywords.replace(/\s/g, '% ');
params.keywords = filters.keywords.replace(/\s/g, '% ');
}
}
if (filters.genre) {
if (filters.genre) {
params.genre = filters.genre;
params.genre = filters.genre;
}
}
if (filters.order) {
if (filters.order) {
params.order = filters.order;
params.order = filters.order;
}
}
if (filters.sorter && filters.sorter !== 'popularity') {
if (filters.sorter && filters.sorter !== 'popularity') {
params.sort = filters.sorter;
params.sort = filters.sorter;
}
}
var index = 0;
var index = 0;
var url = that.apiURL[index] + 'animes/' + filters.page + '?' + querystring.stringify(params).replace(/%25%20/g, '%20');
var url = that.apiURL[index] + 'animes/' + filters.page + '?' + querystring.stringify(params).replace(/%25%20/g, '%20');
return get(index, url, that).then(formatFetch);
return get(index, url, that).then(formatFetch);
};
};
AnimeApi.prototype.detail = function (torrent_id, old_data, debug) {
AnimeApi.prototype.detail = function (torrent_id, old_data, debug) {
var that = this;
var that = this;
var index = 0;
var index = 0;
var url = that.apiURL[index] + "anime/" + torrent_id;
var url = that.apiURL[index] + "anime/" + torrent_id;
return get(index, url, that).then(formatDetail);
return get(index, url, that).then(formatDetail);
};
};
module.exports = AnimeApi;
module.exports = AnimeApi;
已保存差異
原始文本
開啟檔案
'use strict'; var _ = require('lodash'); var Generic = require('butter-provider'); var inherits = require('util').inherits; var Q = require('q'); var querystring = require('querystring'); var request = require('request'); var sanitize = require('butter-sanitize'); var AnimeApi = function (args) { var that = this; AnimeApi.super_.call(this); if (args.apiURL) { this.apiURL = args.apiURL.split(','); } }; inherits(AnimeApi, Generic); AnimeApi.prototype.config = { name: 'AnimeApi', uniqueId: 'mal_id', tabName: 'AnimeApi', type: 'anime', metadata: 'trakttv:anime-metadata' }; function formatFetch(animes) { var results = _.map(animes, function (anime) { return { images: anime.images, mal_id: anime._id, haru_id: anime._id, tvdb_id: 'mal-' + anime._id, imdb_id: anime._id, slug: anime.slug, title: anime.title, year: anime.year, type: anime.type, item_data: anime.type, rating: anime.rating }; }); return {results: sanitize(results), hasMore: true}; }; function formatDetail(anime) { var result = { mal_id: anime._id, haru_id: anime._id, tvdb_id: 'mal-' + anime._id, imdb_id: anime._id, slug: anime.slug, title: anime.title, item_data: anime.type, country: 'Japan', genre: anime.genres, genres: anime.genres, num_seasons: 1, runtime: anime.runtime, status: anime.status, synopsis: anime.synopsis, network: [], //FIXME rating: anime.rating, images: anime.images, backdrop: anime.images.fanart, poster: anime.images.poster, year: anime.year, type: anime.type }; if (anime.type === 'show') { result = _.extend(result, {episodes: anime.episodes}); } else { // ret = _.extend(ret, { // cover: img, // rating: item.score, // subtitle: undefined, // torrents: movieTorrents(item.id, item.episodes) // }); } return sanitize(result); }; function processCloudFlareHack(options, url) { var req = options; var match = url.match(/^cloudflare\+(.*):\/\/(.*)/); if (match) { req = _.extend(req, { uri: match[1] + '://cloudflare.com/', headers: { 'Host': match[2], 'User-Agent': 'Mozilla/5.0 (Linux) AppleWebkit/534.30 (KHTML, like Gecko) PT/3.8.0' } }); } return req; }; function get(index, url, that) { var deferred = Q.defer(); var options = { url: url, json: true }; var req = processCloudFlareHack(options, that.apiURL[index]); console.info('Request to AnimeApi', req.url); request(req, function (err, res, data) { if (err || res.statusCode >= 400) { console.warn('AnimeAPI endpoint \'%s\' failed.', that.apiURL[index]); if (index + 1 >= that.apiURL.length) { return deferred.reject(err || 'Status Code is above 400'); } else { return get(index + 1, url, that); } } else if (!data || data.error) { err = data ? data.status_message : 'No data returned'; console.error('API error:', err); return deferred.reject(err); } else { return deferred.resolve(data); } }); return deferred.promise; }; AnimeApi.prototype.extractIds = function (items) { return _.map(items.results, 'mal_id'); }; AnimeApi.prototype.fetch = function (filters) { var that = this; var params = {}; params.sort = 'seeds'; params.limit = '50'; if (filters.keywords) { params.keywords = filters.keywords.replace(/\s/g, '% '); } if (filters.genre) { params.genre = filters.genre; } if (filters.order) { params.order = filters.order; } if (filters.sorter && filters.sorter !== 'popularity') { params.sort = filters.sorter; } var index = 0; var url = that.apiURL[index] + 'animes/' + filters.page + '?' + querystring.stringify(params).replace(/%25%20/g, '%20'); return get(index, url, that).then(formatFetch); }; AnimeApi.prototype.detail = function (torrent_id, old_data, debug) { var that = this; var index = 0; var url = that.apiURL[index] + "anime/" + torrent_id; return get(index, url, that).then(formatDetail); }; module.exports = AnimeApi;
更改後文本
開啟檔案
'use strict'; var _ = require('lodash'); var Generic = require('butter-provider'); var inherits = require('util').inherits; var Q = require('q'); var querystring = require('querystring'); var request = require('request'); var sanitize = require('butter-sanitize'); var AnimeApi = function (args) { var that = this; AnimeApi.super_.call(this); if (args.apiURL) { this.apiURL = args.apiURL.split(','); } }; inherits(AnimeApi, Generic); AnimeApi.prototype.config = { name: 'AnimeApi', uniqueId: 'mal_id', tabName: 'AnimeApi', type: 'anime', metadata: 'trakttv:anime-metadata' }; function formatFetch(animes) { var results = _.map(animes, function (anime) { return { // images: anime.images, images: { poster: 'https://media.kitsu.io/anime/poster_images/' + anime._id + '/large.jpg', fanart: 'https://media.kitsu.io/anime/cover_images/' + anime._id + '/original.jpg', }, mal_id: anime._id, haru_id: anime._id, tvdb_id: 'mal-' + anime._id, imdb_id: anime._id, slug: anime.slug, title: anime.title, year: anime.year, type: anime.type, item_data: anime.type, rating: anime.rating }; }); return {results: sanitize(results), hasMore: true}; }; function formatDetail(anime) { var result = { mal_id: anime._id, haru_id: anime._id, tvdb_id: 'mal-' + anime._id, imdb_id: anime._id, slug: anime.slug, title: anime.title, item_data: anime.type, country: 'Japan', genre: anime.genres, genres: anime.genres, num_seasons: 1, runtime: anime.runtime, status: anime.status, synopsis: anime.synopsis, network: [], //FIXME rating: anime.rating, // images: anime.images, images: { poster: 'https://media.kitsu.io/anime/poster_images/' + anime._id + '/large.jpg', fanart: 'https://media.kitsu.io/anime/cover_images/' + anime._id + '/original.jpg', }, backdrop: anime.images.fanart, poster: anime.images.poster, year: anime.year, type: anime.type }; if (anime.type === 'show') { result = _.extend(result, {episodes: anime.episodes}); } else { // ret = _.extend(ret, { // cover: img, // rating: item.score, // subtitle: undefined, // torrents: movieTorrents(item.id, item.episodes) // }); } return sanitize(result); }; function processCloudFlareHack(options, url) { var req = options; var match = url.match(/^cloudflare\+(.*):\/\/(.*)/); if (match) { req = _.extend(req, { uri: match[1] + '://cloudflare.com/', headers: { 'Host': match[2], 'User-Agent': 'Mozilla/5.0 (Linux) AppleWebkit/534.30 (KHTML, like Gecko) PT/3.8.0' } }); } return req; }; function get(index, url, that) { var deferred = Q.defer(); var options = { url: url, json: true }; var req = processCloudFlareHack(options, that.apiURL[index]); console.info('Request to AnimeApi', req.url); request(req, function (err, res, data) { if (err || res.statusCode >= 400) { console.warn('AnimeAPI endpoint \'%s\' failed.', that.apiURL[index]); if (index + 1 >= that.apiURL.length) { return deferred.reject(err || 'Status Code is above 400'); } else { return get(index + 1, url, that); } } else if (!data || data.error) { err = data ? data.status_message : 'No data returned'; console.error('API error:', err); return deferred.reject(err); } else { return deferred.resolve(data); } }); return deferred.promise; }; AnimeApi.prototype.extractIds = function (items) { return _.map(items.results, 'mal_id'); }; AnimeApi.prototype.fetch = function (filters) { var that = this; var params = {}; params.sort = 'seeds'; params.limit = '50'; if (filters.keywords) { params.keywords = filters.keywords.replace(/\s/g, '% '); } if (filters.genre) { params.genre = filters.genre; } if (filters.order) { params.order = filters.order; } if (filters.sorter && filters.sorter !== 'popularity') { params.sort = filters.sorter; } var index = 0; var url = that.apiURL[index] + 'animes/' + filters.page + '?' + querystring.stringify(params).replace(/%25%20/g, '%20'); return get(index, url, that).then(formatFetch); }; AnimeApi.prototype.detail = function (torrent_id, old_data, debug) { var that = this; var index = 0; var url = that.apiURL[index] + "anime/" + torrent_id; return get(index, url, that).then(formatDetail); }; module.exports = AnimeApi;
尋找差異