Giter Club home page Giter Club logo

xmlyfetcher's Introduction

xmlyfetcher 【全新升级!!!】

该工具用于下载喜马拉雅歌曲资源,可以下载单个音频资源,也可以下载整个专辑. 喜欢的请打个红心!!!

asciicast

安装

  1. 确认是否安装Python,一般系统会自带
python -V
  1. 安装该工具
wget https://raw.githubusercontent.com/smallmuou/xmlyfetcher/master/xmlyfetcher
sudo cp xmlyfetcher /usr/local/bin
sudo chmod +x /usr/local/bin/xmlyfetcher

使用

xmlyfetcher 专辑ID 类型 参数

专辑ID可以通过浏览器URL获取,如https://www.ximalaya.com/album/2677356,则专辑ID为2677356

类型分为3种,分别是all、page、track

all - 下载整个专辑
page - 下载若干页曲目,支持传递多个页号,从1开始,每页30
track - 下载若干曲目,支持传递多个曲目ID,曲目ID可以通过浏览器URL获取,比如点击某个曲目,其URL为https://www.ximalaya.com/sound/25202,则曲目ID为25202

# 下载专辑
xmlyfetcher 12891461 all

# 下载专辑前2页
xmlyfetcher 12891461 page 1 2

# 下载单个曲目
xmlyfetcher 12891461 track 211393643

PS: 可以使用xmlyfetcher -h查看更详细的帮助

xmlyfetcher version 2.0.0 by smallmuou

USAGE: xmlyfetcher [OPTIONS] albumId type [type-param1 [type-param1 ...]]

DESCRIPTION:
    This tool is used to download tracks under ximalaya.com.

    albumId - the id of album, you can see from url,like https://www.ximalaya.com/album/2677356, the albumId is 2677356
    type - all/page/track, when type is all, no type-params required; when type is page, the type-params is the pagenum (start with 1); when type is track, the type-params is trackid;
    trackId - the id of track, you can see from url,like https://www.ximalaya.com/sound/25202, the trackId is 25202

OPTIONS:
    -h      Show this help message and exit.
    -o      Output directory, default is current directory.

EXAMPLES:
    xmlyfetcher 12891461 all
    xmlyfetcher 12891461 page 1 2 3
    xmlyfetcher 12891461 track 211393643
    xmlyfetcher -o ~/tmp 12891461 track 211393643

版本记录

  • 2.0.1(2023.2.7)

    • 适配python3
    • 支持下载到指定目录
  • 2.0.0(2023.1.31)

    • 修复无法下载专辑BUG
    • 支持指定若干页面下载
    • 参数格式调整
  • 1.1.1(2019.9.29)

    • 修复下载资源名称包括非法字母,导致"没有那个文件或目录"问题
  • 1.1.0(2019.9.12)

    • 改为接口获取专辑信息,而不是解析HTML
  • 1.0.3(2019.9.10)

    • 移除了jshon依赖
    • 修复无法获取专辑问题
  • 1.0.2

    • 修复无法获取专辑问题
  • 1.0.1

    • 支持下载一个专辑的所有歌曲(支持翻页)
  • 1.0.0

    • 支持下载单个歌曲和专辑

许可

该开源工具具有MIT许可协议. 本工具仅限个人学习,不用于商业等用途. 所涉及的音视频资源版权归喜马拉雅所有.

xmlyfetcher's People

Contributors

bubbu0129 avatar jacksong18 avatar smallmuou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xmlyfetcher's Issues

编译jshon报错: jshon.c:8:10: fatal error: jansson.h: No such file or directory

编译jshon报错
按照文档来的

wget http://kmkeen.com/jshon/jshon.tar.gz
tar -zxf jshon.tar.gz
cd jshon-20120914/
make
cc -std=c99 -Wall -pedantic -Wextra -Werror    -c -o jshon.o jshon.c
jshon.c:8:10: fatal error: jansson.h: No such file or directory
 #include <jansson.h>
          ^~~~~~~~~~~
compilation terminated.
<builtin>: recipe for target 'jshon.o' failed
make: *** [jshon.o] Error 1

gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

专辑无法下载

