- a typename [ screencast/podcast/sourcecode/gem/documentation/person/basic_text]
- a source and parser
- shows output
- targets to update to # like emails or target widget
- SourceCode: instance has attributes like source link
- SourceCode: Diff between versions (of the same base link)
- PodCast has a source
- Gem has a source code and a version
- Person has a name, website, other links
Last active
April 30, 2016 18:56
-
-
Save sairam/3d25bc307eb4ebd31c1c0d3b7536ac75 to your computer and use it in GitHub Desktop.
(WIP) script to download Ruby5 Podcasts from https://ruby5.codeschool.com/episodes
This file contains 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
class BasicText | |
attr_accessor :source, :output, :targets, :children | |
def parser | |
end | |
end | |
class SourceCode < BasicText | |
attr_accessor :external_link | |
end | |
class Screencasts < BasicText | |
attr_accessor :external_link | |
end | |
class Podcasts < BasicText | |
attr_accessor :parser_info :external_link | |
def parser | |
data = parser_info.shift | |
# processed data | |
end | |
def Ruby5Episodes(source, parser_info) | |
# scrape from source | |
# parse required fields | |
# return parsed data in format | |
# extracts | |
# - source: # what is source ? source is required for scraping again next time | |
# - date: | |
# - scraped_date: | |
# - public/private url: | |
# - download link: | |
# - link: | |
# - description: | |
# - screenshot/image: | |
# - authors [ person, ... ] | |
data.each do |d| | |
t = self.class.new | |
t.source = d['source'] | |
t.parser_info = parser_info.dup | |
end | |
end | |
def Ruby5EpisodeLink(source, parser_info) | |
# no need to recurse if parser_info is blank | |
end | |
end | |
s = Podcasts.new | |
s.source = 'http://ruby5.envylabs.com/episodes' | |
s.parser_info = ['Ruby5Episodes', 'Ruby5EpisodeLink'] #returns ScreenCasts.new with actual data | |
s.parser | |
s.upsert_children(s.output) | |
s = SourceCode.new | |
s.name = 'ruby-mri' | |
# get versions from sources like ruby blog | |
s.source = 'https://github.com/ruby/ruby' | |
s.parser_info = ['RubySource', 'RubySourceLink'] | |
s.parser | |
s.upsert_children(s.output) | |
# individual versions are populated from source | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment