pornhub_api 0.1.0 → 0.1.1
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 +4 -4
- data/.github/workflows/gem-push.yml +29 -0
- data/.rubocop.yml +3 -0
- data/LICENSE +21 -0
- data/README.md +30 -7
- data/lib/pornhub_api.rb +144 -5
- data/lib/pornhub_api/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64e6d91b7c12e3b9e23a89d73ac06a4be3c09596e06618e8767e5fe652313c90
|
4
|
+
data.tar.gz: b2a28225e86b673ec52d31280603e8654c4c687cb4c879f4f5703140388554c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 496ee9930a9d27037b937a677046746ab98edd7a88d8d02d2eb000f8117425cb9d81bdba714dce8b54ba23ed3b2e79c103a4cacb684e4c57b871d0e3b69746eb
|
7
|
+
data.tar.gz: b7a724d9a64cdfd7195db23c77fafcebc8874dacb776d9932975d0cdd7624be355e8b2ce020369d42e4dfa6835155429f46467b9b81195bc3e08efa1b01f5b6f
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- 'v*.*.*'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Build + Publish
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: Set up Ruby 2.7
|
16
|
+
uses: actions/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: '2.7'
|
19
|
+
|
20
|
+
- name: Publish to RubyGems
|
21
|
+
run: |
|
22
|
+
mkdir -p $HOME/.gem
|
23
|
+
touch $HOME/.gem/credentials
|
24
|
+
chmod 0600 $HOME/.gem/credentials
|
25
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
26
|
+
gem build *.gemspec
|
27
|
+
gem push *.gem
|
28
|
+
env:
|
29
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/.rubocop.yml
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 Kirill Bobykin
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,7 +1,31 @@
|
|
1
1
|
# PornhubApi
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/pornhub_api)
|
4
|
+
|
3
5
|
Simple Pornhub API client
|
4
6
|
|
7
|
+
Please check [documentation](https://rubydoc.info/gems/pornhub_api/PornhubApi) and [schemas](spec/schemas) to explore
|
8
|
+
possible responses
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
require 'pornhub_api'
|
12
|
+
|
13
|
+
# the simplest call
|
14
|
+
PornhubApi.search
|
15
|
+
|
16
|
+
# adjust your search
|
17
|
+
PornhubApi.search(search: 'lana rhoades', thumbsize: 'small', ordering: 'mostviewed')
|
18
|
+
|
19
|
+
# All possible methods
|
20
|
+
PornhubApi.search
|
21
|
+
PornhubApi.stars
|
22
|
+
PornhubApi.stars_detailed
|
23
|
+
PornhubApi.video_by_id(id: 'ph5f59beb3df90a')
|
24
|
+
PornhubApi.is_video_active(id: 'ph5f59beb3df90a')
|
25
|
+
PornhubApi.categories
|
26
|
+
PornhubApi.tags(list: 'a')
|
27
|
+
```
|
28
|
+
|
5
29
|
## Installation
|
6
30
|
|
7
31
|
Add this line to your application's Gemfile:
|
@@ -18,16 +42,15 @@ Or install it yourself as:
|
|
18
42
|
|
19
43
|
$ gem install pornhub_api
|
20
44
|
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
PornhubApi.search
|
25
|
-
```
|
26
|
-
|
27
45
|
## Development
|
28
46
|
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
|
47
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
|
48
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
49
|
|
31
50
|
## Contributing
|
32
51
|
|
33
52
|
Bug reports and pull requests are welcome on GitHub at https://github.com/qelphybox/pornhub_api.
|
53
|
+
|
54
|
+
## Roadmap
|
55
|
+
- Binary executable file
|
56
|
+
- News RSS feed requests
|
data/lib/pornhub_api.rb
CHANGED
@@ -11,32 +11,96 @@ module PornhubApi
|
|
11
11
|
class Error < StandardError; end
|
12
12
|
|
13
13
|
class << self
|
14
|
-
BASE_URI = URI("https://
|
14
|
+
BASE_URI = URI("https://www.pornhub.com")
|
15
15
|
|
16
16
|
# Search pornhub videos
|
17
17
|
# @param [Hash] options
|
18
18
|
# @option options [String] :search Search query
|
19
19
|
# @option options [Integer] :page Page number
|
20
|
-
# @option options [String] :thumbsize Possible values are small,medium,large,small_hd,medium_hd,large_hd
|
20
|
+
# @option options [String] :thumbsize Possible values are small, medium, large, small_hd, medium_hd, large_hd
|
21
21
|
# @option options [String] :category The subject
|
22
22
|
# @option options [String] :ordering Possible values are featured, newest, mostviewed and rating
|
23
23
|
# @option options [Array] :phrase Used as pornstars filter.
|
24
24
|
# @option options [Array] :tags The email's body
|
25
|
-
# @option options [String] :period
|
26
|
-
# Possible values are weekly, monthly, and alltime
|
25
|
+
# @option options [String] :period Works ith ordering Possible values are weekly, monthly, and alltime
|
27
26
|
# @return [Object] response
|
27
|
+
#
|
28
|
+
# ==== Example Request video search
|
29
|
+
# PornhubApi.search # =>
|
30
|
+
# {
|
31
|
+
# "videos": [
|
32
|
+
# {
|
33
|
+
# "duration": "11:20",
|
34
|
+
# "views": 2597,
|
35
|
+
# "video_id": "ph5e7cddd1b610e",
|
36
|
+
# "rating": "81.8182",
|
37
|
+
# "ratings": 22,
|
38
|
+
# "title": "Young babe Anna fed cum after anal banging and blowjob",
|
39
|
+
# "url": "https://www.pornhub.com/view_video.php?viewkey=ph5e7cddd1b610e",
|
40
|
+
# "default_thumb": "https://di.phncdn.com/videos/202003/26/296992831/original/(m=eaf8Ggaaaa)",
|
41
|
+
# "thumb": "https://di.phncdn.com/videos/202003/26/296992831/original/(m=eaf8Ggaaaa)13.jpg",
|
42
|
+
# "publish_date": "2020-12-26 12:10:17",
|
43
|
+
# "thumbs": [
|
44
|
+
# {
|
45
|
+
# "size": "320x240",
|
46
|
+
# "width": "320",
|
47
|
+
# "height": "240",
|
48
|
+
# "src": "https://di.phncdn.com/videos/202003/26/296992831/original/(mh=_Tyqk2i6XofP-YRe)1.jpg"
|
49
|
+
# }
|
50
|
+
# ],
|
51
|
+
# "tags": [
|
52
|
+
# { "tag_name": "hotbabes4k" }
|
53
|
+
# ],
|
54
|
+
# "pornstars": [
|
55
|
+
# { "pornstar_name": "Sheena Ryder" }
|
56
|
+
# ],
|
57
|
+
# "categories": [
|
58
|
+
# { "category": "babe" },
|
59
|
+
# ],
|
60
|
+
# "segment": "straight"
|
61
|
+
# },
|
62
|
+
# ]
|
63
|
+
# }
|
28
64
|
def search(**options)
|
29
65
|
webmasters_request("search", options)
|
30
66
|
end
|
31
67
|
|
32
68
|
# Get pornstars list
|
33
69
|
# @return [Object] response
|
70
|
+
#
|
71
|
+
# ==== Example
|
72
|
+
# PornhubApi.stars # =>
|
73
|
+
# {
|
74
|
+
# "stars": [
|
75
|
+
# {
|
76
|
+
# "star": {
|
77
|
+
# "star_name": " Vixxen Goddess"
|
78
|
+
# }
|
79
|
+
# }
|
80
|
+
# ]
|
81
|
+
# }
|
34
82
|
def stars
|
35
83
|
webmasters_request("stars")
|
36
84
|
end
|
37
85
|
|
38
86
|
# Get detailed pornstars list
|
39
87
|
# @return [Object] response
|
88
|
+
#
|
89
|
+
# ==== Example
|
90
|
+
# PornhubApi.stars_detailed # =>
|
91
|
+
# {
|
92
|
+
# "stars": [
|
93
|
+
# {
|
94
|
+
# "star": {
|
95
|
+
# "star_name": " Melisa Wide",
|
96
|
+
# "star_thumb": "https://di.phncdn.com/pics/pornstars/default/(m=lciuhScOb_c)female.jpg",
|
97
|
+
# "star_url": "https://www.pornhub.com/pornstar/videos_overview?pornstar=melisa-wide",
|
98
|
+
# "gender": "female",
|
99
|
+
# "videos_count_all": "0"
|
100
|
+
# }
|
101
|
+
# },
|
102
|
+
# ]
|
103
|
+
# }
|
40
104
|
def stars_detailed
|
41
105
|
webmasters_request("stars_detailed")
|
42
106
|
end
|
@@ -44,28 +108,101 @@ module PornhubApi
|
|
44
108
|
# Get video by id
|
45
109
|
# @param [Object] id Video id
|
46
110
|
# @param [Hash] options
|
47
|
-
# @option options []
|
111
|
+
# @option options [String] thumbsize Possible values are small, medium, large, small_hd, medium_hd, large_hd
|
48
112
|
# @return [Object] response
|
113
|
+
#
|
114
|
+
# ==== Example
|
115
|
+
#
|
116
|
+
# PornhubApi.video_by_id(id: 'ph5f59beb3df90a') # =>
|
117
|
+
# {
|
118
|
+
# "video": {
|
119
|
+
# "duration": "0:04",
|
120
|
+
# "views": 2,
|
121
|
+
# "video_id": "ph5f59beb3df90a",
|
122
|
+
# "rating": 0,
|
123
|
+
# "ratings": 0,
|
124
|
+
# "title": "Dick stroke",
|
125
|
+
# "url": "https://www.pornhub.com/view_video.php?viewkey=ph5f59beb3df90a",
|
126
|
+
# "default_thumb": "https://ei.phncdn.com/videos/202009/10/350564541/original/(m=eaf8Ggaaaa)12.jpg",
|
127
|
+
# "thumb": "https://ei.phncdn.com/videos/202009/10/350564541/original/(m=eaf8Ggaaaa)13.jpg",
|
128
|
+
# "publish_date": "2020-12-26 22:44:47",
|
129
|
+
# "thumbs": [
|
130
|
+
# {
|
131
|
+
# "size": "320x240",
|
132
|
+
# "width": "320",
|
133
|
+
# "height": "240",
|
134
|
+
# "src": "https://ei.phncdn.com/videos/202009/10/350564541/original/(m=eaf8Ggaaaa)15.jpg"
|
135
|
+
# }
|
136
|
+
# ],
|
137
|
+
# "tags": [
|
138
|
+
# {
|
139
|
+
# "tag_name": "big cock"
|
140
|
+
# }
|
141
|
+
# ],
|
142
|
+
# "pornstars": [],
|
143
|
+
# "categories": [
|
144
|
+
# {
|
145
|
+
# "category": "amateur"
|
146
|
+
# }
|
147
|
+
# ],
|
148
|
+
# "segment": "straight"
|
149
|
+
# }
|
150
|
+
# }
|
49
151
|
def video_by_id(id:, **options)
|
50
152
|
webmasters_request("video_by_id", { id: id, **options })
|
51
153
|
end
|
52
154
|
|
155
|
+
# Get video activeness
|
53
156
|
# @param [Object] id Video id
|
54
157
|
# @param [Hash] options
|
55
158
|
# @return [Object] response
|
56
159
|
# rubocop:disable Naming/PredicateName
|
160
|
+
#
|
161
|
+
# ==== Example
|
162
|
+
# PornhubApi.is_video_active(id: 'ph5f59beb3df90a') # =>
|
163
|
+
# {
|
164
|
+
# "active": {
|
165
|
+
# "video_id": "ph5f59beb3df90a",
|
166
|
+
# "is_active": "1"
|
167
|
+
# }
|
168
|
+
# }
|
57
169
|
def is_video_active(id:, **options)
|
58
170
|
webmasters_request("is_video_active", { id: id, **options })
|
59
171
|
end
|
60
172
|
# rubocop:enable Naming/PredicateName
|
61
173
|
|
174
|
+
# Get all categories
|
62
175
|
# @return [Object] response
|
176
|
+
# PornhubApi.categories # =>
|
177
|
+
# {
|
178
|
+
# "categories": [
|
179
|
+
# {
|
180
|
+
# "id": "139",
|
181
|
+
# "category": "verified-models"
|
182
|
+
# }
|
183
|
+
# ]
|
184
|
+
# }
|
63
185
|
def categories
|
64
186
|
webmasters_request("categories")
|
65
187
|
end
|
66
188
|
|
189
|
+
# Get all tags by first char
|
67
190
|
# @param [Object] list
|
68
191
|
# @return [Object] response
|
192
|
+
# PornhubApi.tags(list: 'a') # =>
|
193
|
+
# {
|
194
|
+
# "warning": "We had to change the response structure due to high amount of tags. Please adjust your code",
|
195
|
+
# "tagsCount": 283196,
|
196
|
+
# "tags": [
|
197
|
+
# "płąnący",
|
198
|
+
# "płaska",
|
199
|
+
# "płaszcz",
|
200
|
+
# "płaszczyk",
|
201
|
+
# "pławska",
|
202
|
+
# "płock",
|
203
|
+
# "płonę"
|
204
|
+
# ]
|
205
|
+
# }
|
69
206
|
def tags(list:)
|
70
207
|
webmasters_request("tags", { list: list })
|
71
208
|
end
|
@@ -77,6 +214,8 @@ module PornhubApi
|
|
77
214
|
uri.query = URI.encode_www_form(options)
|
78
215
|
response = Net::HTTP.get_response(uri)
|
79
216
|
JSON.parse(response.body, symbolize_names: true)
|
217
|
+
rescue Errno::ECONNREFUSED, SocketError => e
|
218
|
+
raise Error, e
|
80
219
|
end
|
81
220
|
end
|
82
221
|
end
|
data/lib/pornhub_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pornhub_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Bobykin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Simple Pornhub API client
|
14
14
|
email:
|
@@ -17,11 +17,13 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".github/workflows/gem-push.yml"
|
20
21
|
- ".github/workflows/main.yml"
|
21
22
|
- ".gitignore"
|
22
23
|
- ".rspec"
|
23
24
|
- ".rubocop.yml"
|
24
25
|
- Gemfile
|
26
|
+
- LICENSE
|
25
27
|
- README.md
|
26
28
|
- Rakefile
|
27
29
|
- bin/console
|
@@ -49,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
51
|
- !ruby/object:Gem::Version
|
50
52
|
version: '0'
|
51
53
|
requirements: []
|
52
|
-
rubygems_version: 3.1.
|
54
|
+
rubygems_version: 3.1.4
|
53
55
|
signing_key:
|
54
56
|
specification_version: 4
|
55
57
|
summary: Pornhub API client
|