- 浏览: 26866 次
- 性别:
- 来自: 北京
文章分类
最新评论
RailsCasts批量下载地址之Ruby代码
千呼万唤的Rails3出来了,也该开始学学了,从网上发现一个好的教程http://railscasts.com/episodes,能够下载
但遗憾的是每页只显示10个而且无法批量下载,如是发现右边栏有All Episodes链接。
但是这个没有下载地址,只能一个个点进去才能看见下载地址。仔细对比这两个地址
http://railscasts.com/episodes/234-simple-form
http://media.railscasts.com/videos/234_simple_form.mov
发现他们之间有一定的对应关系,狂喜,于是有了如下代码
01 |
require 'open-uri'
|
02 |
open( 'http://railscasts.com/episodes/archive' ) do |f|
|
03 |
s= ""
|
04 |
f. each do |line|
|
05 |
s<<line
|
06 |
end
|
07 |
08 |
allUrls= File . new ( File .join( "C:" , "RailCastsVideoURLs.txt" ), "w+" )
|
09 |
m=/href= "(\/episodes\/.+)" /
|
10 |
urls= s.scan(m)
|
11 |
urls. each { |x|
|
12 |
begin
|
13 |
allUrls.puts x[ 0 ].gsub(/\/episodes\//, "http://media.railscasts.com/videos/" ).gsub(/-/, "_" ).to_s+ ".mov"
|
14 |
end
|
15 |
}
|
16 |
allUrls.close
|
17 |
end |
运行以上代码,可以得到要下载的所有地址,当然前提是你要安装ruby, 如果你没装,那我附上所有的地址吧!找到地址后我相信大家知道怎么下载了,你可以写段Ruby脚本下载,当然我更喜欢用迅雷呀。
http://media.railscasts.com/videos/234_simple_form.mov
http://media.railscasts.com/videos/233_engage_with_devise.mov
http://media.railscasts.com/videos/232_routing_walkthrough_part_2.mov
http://media.railscasts.com/videos/231_routing_walkthrough.mov
http://media.railscasts.com/videos/230_inherited_resources.mov
http://media.railscasts.com/videos/229_polling_for_changes.mov
http://media.railscasts.com/videos/228_sortable_table_columns.mov
http://media.railscasts.com/videos/227_upgrading_to_rails_3_part_3.mov
http://media.railscasts.com/videos/226_upgrading_to_rails_3_part_2.mov
http://media.railscasts.com/videos/225_upgrading_to_rails_3_part_1.mov
http://media.railscasts.com/videos/224_controllers_in_rails_3.mov
http://media.railscasts.com/videos/223_charts.mov
http://media.railscasts.com/videos/222_rack_in_rails_3.mov
http://media.railscasts.com/videos/221_subdomains_in_rails_3.mov
http://media.railscasts.com/videos/220_pdfkit.mov
http://media.railscasts.com/videos/219_active_model.mov
http://media.railscasts.com/videos/218_making_generators_in_rails_3.mov
http://media.railscasts.com/videos/217_multistep_forms.mov
http://media.railscasts.com/videos/216_generators_in_rails_3.mov
http://media.railscasts.com/videos/215_advanced_queries_in_rails_3.mov
http://media.railscasts.com/videos/214_a_b_testing_with_a_bingo.mov
http://media.railscasts.com/videos/213_calendars.mov
http://media.railscasts.com/videos/212_refactoring_dynamic_delegator.mov
http://media.railscasts.com/videos/211_validations_in_rails_3.mov
http://media.railscasts.com/videos/210_customizing_devise.mov
http://media.railscasts.com/videos/209_introducing_devise.mov
http://media.railscasts.com/videos/208_erb_blocks_in_rails_3.mov
http://media.railscasts.com/videos/207_syntax_highlighting.mov
http://media.railscasts.com/videos/206_action_mailer_in_rails_3.mov
http://media.railscasts.com/videos/205_unobtrusive_javascript.mov
http://media.railscasts.com/videos/204_xss_protection_in_rails_3.mov
http://media.railscasts.com/videos/203_routing_in_rails_3.mov
http://media.railscasts.com/videos/202_active_record_queries_in_rails_3.mov
http://media.railscasts.com/videos/201_bundler.mov
http://media.railscasts.com/videos/200_rails_3_beta_and_rvm.mov
http://media.railscasts.com/videos/199_mobile_devices.mov
http://media.railscasts.com/videos/198_edit_multiple_individually.mov
http://media.railscasts.com/videos/197_nested_model_form_part_2.mov
http://media.railscasts.com/videos/196_nested_model_form_part_1.mov
http://media.railscasts.com/videos/195_my_favorite_web_apps_in_2009.mov
http://media.railscasts.com/videos/194_mongodb_and_mongomapper.mov
http://media.railscasts.com/videos/193_tableless_model.mov
http://media.railscasts.com/videos/192_authorization_with_cancan.mov
http://media.railscasts.com/videos/191_mechanize.mov
http://media.railscasts.com/videos/190_screen_scraping_with_nokogiri.mov
http://media.railscasts.com/videos/189_embedded_association.mov
http://media.railscasts.com/videos/188_declarative_authorization.mov
http://media.railscasts.com/videos/187_testing_exceptions.mov
http://media.railscasts.com/videos/186_pickle_with_cucumber.mov
http://media.railscasts.com/videos/185_formtastic_part_2.mov
http://media.railscasts.com/videos/184_formtastic_part_1.mov
http://media.railscasts.com/videos/183_gemcutter_jeweler.mov
http://media.railscasts.com/videos/182_cropping_images.mov
http://media.railscasts.com/videos/181_include_vs_joins.mov
http://media.railscasts.com/videos/180_finding_unused_css.mov
http://media.railscasts.com/videos/179_seed_data.mov
http://media.railscasts.com/videos/178_seven_security_tips.mov
http://media.railscasts.com/videos/177_model_versioning.mov
http://media.railscasts.com/videos/176_searchlogic.mov
http://media.railscasts.com/videos/175_ajax_history_and_bookmarks.mov
http://media.railscasts.com/videos/174_pagination_with_ajax.mov
http://media.railscasts.com/videos/173_screen_scraping_with_scrapi.mov
http://media.railscasts.com/videos/172_touch_and_cache.mov
http://media.railscasts.com/videos/171_delayed_job.mov
http://media.railscasts.com/videos/170_openid_with_authlogic.mov
http://media.railscasts.com/videos/169_dynamic_page_caching.mov
http://media.railscasts.com/videos/168_feed_parsing.mov
http://media.railscasts.com/videos/167_more_on_virtual_attributes.mov
http://media.railscasts.com/videos/166_metric_fu.mov
http://media.railscasts.com/videos/165_edit_multiple.mov
http://media.railscasts.com/videos/164_cron_in_ruby.mov
http://media.railscasts.com/videos/163_self_referential_association.mov
http://media.railscasts.com/videos/162_tree_based_navigation.mov
http://media.railscasts.com/videos/161_three_profiling_tools.mov
http://media.railscasts.com/videos/160_authlogic.mov
http://media.railscasts.com/videos/159_more_on_cucumber.mov
http://media.railscasts.com/videos/158_factories_not_fixtures.mov
http://media.railscasts.com/videos/157_rspec_matchers_macros.mov
http://media.railscasts.com/videos/156_webrat.mov
http://media.railscasts.com/videos/155_beginning_with_cucumber.mov
http://media.railscasts.com/videos/154_polymorphic_association.mov
http://media.railscasts.com/videos/153_pdfs_with_prawn.mov
http://media.railscasts.com/videos/152_rails_2_3_extras.mov
http://media.railscasts.com/videos/151_rack_middleware.mov
http://media.railscasts.com/videos/150_rails_metal.mov
http://media.railscasts.com/videos/149_rails_engines.mov
http://media.railscasts.com/videos/148_app_templates_in_rails_2_3.mov
http://media.railscasts.com/videos/147_sortable_lists.mov
http://media.railscasts.com/videos/146_paypal_express_checkout.mov
http://media.railscasts.com/videos/145_integrating_active_merchant.mov
http://media.railscasts.com/videos/144_active_merchant_basics.mov
http://media.railscasts.com/videos/143_paypal_security.mov
http://media.railscasts.com/videos/142_paypal_notifications.mov
http://media.railscasts.com/videos/141_paypal_basics.mov
http://media.railscasts.com/videos/140_rails_2_2_extras.mov
http://media.railscasts.com/videos/139_nested_resources.mov
http://media.railscasts.com/videos/138_i18n.mov
http://media.railscasts.com/videos/137_memoization.mov
http://media.railscasts.com/videos/136_jquery.mov
http://media.railscasts.com/videos/135_making_a_gem.mov
http://media.railscasts.com/videos/134_paperclip.mov
http://media.railscasts.com/videos/133_capistrano_tasks.mov
http://media.railscasts.com/videos/132_helpers_outside_views.mov
http://media.railscasts.com/videos/131_going_back.mov
http://media.railscasts.com/videos/130_monitoring_with_god.mov
http://media.railscasts.com/videos/129_custom_daemon.mov
http://media.railscasts.com/videos/128_starling_and_workling.mov
http://media.railscasts.com/videos/127_rake_in_background.mov
http://media.railscasts.com/videos/126_populating_a_database.mov
http://media.railscasts.com/videos/125_dynamic_layouts.mov
http://media.railscasts.com/videos/124_beta_invitations.mov
http://media.railscasts.com/videos/123_subdomains.mov
http://media.railscasts.com/videos/122_passenger_in_development.mov
http://media.railscasts.com/videos/121_non_active_record_model.mov
http://media.railscasts.com/videos/120_thinking_sphinx.mov
http://media.railscasts.com/videos/119_session_based_model.mov
http://media.railscasts.com/videos/118_liquid.mov
http://media.railscasts.com/videos/117_semi_static_pages.mov
http://media.railscasts.com/videos/116_selenium.mov
http://media.railscasts.com/videos/115_caching_in_rails_2_1.mov
http://media.railscasts.com/videos/114_endless_page.mov
http://media.railscasts.com/videos/113_contributing_to_rails_with_git.mov
http://media.railscasts.com/videos/112_anonymous_scopes.mov
http://media.railscasts.com/videos/111_advanced_search_form.mov
http://media.railscasts.com/videos/110_gem_dependencies.mov
http://media.railscasts.com/videos/109_tracking_attribute_changes.mov
http://media.railscasts.com/videos/108_named_scope.mov
http://media.railscasts.com/videos/107_migrations_in_rails_2_1.mov
http://media.railscasts.com/videos/106_time_zones_in_rails_2_1.mov
http://media.railscasts.com/videos/105_gitting_rails_2_1_rc1.mov
http://media.railscasts.com/videos/104_exception_notifications.mov
http://media.railscasts.com/videos/103_site_wide_announcements.mov
http://media.railscasts.com/videos/102_auto_complete_association.mov
http://media.railscasts.com/videos/101_refactoring_out_helper_object.mov
http://media.railscasts.com/videos/100_5_view_tips.mov
http://media.railscasts.com/videos/99_complex_partials.mov
http://media.railscasts.com/videos/98_request_profiling.mov
http://media.railscasts.com/videos/97_analyzing_the_production_log.mov
http://media.railscasts.com/videos/96_git_on_rails.mov
http://media.railscasts.com/videos/95_more_on_activeresource.mov
http://media.railscasts.com/videos/94_activeresource_basics.mov
http://media.railscasts.com/videos/93_action_caching.mov
http://media.railscasts.com/videos/92_make_resourceful.mov
http://media.railscasts.com/videos/91_refactoring_long_methods.mov
http://media.railscasts.com/videos/90_fragment_caching.mov
http://media.railscasts.com/videos/89_page_caching.mov
http://media.railscasts.com/videos/88_dynamic_select_menus.mov
http://media.railscasts.com/videos/87_generating_rss_feeds.mov
http://media.railscasts.com/videos/86_logging_variables.mov
http://media.railscasts.com/videos/85_yaml_configuration_file.mov
http://media.railscasts.com/videos/84_cookie_based_session_store.mov
http://media.railscasts.com/videos/83_migrations_in_rails_2_0.mov
http://media.railscasts.com/videos/82_http_basic_authentication.mov
http://media.railscasts.com/videos/81_fixtures_in_rails_2_0.mov
http://media.railscasts.com/videos/80_simplify_views_with_rails_2_0.mov
http://media.railscasts.com/videos/79_generate_named_routes.mov
http://media.railscasts.com/videos/78_generating_pdf_documents.mov
http://media.railscasts.com/videos/77_destroy_without_javascript.mov
http://media.railscasts.com/videos/76_scope_out.mov
http://media.railscasts.com/videos/75_complex_forms_part_3.mov
http://media.railscasts.com/videos/74_complex_forms_part_2.mov
http://media.railscasts.com/videos/73_complex_forms_part_1.mov
http://media.railscasts.com/videos/72_adding_an_environment.mov
http://media.railscasts.com/videos/71_testing_controllers_with_rspec.mov
http://media.railscasts.com/videos/70_custom_routes.mov
http://media.railscasts.com/videos/69_markaby_in_helper.mov
http://media.railscasts.com/videos/68_openid_authentication.mov
http://media.railscasts.com/videos/67_restful_authentication.mov
http://media.railscasts.com/videos/66_custom_rake_tasks.mov
http://media.railscasts.com/videos/65_stopping_spam_with_akismet.mov
http://media.railscasts.com/videos/64_custom_helper_modules.mov
http://media.railscasts.com/videos/63_model_name_in_url.mov
http://media.railscasts.com/videos/62_hacking_activerecord.mov
http://media.railscasts.com/videos/61_sending_email.mov
http://media.railscasts.com/videos/60_testing_without_fixtures.mov
http://media.railscasts.com/videos/59_optimistic_locking.mov
http://media.railscasts.com/videos/58_how_to_make_a_generator.mov
http://media.railscasts.com/videos/57_create_model_through_text_field.mov
http://media.railscasts.com/videos/56_the_logger.mov
http://media.railscasts.com/videos/55_cleaning_up_the_view.mov
http://media.railscasts.com/videos/54_debugging_with_ruby_debug.mov
http://media.railscasts.com/videos/53_handling_exceptions.mov
http://media.railscasts.com/videos/52_update_through_checkboxes.mov
http://media.railscasts.com/videos/51_will_paginate.mov
http://media.railscasts.com/videos/50_contributing_to_rails.mov
http://media.railscasts.com/videos/49_reading_the_api.mov
http://media.railscasts.com/videos/48_console_tricks.mov
http://media.railscasts.com/videos/47_two_many_to_many.mov
http://media.railscasts.com/videos/46_catch_all_route.mov
http://media.railscasts.com/videos/45_rjs_tips.mov
http://media.railscasts.com/videos/44_debugging_rjs.mov
http://media.railscasts.com/videos/43_ajax_with_rjs.mov
http://media.railscasts.com/videos/42_with_options.mov
http://media.railscasts.com/videos/41_conditional_validations.mov
http://media.railscasts.com/videos/40_blocks_in_view.mov
http://media.railscasts.com/videos/39_customize_field_error.mov
http://media.railscasts.com/videos/38_multibutton_form.mov
http://media.railscasts.com/videos/37_simple_search_form.mov
http://media.railscasts.com/videos/36_subversion_on_rails.mov
http://media.railscasts.com/videos/35_custom_rest_actions.mov
http://media.railscasts.com/videos/34_named_routes.mov
http://media.railscasts.com/videos/33_making_a_plugin.mov
http://media.railscasts.com/videos/32_time_in_text_field.mov
http://media.railscasts.com/videos/31_formatting_time.mov
http://media.railscasts.com/videos/30_pretty_page_title.mov
http://media.railscasts.com/videos/29_group_by_month.mov
http://media.railscasts.com/videos/28_in_groups_of.mov
http://media.railscasts.com/videos/27_cross_site_scripting.mov
http://media.railscasts.com/videos/26_hackers_love_mass_assignment.mov
http://media.railscasts.com/videos/25_sql_injection.mov
http://media.railscasts.com/videos/24_the_stack_trace.mov
http://media.railscasts.com/videos/23_counter_cache_column.mov
http://media.railscasts.com/videos/22_eager_loading.mov
http://media.railscasts.com/videos/21_super_simple_authentication.mov
http://media.railscasts.com/videos/20_restricting_access.mov
http://media.railscasts.com/videos/19_where_administration_goes.mov
http://media.railscasts.com/videos/18_looping_through_flash.mov
http://media.railscasts.com/videos/17_habtm_checkboxes.mov
http://media.railscasts.com/videos/16_virtual_attributes.mov
http://media.railscasts.com/videos/15_fun_with_find_conditions.mov
http://media.railscasts.com/videos/14_performing_calculations_on_models.mov
http://media.railscasts.com/videos/13_dangers_of_model_in_session.mov
http://media.railscasts.com/videos/12_refactoring_user_name_part_3.mov
http://media.railscasts.com/videos/11_refactoring_user_name_part_2.mov
http://media.railscasts.com/videos/10_refactoring_user_name_part_1.mov
http://media.railscasts.com/videos/9_filtering_sensitive_logs.mov
http://media.railscasts.com/videos/8_layouts_and_content_for.mov
http://media.railscasts.com/videos/7_all_about_layouts.mov
http://media.railscasts.com/videos/6_shortcut_blocks_with_symbol_to_proc.mov
http://media.railscasts.com/videos/5_using_with_scope.mov
http://media.railscasts.com/videos/4_move_find_into_model.mov
http://media.railscasts.com/videos/3_find_through_association.mov
http://media.railscasts.com/videos/2_dynamic_find_by_methods.mov
http://media.railscasts.com/videos/1_caching_with_instance_variables.mov
希望对你有帮助!
呵呵,别把人家服务器下载爆了 :)
出处:http://www.cnblogs.com/cnblogsfans
版权:本文版权归作者和博客园共有,转载需经作者同意。
相关推荐
ruby源代码 ruby源代码 ruby源代码 ruby源代码2
ruby源代码 ruby源代码 ruby源代码 ruby源代码4
ruby代码ruby代码ruby代码ruby代码ruby代码ruby代码ruby代码ruby代码
ruby源代码 ruby源代码 ruby源代码 ruby源代码3
Ruby源代码是实现这一语言的底层逻辑和功能的程序,通过阅读和分析Ruby源代码,我们可以深入理解其工作原理,这对于学习和优化Ruby应用程序至关重要。 Ruby的设计哲学是“程序员的生产力优先”,因此它的语法易于...
在"Ruby Cookbook Source"这个压缩包中,我们可以期待找到一系列的Ruby代码示例,这些示例可能涵盖了各种常见的编程问题和最佳实践。Ruby Cookbook通常会包含解决特定问题的代码片段,帮助开发者更好地理解和应用...
标题“ruby测试代码6”和描述“ruby测试代码6”暗示了这是一个关于使用Ruby语言进行的测试代码项目,可能涉及到不同的模块或者数据结构。标签“ruby测试代码6”进一步确认了这一主题。从压缩包子文件的文件名称列表...
聪哥创作的一款批量保留路径清理代码注释的工具,目前兼容大部分常见的代码注释,涵盖c、java、python、php、js、html、css、mysql、node、vue、ruby等常见编程项目的注释无损清理。 2023年8月19日更新日志: 1.对...
本压缩包中的"Ruby on Rails入门经典代码"提供了新手学习Rails的宝贵资源,帮助初学者快速掌握这个强大的框架。 1. **Rails基础知识**: - MVC架构:Rails的核心设计模式,模型负责数据处理,视图负责展示,控制器...
标签中的"ruby源代码8ruby源代码6ruby源代码6ruby源代码8"同样表明了内容与Ruby编程语言的源代码有关,特别是涉及到特定版本的代码。这可能是为了帮助分类、搜索或分析不同版本间的代码差异。 在压缩包子文件的文件...
为了在没有外网连接的环境中搭建Ruby环境,你需要提前下载并准备相关的安装包。在提供的压缩包中,包含了三个关键文件:`ruby-2.7.2.tar.gz`、`redis-6.0.9.tar.gz` 和 `rubygems-3.1.5.tgz`。接下来,我们将详细...
在Ruby编程语言中,测试代码扮演着至关重要的角色,它确保了代码的质量和可靠性。"ruby测试代码1"可能指的是一个具体的测试用例或者测试框架的实例,用于验证Ruby程序的功能和性能。Ruby提供了多种测试工具,如...
Ruby Rubrowser是一款强大的工具,专为Ruby开发者设计,用于交互式可视化代码的依赖关系。它通过解析Ruby代码,提取出其中的模块定义、类和模块的使用情况,然后利用D3(Data-Driven Documents)库将这些信息以有向...
Ruby 自动化代码生成器,通常被称为 Ruby-Autogeneratecode,是一款强大的工具,它能够帮助开发者提升效率,减少重复劳动。这款命令行工具的主要功能是根据预定义的数据模型配置文件,自动生成相应的代码,从而简化...
在处理大型或复杂的Ruby项目时,理解和导航代码库变得尤为重要。"Ruby-Referral"是一个专门为Ruby开发者设计的命令行工具,旨在简化这一过程。这个工具允许用户查找、过滤和排序代码中的定义和引用,从而提高代码...
Ruby语言的特色之一是它的元编程能力,即在运行时修改或创建代码的能力。这在《Programming Ruby》中会有详尽的解释,源代码中也会有相关的实例展示如何利用这个特性来增强代码的灵活性和可扩展性。例如,你会看到...
1. **Ruby idioms**:书中将深入探讨Ruby的惯用法,这些是让代码更简洁、更具Ruby风格的关键。 2. **编程技巧**:如何利用Ruby的特性编写出高效且易于维护的代码,如上下文敏感的语法糖和内建函数的巧妙使用。 3. ...
3. 元编程:Ruby允许在运行时修改自身,包括类和对象的行为,这是其强大之处。 4. 模块:用于实现代码重用和命名空间管理,类似于其他语言的命名空间或包。 5. 面向对象:所有一切都是对象,包括基本类型,提供了...
ruby源代码6ruby源代码6ruby源代码6ruby源代码6
"Ruby测试代码7"可能指的是一个特定的测试用例或测试框架在Ruby中的应用。在这个场景下,我们将深入探讨Ruby中的测试实践,包括测试工具、测试方法以及如何通过Map和Sound等模块进行测试。 首先,Ruby中的测试文化...