V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
oyps
V2EX  ›  程序员

用 Go 编写的蓝奏云解析工具,提供 API 和终端支持

  •  
  •   oyps ·
    oyps · 49 天前 · 1886 次点击
    这是一个创建于 49 天前的主题,其中的信息可能已经有所发展或是发生改变。

    🍎 go-lanzou 🍑

    🐱 项目地址https://github.com/iuroc/go-lanzou

    ⬇️ 可执行程序go-lanzou.exe [7.53MB]

    已实现功能

    • 获取单个文件(可带密码)的直链
    • 获取文件夹(可带密码)内最新一个文件的直链
    • 获取文件夹(可带密码)内任意页码的文件列表

    作为模块

    go get github.com/iuroc/go-lanzou
    
    package main
    
    import (
    	"fmt"
    	"github.com/iuroc/go-lanzou/lanzou"
    )
    
    func main() {
    	shareURL := "https://www.lanzoui.com/imcSy2340ssb"
    	downloadURL, err := lanzou.GetDownloadURL(shareURL)
    	if err != nil {
    		fmt.Println("解析失败")
    	} else {
    		fmt.Println("解析成功:" + downloadURL)
    	}
    }
    

    API

    // 获取文件夹最新的一个文件的信息,包含直链
    //
    // urlOrId 是文件夹的分享链接或 ID
    //
    // password 是访问密码
    func lanzou.GetLatestFile(shareURL string, password string) (*lanzou.DownloadInfo, error)
    
    // 获取单个文件的信息,包含直链
    func lanzou.GetDownloadInfo(shareURL string, password string) (*lanzou.DownloadInfo, error)
    
    // 获取文件夹中指定页码的文件列表
    //
    // page 的值务必从 0 开始,每次只允许增长 1 ,不可以直接从 0 变为 2 。
    //
    // 每次换页,务必暂停 1 秒以上。
    func lanzou.GetFileList(shareURL string, password string, page int) ([]FileInfo, error)
    
    3 条回复    2024-07-21 14:59:28 +08:00
    adrianzhang
        1
    adrianzhang  
       49 天前
    点赞👍,有用!
    molezznet
        2
    molezznet  
       48 天前
    厉害 收藏 待用
    oiken
        3
    oiken  
       48 天前
    点赞👍,有用!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2197 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 01:53 · PVG 09:53 · LAX 18:53 · JFK 21:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.