Sha256: 0aca29007c626b8fff7d5613cf56eaf278c73a288a88972e11cf55b528001c1c

Contents?: true

Size: 1022 Bytes

Versions: 22

Compression:

Stored size: 1022 Bytes

Contents

require "nicoquery/api/tag_search_rss"
require "nicoquery/object/tag_search"
require "nicoquery/object_mapper/tag_search_rss"
require "nori"


module NicoQuery
  module Crawler
    module TagSearch
      def execute(tag: tag, sort: sort, order: order, &block)
        page = 0

        loop do
          command = nil
          page += 1

          tag_search_object = NicoQuery::Object::TagSearch.new tag: tag, sort: sort, order: order, page: page
          self.each_movie(tag_search_object.movies) do |movie|
            command = block.call movie
            break if command == :break || command != :continue
          end

          break if command == :break || command != :continue
        end
      end

      private

      def continue; :continue end
      def stop; :stop end

      def each_movie(parsed_movies, &block)
        while parsed_movies.length > 0 do
          block.call parsed_movies.shift
        end
      end

      module_function :execute
      module_function :each_movie
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
nicoquery-0.1.8.11 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.8.10 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.8.9 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.8.8 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.8.7 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.8.6 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.8.5 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.8.4 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.8.3 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.8.2 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.8 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.7 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.6.1 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.6 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.5 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.4 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.3 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.2 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.1 lib/nicoquery/crawler/tag_search.rb
nicoquery-0.1.0 lib/nicoquery/crawler/tag_search.rb