Fix douban imdb parse
This commit is contained in:
parent
488bf80551
commit
6cc53a4c92
|
@ -58,7 +58,7 @@ namespace Jellyfin.Plugin.MetaShark.Api
|
||||||
Regex regDuration = new Regex(@"片长: (.+?)\n", RegexOptions.Compiled);
|
Regex regDuration = new Regex(@"片长: (.+?)\n", RegexOptions.Compiled);
|
||||||
Regex regScreen = new Regex(@"上映日期: (.+?)\n", RegexOptions.Compiled);
|
Regex regScreen = new Regex(@"上映日期: (.+?)\n", RegexOptions.Compiled);
|
||||||
Regex regSubname = new Regex(@"又名: (.+?)\n", RegexOptions.Compiled);
|
Regex regSubname = new Regex(@"又名: (.+?)\n", RegexOptions.Compiled);
|
||||||
Regex regImdb = new Regex(@"IMDb: (.+?)$", RegexOptions.Compiled);
|
Regex regImdb = new Regex(@"IMDb: (tt\d+)", RegexOptions.Compiled);
|
||||||
Regex regSite = new Regex(@"官方网站: (.+?)\n", RegexOptions.Compiled);
|
Regex regSite = new Regex(@"官方网站: (.+?)\n", RegexOptions.Compiled);
|
||||||
Regex regNameMath = new Regex(@"(.+第\w季|[\w\uff1a\uff01\uff0c\u00b7]+)\s*(.*)", RegexOptions.Compiled);
|
Regex regNameMath = new Regex(@"(.+第\w季|[\w\uff1a\uff01\uff0c\u00b7]+)\s*(.*)", RegexOptions.Compiled);
|
||||||
Regex regRole = new Regex(@"\([饰|配] (.+?)\)", RegexOptions.Compiled);
|
Regex regRole = new Regex(@"\([饰|配] (.+?)\)", RegexOptions.Compiled);
|
||||||
|
@ -220,7 +220,7 @@ namespace Jellyfin.Plugin.MetaShark.Api
|
||||||
var contentNode = doc.QuerySelector("#content");
|
var contentNode = doc.QuerySelector("#content");
|
||||||
if (contentNode != null)
|
if (contentNode != null)
|
||||||
{
|
{
|
||||||
var nameStr = contentNode.GetText("h1>span:first-child");
|
var nameStr = contentNode.GetText("h1>span:first-child") ?? string.Empty;
|
||||||
var match = this.regNameMath.Match(nameStr);
|
var match = this.regNameMath.Match(nameStr);
|
||||||
var name = string.Empty;
|
var name = string.Empty;
|
||||||
var orginalName = string.Empty;
|
var orginalName = string.Empty;
|
||||||
|
|
|
@ -230,7 +230,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通过imdb获取tmdbId
|
// 通过imdb获取tmdbId(豆瓣的imdb id可能是旧的,需要先从omdb接口获取最新的imdb id)
|
||||||
protected async Task<string?> GetTmdbIdByImdbAsync(string imdb, string language, CancellationToken cancellationToken)
|
protected async Task<string?> GetTmdbIdByImdbAsync(string imdb, string language, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(imdb))
|
if (string.IsNullOrEmpty(imdb))
|
||||||
|
@ -238,7 +238,6 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通过imdb获取TMDB id (豆瓣的imdb id可能是旧的,需要先从omdb接口获取最新的imdb id
|
|
||||||
var omdbItem = await this._omdbApi.GetByImdbID(imdb, cancellationToken).ConfigureAwait(false);
|
var omdbItem = await this._omdbApi.GetByImdbID(imdb, cancellationToken).ConfigureAwait(false);
|
||||||
if (omdbItem != null)
|
if (omdbItem != null)
|
||||||
{
|
{
|
||||||
|
@ -258,7 +257,8 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
// 接口出错,返回旧的
|
||||||
|
return imdb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue