Created
February 6, 2017 07:01
-
-
Save bachue/626f521c38d321f43b951ffb00ac0261 to your computer and use it in GitHub Desktop.
下载数值分析的视频
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rest_client' | |
require 'nokogiri' | |
HOST = 'http://moocs.nccu.edu.tw'.freeze | |
html = Nokogiri::HTML(RestClient.get(HOST + '/course/14/section/lecture').body) | |
html.css('li.lecture>.main>.title>a.link').each do |lecture| | |
href = lecture.attr('href') | |
title = lecture.css('.value').first.attr('title') | |
page = Nokogiri::HTML(RestClient.get(HOST + href).body) | |
href = page.css('.srcFrom>a').first.attr('href') | |
system 'youtube-dl', '-o', 'title.%(ext)s', href | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment