Class: DownloadTV::MyEpisodes

Inherits:
Object
  • Object
show all
Defined in:
lib/download_tv/myepisodes.rb

Overview

API wrapper for MyEpisodes

Instance Method Summary collapse

Constructor Details

#initialize(user, save_cookie) ⇒ MyEpisodes

Returns a new instance of MyEpisodes.



7
8
9
10
11
12
13
# File 'lib/download_tv/myepisodes.rb', line 7

def initialize(user, save_cookie)
  @user = user
  @save_cookie = save_cookie
  @cookie_path = File.join(ENV['HOME'], '.config', 'download_tv', 'cookie')
  agent.user_agent = DownloadTV::USER_AGENT
  
end

Instance Method Details

#get_shows_since(last, include_tomorrow: false) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/download_tv/myepisodes.rb', line 15

def get_shows_since(last, include_tomorrow: false)
  page = agent.get 'https://www.myepisodes.com/ajax/service.php?mode=view_privatelist'
  shows = page.parser.css('tr.past')
  shows = filter_newer_shows(shows, last)
  shows.concat(page.parser.css('tr.today')) if include_tomorrow
  build_show_strings(shows)
end