KCNLanzouDirectLink ist eine C# native Implementierungsbibliothek, mit der Lanzou -Cloud -Sharing -Links analysiert und lineare Links erhalten wird. Es bietet eine einfache API, um direkte Links zur Blueshu-Cloud-Freigabe ohne Anmeldung oder Drittanbieter-Tools zu erhalten.
Dieses Projekt unterstützt die folgenden .NET -Versionen:
.NET 6 , .NET 7 , .NET 8 und spätere Versionen von .NET. Sie können die KCNLanzouDirectLink -Bibliothek über den Nuget -Paket -Manager installieren:
Install-Package KCNLanzouDirectLinkOder durch die .NET CLI:
dotnet add package KCNLanzouDirectLinkHolen Sie sich einen direkten Link für normale Links
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 } " ) ;
}
}
}Holen Sie sich den direkten Link für verschlüsselte Links
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 } " ) ;
}
}
}Massenerwerb von Links mit gemeinsamen Links (unterstützt die gemischte Akquisition von gewöhnlichen/verschlüsselten Links)
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 } " ) ;
}
}
}
}Linkdateiinformationen abrufen
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 } " ) ;
}
}
} Aufzählen Sie DownloadState Beschreibung
public enum DownloadState
{
/// <summary>
/// 操作成功完成。
/// </summary>
Success ,
/// <summary>
/// 未提供有效的分享链接。
/// </summary>
UrlNotProvided ,
/// <summary>
/// 无法获取网页内容。分享链接无效?
/// </summary>
HtmlContentNotFound ,
/// <summary>
/// 无法解析加密信息。分享链接无效或密钥错误?
/// </summary>
PostsignNotFound ,
/// <summary>
/// 无法解析中间链接。
/// </summary>
IntermediateUrlNotFound ,
/// <summary>
/// 无法获取最终的直链地址。
/// </summary>
FinalUrlNotFound ,
/// <summary>
/// 未知错误,操作未成功完成。
/// </summary>
Error
} Beschreibung der Dateiinformationsakquisitionsstruktur Klasse 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 ; }
} Bitte besuchen Sie das GitHub -Repository, um die Klassenbibliotheks -Demo anzuzeigen: https://github.com/jddkcn/kcnlanzoudirectLink
Dieses Projekt verwendet die A-GPLV3-Lizenzvereinbarung.
Stellen Sie Fragen und Vorschläge zur Verbesserung oder senden Sie direkt eine Pull -Anfrage!