pornhub_api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/main.yml +18 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +17 -0
- data/Gemfile +18 -0
- data/README.md +33 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/pornhub_api.rb +82 -0
- data/lib/pornhub_api/version.rb +5 -0
- data/pornhub_api.gemspec +36 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5206447ec5c769953fe4428c15e4cac0b25bf72b1a26e92f8e0ae43d94e43fc7
|
4
|
+
data.tar.gz: b2064db42fe677409f0cfd8d7e299e4a79ec36f5cdaf2c435bdd031c484ab19a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 89ca84eefae8f71f76b0010b9b2ee88463c5010bd966df5eb28cfc430149d45899af323734c0ffab8808b5dfa50f4e0a2d9bfa6421e2a27ef83dd557b545cbdb
|
7
|
+
data.tar.gz: 0c105502f45328b099d6d8cb15f6a83dab37d13d46a54ed92fca751ca342a5dac21d6a139021f83d4446d3230a1f6cb14d209e20f485158f7a942c147b179876
|
@@ -0,0 +1,18 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push,pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- name: Set up Ruby
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 2.7.1
|
14
|
+
- name: Run the default task
|
15
|
+
run: |
|
16
|
+
gem install bundler -v 2.2.3
|
17
|
+
bundle install
|
18
|
+
bundle exec rake
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.4
|
3
|
+
|
4
|
+
Style/StringLiterals:
|
5
|
+
Enabled: true
|
6
|
+
EnforcedStyle: double_quotes
|
7
|
+
|
8
|
+
Style/StringLiteralsInInterpolation:
|
9
|
+
Enabled: true
|
10
|
+
EnforcedStyle: double_quotes
|
11
|
+
|
12
|
+
Layout/LineLength:
|
13
|
+
Max: 120
|
14
|
+
|
15
|
+
Metrics/BlockLength:
|
16
|
+
Exclude:
|
17
|
+
- spec/**/*
|
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in pornhub_api.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
|
10
|
+
gem "rspec", "~> 3.0"
|
11
|
+
|
12
|
+
gem "rubocop", "~> 0.80"
|
13
|
+
|
14
|
+
gem "vcr", "~> 6.0"
|
15
|
+
|
16
|
+
gem "webmock", "~> 3.11"
|
17
|
+
|
18
|
+
gem "json-schema", "~> 2.8", ">= 2.8.1"
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# PornhubApi
|
2
|
+
|
3
|
+
Simple Pornhub API client
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'pornhub_api'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install pornhub_api
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
PornhubApi.search
|
25
|
+
```
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/qelphybox/pornhub_api.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "pornhub_api"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/pornhub_api.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "uri"
|
4
|
+
require "net/http"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
require_relative "pornhub_api/version"
|
8
|
+
|
9
|
+
# PornhubApi client namespace
|
10
|
+
module PornhubApi
|
11
|
+
class Error < StandardError; end
|
12
|
+
|
13
|
+
class << self
|
14
|
+
BASE_URI = URI("https://rt.pornhub.com")
|
15
|
+
|
16
|
+
# Search pornhub videos
|
17
|
+
# @param [Hash] options
|
18
|
+
# @option options [String] :search Search query
|
19
|
+
# @option options [Integer] :page Page number
|
20
|
+
# @option options [String] :thumbsize Possible values are small,medium,large,small_hd,medium_hd,large_hd
|
21
|
+
# @option options [String] :category The subject
|
22
|
+
# @option options [String] :ordering Possible values are featured, newest, mostviewed and rating
|
23
|
+
# @option options [Array] :phrase Used as pornstars filter.
|
24
|
+
# @option options [Array] :tags The email's body
|
25
|
+
# @option options [String] :period Only works with ordering parameter.
|
26
|
+
# Possible values are weekly, monthly, and alltime
|
27
|
+
# @return [Object] response
|
28
|
+
def search(**options)
|
29
|
+
webmasters_request("search", options)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Get pornstars list
|
33
|
+
# @return [Object] response
|
34
|
+
def stars
|
35
|
+
webmasters_request("stars")
|
36
|
+
end
|
37
|
+
|
38
|
+
# Get detailed pornstars list
|
39
|
+
# @return [Object] response
|
40
|
+
def stars_detailed
|
41
|
+
webmasters_request("stars_detailed")
|
42
|
+
end
|
43
|
+
|
44
|
+
# Get video by id
|
45
|
+
# @param [Object] id Video id
|
46
|
+
# @param [Hash] options
|
47
|
+
# @option options []
|
48
|
+
# @return [Object] response
|
49
|
+
def video_by_id(id:, **options)
|
50
|
+
webmasters_request("video_by_id", { id: id, **options })
|
51
|
+
end
|
52
|
+
|
53
|
+
# @param [Object] id Video id
|
54
|
+
# @param [Hash] options
|
55
|
+
# @return [Object] response
|
56
|
+
# rubocop:disable Naming/PredicateName
|
57
|
+
def is_video_active(id:, **options)
|
58
|
+
webmasters_request("is_video_active", { id: id, **options })
|
59
|
+
end
|
60
|
+
# rubocop:enable Naming/PredicateName
|
61
|
+
|
62
|
+
# @return [Object] response
|
63
|
+
def categories
|
64
|
+
webmasters_request("categories")
|
65
|
+
end
|
66
|
+
|
67
|
+
# @param [Object] list
|
68
|
+
# @return [Object] response
|
69
|
+
def tags(list:)
|
70
|
+
webmasters_request("tags", { list: list })
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def webmasters_request(path, options = {})
|
76
|
+
uri = URI.join(BASE_URI, "webmasters/#{path}")
|
77
|
+
uri.query = URI.encode_www_form(options)
|
78
|
+
response = Net::HTTP.get_response(uri)
|
79
|
+
JSON.parse(response.body, symbolize_names: true)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
data/pornhub_api.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/pornhub_api/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "pornhub_api"
|
7
|
+
spec.version = PornhubApi::VERSION
|
8
|
+
spec.authors = ["Kirill Bobykin"]
|
9
|
+
spec.email = ["qelphybox@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Pornhub API client"
|
12
|
+
spec.description = "Simple Pornhub API client"
|
13
|
+
spec.homepage = "https://github.com/qelphybox/pornhub_api"
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
15
|
+
|
16
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
17
|
+
|
18
|
+
# spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/qelphybox/pornhub_api.git"
|
20
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
# Uncomment to register a new dependency of your gem
|
32
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
33
|
+
|
34
|
+
# For more information and examples about making a new gem, checkout our
|
35
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pornhub_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kirill Bobykin
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-12-26 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Simple Pornhub API client
|
14
|
+
email:
|
15
|
+
- qelphybox@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".github/workflows/main.yml"
|
21
|
+
- ".gitignore"
|
22
|
+
- ".rspec"
|
23
|
+
- ".rubocop.yml"
|
24
|
+
- Gemfile
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- bin/console
|
28
|
+
- bin/setup
|
29
|
+
- lib/pornhub_api.rb
|
30
|
+
- lib/pornhub_api/version.rb
|
31
|
+
- pornhub_api.gemspec
|
32
|
+
homepage: https://github.com/qelphybox/pornhub_api
|
33
|
+
licenses: []
|
34
|
+
metadata:
|
35
|
+
allowed_push_host: https://rubygems.org
|
36
|
+
source_code_uri: https://github.com/qelphybox/pornhub_api.git
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.4.0
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubygems_version: 3.1.2
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: Pornhub API client
|
56
|
+
test_files: []
|