source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
niconico/lib/niconico/deferrable.rb
Ruby
mit
187
master
1,319
class Niconico module Deferrable module ClassMethods def deferrable(*keys) keys.each do |key| binding.eval(<<-EOM, __FILE__, __LINE__.succ) define_method(:#{key}) do get() if @#{key}.nil? && !fetched? @#{key} end EOM end...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
niconico/lib/niconico/mylist.rb
Ruby
mit
187
master
741
# -*- coding: utf-8 -*- require 'json' class Niconico def mylist(i) login unless logged_in? page = @agent.get(url = "http://www.nicovideo.jp/mylist/#{i.to_s.sub(/^mylist\//,"")}") #require 'ir_b'; ir b if page.search("script").map(&:inner_text).find{|x| /\tMylist\.preload/ =~ x }.match(/\tMylist\.pr...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
niconico/lib/niconico/live.rb
Ruby
mit
187
master
4,843
# coding: utf-8 require 'niconico/deferrable' require 'niconico/live/api' class Niconico def live(live_id) Live.new(self, live_id) end class Live include Niconico::Deferrable class ReservationOutdated < Exception; end class ReservationNotAccepted < Exception; end class TicketRetrievingFaile...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
niconico/lib/niconico/nico_api.rb
Ruby
mit
187
master
1,695
require 'json' class Niconico class NicoAPI class AcquiringTokenError < Exception; end class ApiError < Exception def initialize(error) @description = error['description'] @code = error['code'] super "#{@code}: #{@description.inspect}" end attr_reader :code, :descri...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
niconico/lib/niconico/ranking.rb
Ruby
mit
187
master
957
# -*- coding: utf-8 -*- class Niconico # options[:span] -> :hourly, :daily, :weekly, :monthly, :total # or -> :hour, :day, :week, :month, :all # default: daily # # options[:method] -> :fav, :view, :comment, :mylist # (or :all) (or :res) def ranking(categ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
niconico/lib/niconico/channel.rb
Ruby
mit
187
master
468
# -*- coding: utf-8 -*- require 'json' require 'open-uri' require 'nokogiri' require 'niconico/video' class Niconico def channel_videos(ch) login unless logged_in? rss = Nokogiri::XML(open("http://ch.nicovideo.jp/#{ch}/video?rss=2.0", &:read)) rss.search('channel item').map do |item| title = item...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
niconico/lib/niconico/video.rb
Ruby
mit
187
master
4,334
# -*- coding: utf-8 -*- require 'json' require 'niconico/deferrable' class Niconico def video(video_id) login unless logged_in? Video.new(self, video_id) end class Video include Niconico::Deferrable deferrable :id, :title, :description, :description_raw, :url, :video_url, :type, ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
niconico/lib/niconico/live/client.rb
Ruby
mit
187
master
1,843
require 'niconico/live/client/search_result' require 'niconico/live/client/search_filters' class Niconico def live_client Live::Client.new(self.agent) end class Live class Client def initialize(agent) @agent = agent @api = API.new(agent) end def remove_timeshifts(ids)...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
niconico/lib/niconico/live/util.rb
Ruby
mit
187
master
891
class Niconico class Live class Util class << self def normalize_id(id, with_lv: true) id = id.to_s if with_lv id.start_with?('lv') ? id : "lv#{id}" else id.start_with?('lv') ? id[2..-1] : id end end # タイムシフト予約が存在する場合に...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
niconico/lib/niconico/live/api.rb
Ruby
mit
187
master
7,782
# coding: utf-8 require 'time' require 'openssl' require 'niconico/live/util' class Niconico class Live class API class NoPublicKeyProvided < Exception; end URL_GETPLAYERSTATUS = 'http://ow.live.nicovideo.jp/api/getplayerstatus'.freeze URL_WATCHINGRESERVATION_LIST = 'http://live.nicovideo.jp/a...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
niconico/lib/niconico/live/mypage.rb
Ruby
mit
187
master
1,852
# coding: utf-8 require 'niconico/live' require 'niconico/live/api' class Niconico def live_mypage Niconico::Live::Mypage.new(self) end class Live class Mypage class UnknownStatus < Exception; end URL = 'http://live.nicovideo.jp/my'.freeze def initialize(client) @client = clie...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
niconico/lib/niconico/live/client/search_filters.rb
Ruby
mit
187
master
708
class Niconico class Live class Client module SearchFilters ONAIR = ':onair:' # 放送中 RESERVED = ':reserved:' # 放送予定 CLOSED = ':closed:' # 放送終了 # joined by 'OR' OFFICIAL = ':official:' # 公式 CHANNEL = ':channel:' # チャンネル COMMUNITY = ':community:' # コミュニテ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
config/schedule.rb
Ruby
mit
187
master
1,546
# Use this file to easily define all of your cron jobs. # # It's helpful, but not entirely necessary to understand cron before proceeding. # http://en.wikipedia.org/wiki/Cron # # Learn more: http://github.com/javan/whenever set :output, {error: 'log/cron.log', standard: 'log/cron.log'} job_type :rake_not_silent, 'sle...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
config/application.rb
Ruby
mit
187
master
1,162
require File.expand_path('../boot', __FILE__) require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module NetRadioArchive class Application < Rails::Application # Settings in config/environments/* ta...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
config/deploy.rb
Ruby
mit
187
master
931
lock '3.4.0' set :application, 'net-radio-archive' set :scm, :copy set :exclude_dir, %w|vendor/bundle .git/ .bundle/ log/* test/| set :log_level, :debug set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'tmp/working', 'vendor/bundle', 'public/system') set :keep_releases, ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/schema.rb
Ruby
mit
187
master
6,293
# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative sou...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20151231134624_create_wikipedia_category_items.rb
Ruby
mit
187
master
769
class CreateWikipediaCategoryItems < ActiveRecord::Migration def up # 検索用キーワードとして抽出するため # あまり長いワードは取得できても意味がないためvarcharの長さ制限は短めに sql = <<EOF CREATE TABLE `wikipedia_category_items` ( `id` int UNSIGNED NOT NULL AUTO_INCREMENT, `category` varchar(100) CHARACTER SET utf8mb4 NOT NULL, `title` varc...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20150607130411_create_key_value.rb
Ruby
mit
187
master
469
class CreateKeyValue < ActiveRecord::Migration def up sql = <<EOF CREATE TABLE `key_value` ( `key` varchar(256) CHARACTER SET ASCII NOT NULL, `value` varchar(250) CHARACTER SET utf8mb4 NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`key`) ); EOF Acti...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20151030150712_add_column_onsen_retry.rb
Ruby
mit
187
master
246
class AddColumnOnsenRetry < ActiveRecord::Migration def up sql = <<EOF ALTER TABLE `onsen_programs` ADD COLUMN `retry_count` int UNSIGNED NOT NULL AFTER `state` EOF ActiveRecord::Base.connection.execute(sql) end def down end end
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20150515174821_create_onsen_program.rb
Ruby
mit
187
master
769
class CreateOnsenProgram < ActiveRecord::Migration def up sql = <<EOF CREATE TABLE `onsen_programs` ( `id` int UNSIGNED NOT NULL AUTO_INCREMENT, `title` varchar(250) CHARACTER SET utf8mb4 NOT NULL, `number` varchar(100) CHARACTER SET utf8mb4 NOT NULL, `date` datetime NOT NULL, `file_url` varch...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20170505142758_create_agonp_programs.rb
Ruby
mit
187
master
785
class CreateAgonpPrograms < ActiveRecord::Migration def up sql = <<EOF CREATE TABLE `agonp_programs` ( `id` int UNSIGNED NOT NULL AUTO_INCREMENT, `title` varchar(250) CHARACTER SET utf8mb4 NOT NULL, `personality` varchar(250) CHARACTER SET utf8mb4 NOT NULL, `episode_id` varchar(250) CHARACTER SET ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20150602100911_nico_add_column.rb
Ruby
mit
187
master
430
class NicoAddColumn < ActiveRecord::Migration def up sql = <<EOF ALTER TABLE `niconico_live_programs` ADD COLUMN `cannot_recovery` boolean NOT NULL AFTER `state` EOF ActiveRecord::Base.connection.execute(sql) sql = <<EOF ALTER TABLE `niconico_live_programs` ADD COLUMN `memo` text CHARACTER SET utf8mb4 NO...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20171105142758_create_niconico_video_programs.rb
Ruby
mit
187
master
690
class CreateNiconicoVideoPrograms < ActiveRecord::Migration def up sql = <<EOF CREATE TABLE `niconico_video_programs` ( `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, `video_id` varchar(250) CHARACTER SET ASCII NOT NULL, `title` varchar(250) CHARACTER SET utf8mb4 NOT NULL, `state` varchar(100) CHAR...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20151002075432_create_agon_program.rb
Ruby
mit
187
master
803
class CreateAgonProgram < ActiveRecord::Migration def up sql = <<EOF CREATE TABLE `agon_programs` ( `id` int UNSIGNED NOT NULL AUTO_INCREMENT, `title` varchar(250) CHARACTER SET utf8mb4 NOT NULL, `personality` varchar(250) CHARACTER SET utf8mb4 NOT NULL, `episode_id` varchar(250) CHARACTER SET ASC...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20150515174949_create_hibiki_program.rb
Ruby
mit
187
master
721
class CreateHibikiProgram < ActiveRecord::Migration def up sql = <<EOF CREATE TABLE `hibiki_programs` ( `id` int UNSIGNED NOT NULL AUTO_INCREMENT, `title` varchar(250) CHARACTER SET utf8mb4 NOT NULL, `comment` varchar(150) CHARACTER SET utf8mb4 NOT NULL, `rtmp_url` varchar(767) CHARACTER SET ASCII...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20150515174349_create_job.rb
Ruby
mit
187
master
706
class CreateJob < ActiveRecord::Migration def up sql = <<EOF CREATE TABLE `jobs` ( `id` int UNSIGNED NOT NULL AUTO_INCREMENT, `ch` varchar(100) CHARACTER SET ASCII NOT NULL, `start` datetime NOT NULL, `end` datetime NOT NULL, `title` varchar(250) CHARACTER SET utf8mb4 NOT NULL, `state` var...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20150521174524_create_anitama_program.rb
Ruby
mit
187
master
805
class CreateAnitamaProgram < ActiveRecord::Migration def up # book_id がUNIQUEになることに確信を持てないのでこういう設計に sql = <<EOF CREATE TABLE `anitama_programs` ( `id` int UNSIGNED NOT NULL AUTO_INCREMENT, `book_id` varchar(250) CHARACTER SET ASCII NOT NULL, `title` varchar(250) CHARACTER SET utf8mb4 NOT NULL, ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20150527135411_create_niconico_live_programs.rb
Ruby
mit
187
master
584
class CreateNiconicoLivePrograms < ActiveRecord::Migration def up sql = <<EOF CREATE TABLE `niconico_live_programs` ( `id` bigint UNSIGNED NOT NULL, `title` varchar(250) CHARACTER SET utf8mb4 NOT NULL, `state` varchar(100) CHARACTER SET ASCII NOT NULL, `retry_count` int UNSIGNED NOT NULL, `cre...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
db/migrate/20151110023306_create_hibiki_program_v2.rb
Ruby
mit
187
master
846
class CreateHibikiProgramV2 < ActiveRecord::Migration def up sql = <<EOF CREATE TABLE `hibiki_program_v2s` ( `id` int UNSIGNED NOT NULL AUTO_INCREMENT, `access_id` varchar(100) CHARACTER SET ASCII NOT NULL, `episode_id` int UNSIGNED NOT NULL, `title` varchar(250) CHARACTER SET utf8mb4 NOT NULL, ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/main.rb
Ruby
mit
187
master
4,783
require 'fileutils' require 'net/http' module Main def self.retry(limit = 3) exception = nil limit.times do begin return yield rescue => e exception = e end end raise exception end def self.sleep_until(time) now = Time.now if time - now <= 0 Rails...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/tasks/main.rake
Ruby
mit
187
master
1,576
namespace :main do desc 'ag scrape' task :ag_scrape => :environment do Main::Main.new.ag_scrape end desc 'radiko scrape' task :radiko_scrape => :environment do Main::Main.new.radiko_scrape end desc 'radiru scrape' task :radiru_scrape => :environment do Main::Main.new.radiru_scrape end ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/niconico_live/scraping.rb
Ruby
mit
187
master
1,483
module NiconicoLive class Scraping def main setup reject_ignore_keywords(search_keyword + search_keyword_category_bulk) end def setup @n = Niconico.new(Settings.niconico.username, Settings.niconico.password) @n.login @c = @n.live_client end def search_keyword ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/niconico_live/downloading.rb
Ruby
mit
187
master
1,597
require 'shellwords' module NiconicoLive class Downloading CH_NAME = 'niconama' class NiconamaDownloadException < StandardError; end def download(program) @program = program begin _download rescue Exception => e Rails.logger.error e.class Rails.logger.warn e.i...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/wikipedia/scraping.rb
Ruby
mit
187
master
1,068
require 'net/http' require 'json' require 'cgi/util' module Wikipedia class Scraping def main(category) members = get_all(category) ret = members.map do |m| m['title'].gsub(/^(.*) \(.*\)$/, '\1') end.delete_if do |t| t.match(/^Category:/) || t.match(/^Template:/) ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/radiko/scraping.rb
Ruby
mit
187
master
1,144
require 'net/http' require 'time' require 'chronic' require 'pp' require 'moji' module Radiko class Program < Struct.new(:start_time, :end_time, :title, :performers) end class Scraping def get(ch) dom = get_programs_dom(ch) programs = parse_dom(dom) validate_programs(programs) end ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/radiko/recording.rb
Ruby
mit
187
master
5,827
require 'net/https' require 'shellwords' require 'fileutils' require 'base64' module Radiko class Recording SWF_URL = 'http://radiko.jp/apps/js/flash/myplayer-release.swf' RTMP_URL = 'rtmpe://f-radiko.smartstream.ne.jp' WORK_DIR_NAME = 'radiko' def initialize @cookie = '' end def reco...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/radiru/scraping.rb
Ruby
mit
187
master
871
require 'date' require 'net/https' require 'json' module Radiru class Program < Struct.new(:start_time, :end_time, :title) end class Scraping def get(ch) id = get_id(ch) json = get_programs_json(id) parse(id, json) end def get_id(ch) case ch when 'r1' 'n1' ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/radiru/recording.rb
Ruby
mit
187
master
1,927
require 'net/http' require 'shellwords' module Radiru class Recording def record(job) unless exec_rec(job) return false end exec_convert(job) true end def exec_rec(job) Main::prepare_working_dir(job.ch) download_hls(job) end def get_streams_dom ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/ag/recording.rb
Ruby
mit
187
master
1,242
require 'shellwords' require 'fileutils' module Ag class Recording AGQR_STREAM_URL = 'https://fms2.uniqueradio.jp/agqr10/aandg1.m3u8' CH_NAME = 'ag' def record(job) exec_rec(job) end def exec_rec(job) Main::prepare_working_dir(CH_NAME) Main::sleep_until(job.start - 10.seconds)...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/ag/scraping.rb
Ruby
mit
187
master
5,362
require 'net/http' require 'time' require 'chronic' require 'pp' require 'moji' module Ag class Program < Struct.new(:start_time, :minutes, :title) end class ProgramTime < Struct.new(:wday, :time) SAME_DAY_LINE_HOUR = 5 # convert human friendly time to computer friendly time def self.parse(wday, ti...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/hibiki/downloading.rb
Ruby
mit
187
master
5,387
require 'shellwords' require 'fileutils' require 'm3u8' require 'uri' module Hibiki class Downloading CH_NAME = 'hibiki' class HibikiDownloadException < StandardError; end def initialize @a = Mechanize.new @a.user_agent_alias = 'Windows Chrome' end def download(program) infos...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/hibiki/scraping.rb
Ruby
mit
187
master
1,090
require 'net/http' require 'time' require 'pp' module Hibiki class Program < Struct.new(:access_id, :episode_id, :title, :episode_name, :cast) end class Scraping def initialize @a = Mechanize.new @a.user_agent_alias = 'Windows Chrome' end def main get_list.reject do |program| ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/main/main.rb
Ruby
mit
187
master
10,833
module Main class Main def ag_scrape programs = Ag::Scraping.new.main programs.each do |p| Job.new( ch: Job::CH[:ag], title: p.title, start: p.start_time.next_on_air, end: p.start_time.next_on_air + p.minutes.minutes ).schedule end end ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/main/workaround.rb
Ruby
mit
187
master
1,739
require 'time' module Main module Workaround def self.kill_zombie_process send_signal_to_zombie_processes('rtmpdump', :TERM) send_signal_to_zombie_processes('ffmpeg', :TERM) send_signal_to_zombie_processes('avconv', :TERM) sleep 5 send_signal_to_zombie_processes('rtmpdump', :KILL) ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/onsen/scraping.rb
Ruby
mit
187
master
1,489
require 'net/http' require 'time' require 'pp' require 'moji' module Onsen class Program < Struct.new(:title, :number, :update_date, :file_url, :personality) end class Scraping def initialize @a = Mechanize.new @a.user_agent_alias = 'Windows Chrome' end def main get_program_list ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/onsen/downloading.rb
Ruby
mit
187
master
909
module Onsen class Downloading CH_NAME = 'onsen' def download(program) path = filepath(program) Main::prepare_working_dir(CH_NAME) arg = "\ -loglevel warning \ -y \ -i #{Shellwords.escape(program.file_url)} \ -vcodec libx264 -acodec copy -bsf:a aac_adtstoasc ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/agonp/downloading.rb
Ruby
mit
187
master
2,741
module Agonp class Downloading CH_NAME = 'agonp' def initialize @a = Mechanize.new @a.user_agent_alias = 'Windows Chrome' end def download(program) login program_id = get_program_id(program) url = get_video_url(program) nazo_auth(program, program_id) save_vi...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/agonp/scraping.rb
Ruby
mit
187
master
1,431
module Agonp class Program < Struct.new(:title, :personality, :episode_id, :price) end class Scraping def initialize @a = Mechanize.new @a.user_agent_alias = 'Windows Chrome' end def main filter_list(get_list) end def get_list programs = [] page = 1 2.tim...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/niconico_video/downloading.rb
Ruby
mit
187
master
654
module NiconicoVideo class Downloading CH_NAME = 'nicodou' def download(program) Main::prepare_working_dir(CH_NAME) path = filepath(program) begin %Q(youtube-dl -v -f "[vbr<599]+[abr>127]" -u#{username} -p#{password} http://www.nicovideo.jp/watch/1509345736) rescue => e ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
lib/niconico_video/scraping.rb
Ruby
mit
187
master
916
require 'time' require 'mechanize' module NiconicoVideo ProgramBase = Struct.new(:video_id, :title) class Program < ProgramBase end class Scraping def initialize @a = Mechanize.new @a.user_agent_alias = 'Windows Chrome' end def main programs = [] if Settings.niconico.video...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
app/models/job.rb
Ruby
mit
187
master
828
class Job < ActiveRecord::Base CH = { ag: 'ag', } STATE = { scheduled: 'scheduled', recording: 'recording', converting: 'converting', done: 'done', failed: 'failed', } def length_sec (self.end - self.start).to_i end def schedule # only update after 10 minutes form now ...
github
yayugu/net-radio-archive
https://github.com/yayugu/net-radio-archive
app/models/concerns/ondemand_retry.rb
Ruby
mit
187
master
223
module OndemandRetry STATE = { waiting: 'waiting', downloading: 'downloading', done: 'done', failed: 'failed', not_downloadable: 'not_downloadable', outdated: 'outdated', } RETRY_LIMIT = 3 end
github
k0kubun/rack-user_agent
https://github.com/k0kubun/rack-user_agent
rack-user_agent.gemspec
Ruby
mit
187
master
1,211
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rack/user_agent/version' Gem::Specification.new do |spec| spec.name = "rack-user_agent" spec.version = Rack::UserAgent::VERSION spec.authors = ["Takashi Kokubun"] spe...
github
k0kubun/rack-user_agent
https://github.com/k0kubun/rack-user_agent
spec/lib/rack/user_agent_spec.rb
Ruby
mit
187
master
582
require_relative "../../spec_helper" describe "Rack::UserAgent" do include Rack::Test::Methods let(:app) do dummy_app = ->(env) { [200, {}, "Hello World"] } Rack::UserAgent.new(dummy_app) end let(:ua) { "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Versi...
github
k0kubun/rack-user_agent
https://github.com/k0kubun/rack-user_agent
spec/lib/rack/user_agent/detector_spec.rb
Ruby
mit
187
master
6,233
require_relative "../../../spec_helper" # Vendored from: # https://github.com/ihara2525/rack-smartphone_detector/blob/master/spec/rack-smartphone_detector_spec.rb describe "Rack::UserAgent::Detector" do include Rack::Test::Methods SMARTPHONES = [ { name: "iPhone", os: "iOS", version: "5.1.1"...
github
k0kubun/rack-user_agent
https://github.com/k0kubun/rack-user_agent
spec/lib/rack/user_agent/checker_spec.rb
Ruby
mit
187
master
1,921
require_relative "../../../spec_helper" describe "Rack::UserAgent::Checker" do include Rack::Test::Methods let(:app) do dummy_app = ->(env) { [200, {}, "Hello World"] } Rack::UserAgent.new(dummy_app) end let(:expects_by_ua) do { "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0...
github
k0kubun/rack-user_agent
https://github.com/k0kubun/rack-user_agent
spec/lib/rack/user_agent/result_spec.rb
Ruby
mit
187
master
1,303
require_relative "../../../spec_helper" describe "Rack::UserAgent::Result" do include Rack::Test::Methods let(:app) do dummy_app = ->(env) { [200, {}, "Hello World"] } Rack::UserAgent.new(dummy_app) end let(:ua) { "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like G...
github
k0kubun/rack-user_agent
https://github.com/k0kubun/rack-user_agent
lib/rack/user_agent.rb
Ruby
mit
187
master
576
require "woothee" require "rack/user_agent/checker" require "rack/user_agent/detector" require "rack/user_agent/result" require "rack/user_agent/version" require 'rack/user_agent/railtie' if defined?(Rails::Railtie) module Rack class UserAgent def initialize(app, options = {}) @app = app end def c...
github
k0kubun/rack-user_agent
https://github.com/k0kubun/rack-user_agent
lib/rack/user_agent/detector.rb
Ruby
mit
187
master
1,169
require "rack/user_agent/checker" # This module aims to provide APIs compatible with: # https://github.com/ihara2525/rack-smartphone_detector module Rack class UserAgent module Detector include Checker def smartphone_version return unless from_smartphone? suppress_unknown(os_version)...
github
k0kubun/rack-user_agent
https://github.com/k0kubun/rack-user_agent
lib/rack/user_agent/checker.rb
Ruby
mit
187
master
465
require "rack/user_agent/result" module Rack class UserAgent module Checker include Result def from_pc? device_type == :pc end def from_smartphone? device_type == :smartphone end def from_mobilephone? device_type == :mobilephone end def ...
github
k0kubun/rack-user_agent
https://github.com/k0kubun/rack-user_agent
lib/rack/user_agent/railtie.rb
Ruby
mit
187
master
506
module Rack class UserAgent class Railtie < ::Rails::Railtie initializer "rack-user_agent.configure_rails_initialization" do |app| app.config.middleware.insert_after(Rack::Head, Rack::UserAgent) ActiveSupport.on_load(:action_controller) do ActionDispatch::Request.class_eval do ...
github
k0kubun/rack-user_agent
https://github.com/k0kubun/rack-user_agent
lib/rack/user_agent/result.rb
Ruby
mit
187
master
710
module Rack class UserAgent module Result UNKNOWN_VARIANT = :unknown def device_type woothee_result[:category] end def device_variant return UNKNOWN_VARIANT if woothee_result[:category] == Woothee::VALUE_UNKNOWN device_type end def os woothee_...
github
gshutler/useragent
https://github.com/gshutler/useragent
useragent.gemspec
Ruby
mit
187
master
496
Gem::Specification.new do |s| s.name = "useragent" s.version = "0.16.11" s.homepage = "https://github.com/gshutler/useragent" s.summary = "HTTP User Agent parser" s.description = "HTTP User Agent parser" s.files = Dir["LICENSE", "README.md", "lib/**/*.rb"] s.add_development_dependency "rake",...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent.rb
Ruby
mit
187
master
2,013
require 'user_agent/comparable' require 'user_agent/browsers' require 'user_agent/operating_systems' require 'user_agent/version' class UserAgent # http://www.texsoft.it/index.php?m=sw.php.useragent MATCHER = %r{ ^['"]* # Possible opening quote(s) ([^/\s]+) # Pr...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/operating_systems.rb
Ruby
mit
187
master
1,605
class UserAgent module OperatingSystems IOS_VERSION_REGEX = /CPU (?:iPhone |iPod )?OS ([\d_]+) like Mac OS X/ Windows = { "Windows NT 10.0" => "Windows 10", "Windows NT 6.3" => "Windows 8.1", "Windows NT 6.2" => "Windows 8", "Windows NT 6.1" => "Windows 7", "Windows NT 6.0" ...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers.rb
Ruby
mit
187
master
1,208
require 'user_agent/browsers/base' require 'user_agent/browsers/chrome' require 'user_agent/browsers/edge' require 'user_agent/browsers/gecko' require 'user_agent/browsers/internet_explorer' require 'user_agent/browsers/opera' require 'user_agent/browsers/webkit' require 'user_agent/browsers/wechat_browser' require 'us...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/comparable.rb
Ruby
mit
187
master
510
class UserAgent # A custom Comparable module that will always return false # if the <=> returns false module Comparable def <(other) (c = self <=> other) ? c == -1 : false end def <=(other) (c = self <=> other) ? c == -1 || c == 0 : false end def ==(other) (c = self <=> oth...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/version.rb
Ruby
mit
187
master
1,939
class UserAgent class Version include ::Comparable def self.new(obj = nil) case obj when Version obj when String super when NilClass super("") else raise ArgumentError, "invalid value for Version: #{obj.inspect}" end end def initial...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/opera.rb
Ruby
mit
187
master
1,834
class UserAgent module Browsers class Opera < Base def self.extend?(agent) (agent.first && agent.first.product == 'Opera') || (agent.application && agent.application.product == 'Opera') || (agent.last && agent.last.product == 'OPR') end def browser 'Opera' ...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/itunes.rb
Ruby
mit
187
master
2,173
class UserAgent module Browsers # The user agent for iTunes # # Some user agents: # iTunes/10.6.1 (Macintosh; Intel Mac OS X 10.7.3) AppleWebKit/534.53.11 # iTunes/12.0.1 (Macintosh; OS X 10.10) AppleWebKit/0600.1.25 # iTunes/11.1.5 (Windows; Microsoft Windows 7 x64 Business Edition Service P...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/apple_core_media.rb
Ruby
mit
187
master
1,299
class UserAgent module Browsers # CoreMedia is a framework on iOS and is used by various iOS apps to playback media. class AppleCoreMedia < Base def self.extend?(agent) agent.detect { |useragent| useragent.product == 'AppleCoreMedia' } end def browser "AppleCoreMedia" ...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/chrome.rb
Ruby
mit
187
master
1,815
class UserAgent module Browsers class Chrome < Base def self.extend?(agent) agent.detect { |useragent| %w(Chrome CriOS).include?(useragent.product) } end ChromeBrowsers = %w( Iron ).freeze def browser ChromeBrowsers.detect { |browser| respo...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/base.rb
Ruby
mit
187
master
3,188
class UserAgent module Browsers class Base < Array include Comparable def <=>(other) if respond_to?(:browser) && other.respond_to?(:browser) && browser == other.browser version <=> Version.new(other.version) else false end end def e...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/libavformat.rb
Ruby
mit
187
master
876
class UserAgent module Browsers # The user agent utilized by ffmpeg or other projects utilizing libavformat class Libavformat < Base def self.extend?(agent) agent.detect do |useragent| useragent.product == "Lavf" || (useragent.product == "NSPlayer" && agent.version == "4.1.0.3856") ...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/gecko.rb
Ruby
mit
187
master
1,407
class UserAgent module Browsers class Gecko < Base def self.extend?(agent) agent.application && agent.application.product == "Mozilla" end GeckoBrowsers = %w( PaleMoon Firefox Camino Iceweasel Seamonkey ).freeze def browser Ge...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/webkit.rb
Ruby
mit
187
master
3,492
class UserAgent module Browsers class Webkit < Base WEBKIT_PRODUCT_REGEXP = /\AAppleWebKit\z/i WEBKIT_VERSION_REGEXP = /\A(?<webkit>AppleWebKit)\/(?<version>[\d\.]+)/i def self.extend?(agent) agent.detect { |useragent| useragent.product =~ WEBKIT_PRODUCT_REGEXP || useragent.detect_comme...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/wechat_browser.rb
Ruby
mit
187
master
1,184
class UserAgent module Browsers class WechatBrowser < Base def self.extend?(agent) agent.detect { |useragent| useragent.product =~ /MicroMessenger/i } end def browser 'Wechat Browser' end def version micro_messenger = detect_product("MicroMessenger") ...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/edge.rb
Ruby
mit
187
master
541
class UserAgent module Browsers class Edge < Base OS_REGEXP = /Windows NT [\d\.]+|Windows Phone (OS )?[\d\.]+/ def self.extend?(agent) agent.last && agent.last.product == "Edge" end def browser "Edge" end def version last.version end def ...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/windows_media_player.rb
Ruby
mit
187
master
6,057
class UserAgent module Browsers # The user agent used by Windows Media Player or applications which utilize the # Windows Media SDK. # # @note Both VLC and libavformat impersonate Windows Media Player when they think they # are using MMS (Microsoft Media Services/Windows Media Server). ...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/internet_explorer.rb
Ruby
mit
187
master
1,781
class UserAgent module Browsers class InternetExplorer < Base TRIDENT_ENGINES = { "Trident/8.0" => "11.0", "Trident/7.0" => "11.0", "Trident/6.0" => "10.0", "Trident/5.0" => "9.0", "Trident/4.0" => "8.0", }.freeze def self.extend?(agent) agent.app...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/playstation.rb
Ruby
mit
187
master
2,620
class UserAgent module Browsers # Mozilla/5.0 (PLAYSTATION 3 4.75) AppleWebKit/531.22.8 (KHTML, like Gecko) # Mozilla/5.0 (PLAYSTATION 3 4.76) AppleWebKit/531.22.8 (KHTML, like Gecko) # Mozilla/5.0 (PLAYSTATION 3; 1.00) # Mozilla/5.0 (PlayStation Vita 3.52) AppleWebKit/537.73 (KHTML, like Gecko) Silk/...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/podcast_addict.rb
Ruby
mit
187
master
3,326
class UserAgent module Browsers # Podcast Addict - Dalvik/1.6.0 (Linux; U; Android 4.4.2; LG-D631 Build/KOT49I.D63110b) # Podcast Addict - Dalvik/2.1.0 (Linux; U; Android 5.1; XT1093 Build/LPE23.32-21.3) # Podcast Addict - Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; ALCATEL ONE TOUCH Fierce Build/JDQ39) ...
github
gshutler/useragent
https://github.com/gshutler/useragent
lib/user_agent/browsers/vivaldi.rb
Ruby
mit
187
master
1,446
class UserAgent module Browsers class Vivaldi < Base def self.extend?(agent) agent.detect { |useragent| useragent.product == 'Vivaldi' } end def browser 'Vivaldi' end def build webkit.version end def version last.version end ...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/user_agent_spec.rb
Ruby
mit
187
master
20,107
require 'user_agent' require 'ostruct' describe UserAgent do it "should require a product" do expect { UserAgent.new(nil) }.to raise_error(ArgumentError, "expected a value for product") end it "should split comment to an array if a string is passed in" do useragent = UserAgent.new("Mozilla", "5.0", "Mac...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/itunes_user_agent_spec.rb
Ruby
mit
187
master
4,758
require 'user_agent' shared_examples "iTunes" do it "should return 'iTunes' as its browser" do expect(@useragent.browser).to eq("iTunes") end it "should return nil as its security" do expect(@useragent.security).to be_nil end end shared_examples "iTunes runs on" do |platform, os| it "should return ...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/chrome_user_agent_spec.rb
Ruby
mit
187
master
11,471
require 'user_agent' shared_examples_for "Chrome browser" do it "should return 'Chrome' as its browser" do expect(@useragent.browser).to eq("Chrome") end end # http://www.useragentstring.com/Chrome30.0.1599.17_id_19721.php describe "UserAgent: 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, li...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/iron_user_agent_spec.rb
Ruby
mit
187
master
1,694
require 'user_agent' shared_examples_for "Iron browser" do it "should return 'Iron' as its browser" do expect(@useragent.browser).to eq("Iron") end it "should return a Version object for version" do expect(@useragent.version).to be_a(UserAgent::Version) end end # http://www.useragentstring.com/Iron22...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/other_user_agent_spec.rb
Ruby
mit
187
master
4,331
require 'user_agent' describe "UserAgent: nil" do before do @useragent = UserAgent.parse(nil) end it "should return 'Mozilla' as its browser" do expect(@useragent.browser).to eq("Mozilla") end it "should return '4.0' as its version" do expect(@useragent.version).to eq("4.0") end it "should...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/wechat_browser_user_agent_spec.rb
Ruby
mit
187
master
2,651
require 'user_agent' describe "UserAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13E238 MicroMessenger/6.3.16 NetType/WIFI Language/zh_CN'" do before do @useragent = UserAgent.parse("Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_1 like Mac OS X) AppleWeb...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/playstation_user_agent_spec.rb
Ruby
mit
187
master
2,813
require 'user_agent' shared_examples 'PlayStation 3' do it "returns 'PlayStation 3' as its platform" do expect(@useragent.platform).to eq('PlayStation 3') end it "returns 'PS3 Internet Browser' as its browser" do expect(@useragent.browser).to eq('PS3 Internet Browser') end it 'returns false for mob...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/podcast_addict_user_agent_spec.rb
Ruby
mit
187
master
3,518
require 'user_agent' shared_examples 'Podcast Addict' do it "returns 'Podcast Addict' as its browser" do expect(@useragent.browser).to eq('Podcast Addict') end it 'returns nil as its version' do expect(@useragent.version).to be_nil end it "returns 'Android' as its platform" do expect(@useragent...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/opera_user_agent_spec.rb
Ruby
mit
187
master
6,658
require 'user_agent' shared_examples_for "Opera browser" do it "should return 'Opera' as its browser" do expect(@useragent.browser).to eq("Opera") end it "should return a Version object for version" do expect(@useragent.version).to be_a(UserAgent::Version) end end # http://www.useragentstring.com/Ope...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/vivaldi_user_agent_spec.rb
Ruby
mit
187
master
1,562
require 'user_agent' shared_examples_for "Vivaldi browser" do it "should return 'Vivaldi' as its browser" do expect(@useragent.browser).to eq("Vivaldi") end end describe "UserAgent: 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36 Vivaldi/1.2.490.4...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/bot_user_agent_spec.rb
Ruby
mit
187
master
1,745
require 'user_agent' describe "UserAgent: 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'" do before do @useragent = UserAgent.parse("Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)") end it { expect(@useragent).to be_bot } end describe "UserAgent: 'Mozil...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/edge_user_agent_spec.rb
Ruby
mit
187
master
1,529
require 'user_agent' shared_examples_for "Edge browser" do it "should return 'Edge' as its browser" do expect(@useragent.browser).to eq("Edge") end it "should return 'Windows' as its platform" do expect(@useragent.platform).to eq("Windows") end end describe "Mozilla/5.0 (Windows NT 10.0; Win64; x64) ...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/gecko_user_agent_spec.rb
Ruby
mit
187
master
17,146
require 'user_agent' shared_examples_for "Firefox browser" do it "should return 'Firefox' as its browser" do expect(@useragent.browser).to eq("Firefox") end it "should return :strong as its security" do expect(@useragent.security).to eq(:strong) end end describe 'Mozilla/5.0 (Macintosh; Intel Mac OS ...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/libavformat_user_agent_spec.rb
Ruby
mit
187
master
936
require 'user_agent' shared_examples "libavformat" do it "should return 'libavformat' as its browser" do expect(@useragent.browser).to eq("libavformat") end it "should return nil as its OS" do expect(@useragent.os).to be_nil end it "should return nil as its platform" do expect(@useragent.platfo...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/windows_media_player_user_agent_spec.rb
Ruby
mit
187
master
15,493
require 'user_agent' shared_examples "Windows Media Player" do it "should return 'Windows Media Player' as its browser" do expect(@useragent.browser).to eq("Windows Media Player") end it "should return 'Windows' as its platform" do expect(@useragent.platform).to eq("Windows") end it "should not ide...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/chrome_lighthouse_user_agent_spec.rb
Ruby
mit
187
master
409
require 'user_agent' describe "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4590.2 Safari/537.36 Chrome-Lighthouse" do before do @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4...
github
gshutler/useragent
https://github.com/gshutler/useragent
spec/browsers/apple_core_media_user_agent_spec.rb
Ruby
mit
187
master
3,039
require 'user_agent' shared_examples "AppleCoreMedia" do it "should return 'AppleCoreMedia' as its browser" do expect(@useragent.browser).to eq("AppleCoreMedia") end end shared_examples "AppleCoreMedia runs on" do |platform, os| it "should return '#{platform}' as its platform" do expect(@useragent.platf...