$ xmlyfetcher https://www.ximalaya.com/ertong/6233693/
warning: nothing to read
internal error: stack underflow
json read error: line 2 column 0: '[' or '{' expected near end of file
json read error: line 2 column 0: '[' or '{' expected near end of file
/usr/local/bin/xmlyfetcher: line 167: [: %: integer expression expected
/usr/local/bin/xmlyfetcher: line 169: ((: i<=/: syntax error: operand expected (error token is "/")
[INFO] Contain 0 track(s), start fetch ...

修复方法:
sed -n 's/.AlbumDetailTrackList":(.)};</script>.*$/\1/p'

第一次在github上提issue,我怎么直接修改后提交呢

下载专辑报错

xmlyfetcher https://www.ximalaya.com/lishi/19572564/
json read error: line 1 column 47806: end of file expected near ';'
json read error: line 2 column 0: '[' or '{' expected near end of file
json read error: line 2 column 0: '[' or '{' expected near end of file
/usr/local/bin/xmlyfetcher: line 165: [: %: integer expression expected
/usr/local/bin/xmlyfetcher: line 167: ((: i<=/: syntax error: operand expected (error token is "/")
[INFO] Contain 0 track(s), start fetch ...

OS: Ubuntu18.04 LTS X64

某些系统环境下发生trackId not exist错误

在一个vagrant里的Ubuntu系统下载单音轨或者专辑都碰到了以下错误:

$ ./xmlyfetcher https://www.ximalaya.com/ertong/12891461/211393643
[INFO] Fetch track 1/1 ...
[ERROR] The trackId 211393643 does not exist.

换用vps后一切正常。

PS:
在msys2环境下有以下错误,可能跟调用的python版本有关系,我从shell直接输入python打开的是python2.7.12,但这个脚本调用的似乎却是另一位置的python3,以下错误我通过删除reload(sys) sys.setdefaultencoding("utf8")两行解决了:

$ ./xmlyfetcher https://www.ximalaya.com/ertong/12891461/211393643
[INFO] Fetch track 1/1 ...
Traceback (most recent call last):
  File "<string>", line 2, in <module>
NameError: name 'reload' is not defined
Traceback (most recent call last):
  File "<string>", line 2, in <module>
NameError: name 'reload' is not defined
Traceback (most recent call last):
  File "<string>", line 2, in <module>
NameError: name 'reload' is not defined
[ERROR] Failed to fetch the track, may be a paid resource.

Error

warning: nothing to read
internal error: stack underflow
json read error: line 2 column 0: '[' or '{' expected near end of file
json read error: line 2 column 0: '[' or '{' expected near end of file
expr: syntax error
expr: syntax error
/usr/local/bin/xmlyfetcher: line 167: [: -ne: unary operator expected
/usr/local/bin/xmlyfetcher: line 170: ((: i<=: syntax error: operand expected (error token is "<=")
[INFO] Contain 0 track(s), start fetch ...

无法下载 album/5088825

当我尝试下载 album/5088825
出现以下错误信息
/usr/local/bin/xmlyfetcher: line 203: python: command not found
[INFO] Total count is
/usr/local/bin/xmlyfetcher: line 188: python: command not found
/usr/local/bin/xmlyfetcher: line 188: python: command not found

How to download paid track?

Hi, this tool works fine for free track. But how do I download the purchased VIP track. (i.e. I'm a paid member and able to listen the paid track. can I use this tool to download it?)

I have this error when I tried:
Traceback (most recent call last):
File "", line 1, in
KeyError: 'playUrl64'

fetch资源的时候报错

fetch资源的时候报错:
parse error: type 'object' has no elements to extract (arg 2)

请教一下该如何处理呢?谢谢

专辑无法下载

$ xmlyfetcher https://www.ximalaya.com/ertong/6233693/
warning: nothing to read
internal error: stack underflow
json read error: line 2 column 0: '[' or '{' expected near end of file
json read error: line 2 column 0: '[' or '{' expected near end of file
/usr/local/bin/xmlyfetcher: line 167: [: %: integer expression expected
/usr/local/bin/xmlyfetcher: line 169: ((: i<=/: syntax error: operand expected (error token is "/")
[INFO] Contain 0 track(s), start fetch ...

"\"转义报错

删除url64链接中的 \ 正则表达式报错
sed 's/\\\//g'
我修改为
sed 's/\\//g'
运行正确

https://www.ximalaya.com/ertong/383939/ 下载失败

xmlyfetcher https://www.ximalaya.com/ertong/383939/

warning: nothing to read
internal error: stack underflow
json read error: line 2 column 0: '[' or '{' expected near end of file
json read error: line 2 column 0: '[' or '{' expected near end of file
/usr/local/bin/xmlyfetcher: line 167: [: %: integer expression expected
/usr/local/bin/xmlyfetcher: line 169: ((: i<=/: syntax error: operand expected (error token is "/")
[�[1;32mINFO�[0m] Contain 0 track(s), start fetch ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.