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;
查找差异