Code Monkey home page Code Monkey logo

Comments (5)

Foair avatar Foair commented on July 28, 2024 1

哈哈,我找到方法了,我就说怎么突然就下载成英文字幕了。

只要先获取一次 JSON 字幕,下载字幕的地址就会下载相应语言的字幕。

偶然发现,字幕的问题应该可以解决了,等我个两天。

谢谢你啦 ^_^

from course-crawler.

Foair avatar Foair commented on July 28, 2024

这个是最新版本,学堂在线没有实现下载字幕的功能。

现在我已经将学堂在线下载字幕加到我的 TODO 里面了,具体什么时候能够更新我也不知道。

谢谢关注 : )

from course-crawler.

forkforlearn avatar forkforlearn commented on July 28, 2024

似乎在get_content中加入

                        srt_file = file_name + '.srt'
                        srt_link = block.find("a", text="下载字幕")
                        if srt_link:
                            print("srt link:", "http://www.xuetangx.com/" + srt_link["href"])
                            #srt_resource = CONNECTION.get("http://www.xuetangx.com/" + srt_link["href"]).text
                            #SRT = open(os.path.join(BASE_DIR, master_name), 'w', encoding='utf-8')
                            #SRT.write(srt_resource)
                            #SRT.close()
                            _temp = "http://www.xuetangx.com/" + srt_link["href"]
                            #在start中加入全局SRT,并打开、关闭
                            SRT.write(_temp + '\n')
                            RENAMER.write('REN "' + _temp + '" "' +  '%s.srt"\n' % master_name)
                        else:
                            print('not found:', master_name)

即可:)
另外,在get_video中加入一个判断(quality10,quality20的)会更稳定,有些视频只有低解析度,没有高清,再次感谢老兄的工作

from course-crawler.

Foair avatar Foair commented on July 28, 2024

Thanks ♪(・ω・)ノ

其实我是想找到一个更加通用的获得字幕的方法,有些视频并没有给出下载字幕的按钮,然而还是可以获得字幕的。

比如这个:http://www.xuetangx.com/courses/course-v1:TsinghuaX+90640012X+sp/about

上面这个有两种字幕,暂时还无法都获得 SRT 文件,而后端返回的是 JSON

http://www.xuetangx.com/courses/course-v1:TsinghuaX+90640012X+sp/xblock/block-v1:TsinghuaX+90640012X+sp+type@video+block@8e5cacc04a364047a439bf58d12964fd/handler/transcript/translation/zh

http://www.xuetangx.com/courses/course-v1:TsinghuaX+90640012X+sp/xblock/block-v1:TsinghuaX+90640012X+sp+type@video+block@8e5cacc04a364047a439bf58d12964fd/handler/transcript/translation/en_xuetangx

获得可用的字幕列表:

http://www.xuetangx.com/courses/course-v1:TsinghuaX+90640012X+sp/xblock/block-v1:TsinghuaX+90640012X+sp+type@video+block@8e5cacc04a364047a439bf58d12964fd/handler/transcript/available_translations

仿照其他可以下载字幕的视频,得到如下地址:

http://www.xuetangx.com/courses/course-v1:TsinghuaX+90640012X+sp/xblock/block-v1:TsinghuaX+90640012X+sp+type@video+block@8e5cacc04a364047a439bf58d12964fd/handler/transcript/download

这个是中文的,那么英文的 SRT 文件怎么获得呢?我现在就卡在这里了。

不知道有没有可以选择语言下载字幕的视频,如果有的话,问题就解决了。然后所有有字幕的视频都可以下载字幕了。

不知道你有没有什么发现呢?

from course-crawler.

forkforlearn avatar forkforlearn commented on July 28, 2024

老兄你太客气了,我基本没帮上啥忙。。。说的我都不好意思啦:)

from course-crawler.

Related Issues (20)

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.