public async Task <MetadataResult <Episode> > GetMetadata(EpisodeInfo info, CancellationToken cancellationToken) { _logger.LogInformation($"Douban:GetMetadata for episode {info.Name}"); var result = new MetadataResult <Episode>(); if (info.IsMissingEpisode) { _logger.LogInformation("Do not support MissingEpisode"); return(result); } var sid = info.GetProviderId(ProviderID); if (string.IsNullOrEmpty(sid)) { var searchResults = await SearchFrodoByName(info.Name, "tv", cancellationToken).ConfigureAwait(false); sid = searchResults.FirstOrDefault()?.Id; } if (!info.IndexNumber.HasValue) { _logger.LogInformation("No episode num found, please check " + "the format of file name"); return(result); } // Start to get information from douban result.Item = new Episode { Name = info.Name, IndexNumber = info.IndexNumber, ParentIndexNumber = info.ParentIndexNumber }; result.Item.SetProviderId(ProviderID, sid); var url = string.Format("https://movie.douban.com/subject/{0}" + "/episode/{1}/", sid, info.IndexNumber); string content = await _doubanAccessor.GetResponseWithDelay(url, cancellationToken); string pattern_name = "data-name=\\\"(.*?)\\\""; Match match = Regex.Match(content, pattern_name); if (match.Success) { var name = HttpUtility.HtmlDecode(match.Groups[1].Value); _logger.LogDebug("The name is {0}", name); result.Item.Name = name; } string pattern_desc = "data-desc=\\\"(.*?)\\\""; match = Regex.Match(content, pattern_desc); if (match.Success) { var desc = HttpUtility.HtmlDecode(match.Groups[1].Value); _logger.LogDebug("The desc is {0}", desc); result.Item.Overview = desc; } result.HasMetadata = true; return(result); }