KCNLanzouDirectLink é uma biblioteca de implementação nativa C# usada para analisar links de compartilhamento de nuvem Lanzou e obter links lineares. Ele fornece uma API simples para obter links diretos para o compartilhamento de nuvem Blueshu sem ferramentas de login ou terceiros.
Este projeto suporta as seguintes versões .NET:
.NET 6 , .NET 7 , .NET 8 , e versões posteriores do .net. Você pode instalar a biblioteca KCNLanzouDirectLink através do Nuget Package Manager:
Install-Package KCNLanzouDirectLinkOu através da .NET CLI:
dotnet add package KCNLanzouDirectLinkObtenha um link direto para links normais
using KCNLanzouDirectLink ;
class Program
{
static async Task Main ( string [ ] args )
{
string shareUrl = "https://syxz.lanzoue.com/qwertyuiopas" ;
var ( state , link ) = await KCNLanzouLinkHelper . GetDirectLinkAsync ( shareUrl ) ;
if ( state == DownloadState . Success )
{
Console . WriteLine ( $ "直链地址: { link } " ) ;
}
else
{
Console . WriteLine ( $ "获取直链失败,状态: { state } " ) ;
}
}
}Obtenha o link direto para links criptografados
using KCNLanzouDirectLink ;
class Program
{
static async Task Main ( string [ ] args )
{
string shareUrl = "https://syxz.lanzoue.com/qwertyuiopas" ;
string key = "your_encryption_key" ;
// 10 代表错误后重试次数。加密链接获取直链不稳定,推荐设置为10次。
var ( state , linkEncryption ) = await KCNLanzouLinkHelper . GetDirectLinkAsync ( shareUrl , key , 10 ) ;
if ( state == DownloadState . Success )
{
Console . WriteLine ( $ "直链地址: { linkEncryption } " ) ;
}
else
{
Console . WriteLine ( $ "获取直链失败,状态: { state } " ) ;
}
}
}Aquisição em massa de links de compartilhamento links diretos (suporta a aquisição mista de links ordinários/criptografados)
using KCNLanzouDirectLink ;
class Program
{
static async Task Main ( string [ ] args )
{
var urls = new List < Tuple < string , string > >
{
Tuple . Create ( "https://syxz.lanzoue.com/qwertyuiopas" , string . Empty ) ,
Tuple . Create ( "https://syxz.lanzouw.com/abcdefghijkl" , "your_encryption_key" )
} ;
// 该方法泛型传参允许实现 string 及 Tuple<string, string>。
var results = await KCNLanzouLinkHelper . GetDirectLinksAsync ( urls ) ;
foreach ( var ( url , state , link ) in results )
{
if ( state == DownloadState . Success )
{
Console . WriteLine ( $ " { url } 解析直链地址: { link } " ) ;
}
else
{
Console . WriteLine ( $ " { url } 获取直链失败,状态: { state } " ) ;
}
}
}
}Obtenha informações do arquivo de link
using KCNLanzouDirectLink ;
class Program
{
static async Task Main ( string [ ] args )
{
string shareUrl = "https://syxz.lanzoue.com/qwertyuiopas" ;
string key = "your_encryption_key" ;
// true表示强制指定分享链接为加密链接类型。具体信息请查看方法重载。
var ( state , fileInfo ) = await KCNLanzouLinkHelper . GetFileInfoAsync ( true , shareUrl , key ) ;
if ( state == DownloadState . Success )
{
string message = $ "文件信息解析成功: n " +
$ "File info retrieved successfully: n " +
$ "文件名称\ File Name: { fileInfo . FileName } n " +
$ "文件大小\ File Size: { fileInfo . Size } n " +
$ "上传时间\ Upload Time: { fileInfo . UploadTime } n " +
$ "上传者\ Uploader: { fileInfo . Uploader } n " +
$ "运行平台\ Platform: { fileInfo . Platform } n " +
$ "文件描述\ Description: { fileInfo . Description } " ;
Console . WriteLine ( $ "直链地址: { message } " ) ;
}
else
{
Console . WriteLine ( $ "获取文件信息失败,状态: { state } " ) ;
}
}
} Enumere DownloadState Descrição
public enum DownloadState
{
/// <summary>
/// 操作成功完成。
/// </summary>
Success ,
/// <summary>
/// 未提供有效的分享链接。
/// </summary>
UrlNotProvided ,
/// <summary>
/// 无法获取网页内容。分享链接无效?
/// </summary>
HtmlContentNotFound ,
/// <summary>
/// 无法解析加密信息。分享链接无效或密钥错误?
/// </summary>
PostsignNotFound ,
/// <summary>
/// 无法解析中间链接。
/// </summary>
IntermediateUrlNotFound ,
/// <summary>
/// 无法获取最终的直链地址。
/// </summary>
FinalUrlNotFound ,
/// <summary>
/// 未知错误,操作未成功完成。
/// </summary>
Error
} Descrição da classe de aquisição de informações de arquivos Classe LanzouFileInfo
public class LanzouFileInfo
{
/// <summary>
/// 文件名称
/// </summary>
public string ? FileName { get ; set ; }
/// <summary>
/// 上传时间
/// </summary>
public string ? UploadTime { get ; set ; }
/// <summary>
/// 文件大小
/// </summary>
public string ? Size { get ; set ; }
/// <summary>
/// 上传者
/// </summary>
public string ? Uploader { get ; set ; }
/// <summary>
/// 运行平台
/// </summary>
public string ? Platform { get ; set ; }
/// <summary>
/// 文件描述
/// </summary>
public string ? Description { get ; set ; }
} Por favor, vá ao repositório do GitHub para ver a demonstração da biblioteca de classes: https://github.com/jddkcn/kcnlanzoudirectlink
Este projeto usa o contrato de licença A-GPLV3.
Faça perguntas, sugestões de melhoria ou envie uma solicitação de tração diretamente!