Sha256: 70e548580db7b95bca21b73d1a567fb8d1bfcc450a1c58c4db45687c18fc1947

Contents?: true

Size: 771 Bytes

Versions: 30

Compression:

Stored size: 771 Bytes

Contents

# frozen_string_literal: true

require 'aranha/parsers/html/item_list'
require 'eac_ruby_utils/core_ext'

module EhbrsRubyUtils
  module Videos
    module Opensubtitles
      module Parsers
        class Episode < ::Aranha::Parsers::Html::ItemList
          ITEMS_XPATH = '//table[@id = "search_results"]/tbody/tr[starts-with(@id, "name")]'

          field :href, :string, './/a[contains(@href, "/subtitleserve/")]/@href'

          def items_xpath
            ITEMS_XPATH
          end

          def data
            { subtitles: items_data, next_page_href: next_page_href }
          end

          def next_page_href
            nokogiri.at_xpath('//*[@id = "pager"]//a[text() = ">>"]/@href').if_present(&:text)
          end
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
ehbrs_ruby_utils-0.44.2 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.44.1 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.44.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.41.1 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.41.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.40.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.39.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.38.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.37.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.36.1 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.36.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.35.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.33.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.32.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.31.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.30.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.29.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.28.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.27.1 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
ehbrs_ruby_utils-0.27.0 lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb