Module: PornhubApi
- Defined in:
- lib/pornhub_api.rb,
lib/pornhub_api/version.rb
Overview
PornhubApi client namespace
Defined Under Namespace
Classes: Error
Constant Summary collapse
- BASE_URI =
URI("https://www.pornhub.com")
- VERSION =
"0.1.1"
Class Method Summary collapse
-
.categories ⇒ Object
Get all categories PornhubApi.categories # => { “categories”: [ { “id”: “139”, “category”: “verified-models” } ] }.
-
.is_video_active(id:, **options) ⇒ Object
Get video activeness rubocop:disable Naming/PredicateName.
-
.search(**options) ⇒ Object
Search pornhub videos ==== Example Request video search PornhubApi.search # => { “videos”: [ { “duration”: “11:20”, “views”: 2597, “video_id”: “ph5e7cddd1b610e”, “rating”: “81.8182”, “ratings”: 22, “title”: “Young babe Anna fed cum after anal banging and blowjob”, “url”: “www.pornhub.com/view_video.php?viewkey=ph5e7cddd1b610e”, “default_thumb”: “di.phncdn.com/videos/202003/26/296992831/original/(m=eaf8Ggaaaa)”, “thumb”: “
”, “publish_date”: “2020-12-26 12:10:17”, “thumbs”: [ { “size”: “320x240”, “width”: “320”, “height”: “240”, “src”: “
” } ], “tags”: [ { “tag_name”: “hotbabes4k” } ], “pornstars”: [ { “pornstar_name”: “Sheena Ryder” } ], “categories”: [ { “category”: “babe” }, ], “segment”: “straight” }, ] }. -
.stars ⇒ Object
Get pornstars list ==== Example PornhubApi.stars # => { “stars”: [ { “star”: { “star_name”: “ Vixxen Goddess” } } ] }.
-
.stars_detailed ⇒ Object
Get detailed pornstars list ==== Example PornhubApi.stars_detailed # => { “stars”: [ { “star”: { “star_name”: “ Melisa Wide”, “star_thumb”: “
”, “star_url”: “www.pornhub.com/pornstar/videos_overview?pornstar=melisa-wide”, “gender”: “female”, “videos_count_all”: “0” } }, ] }. -
.tags(list:) ⇒ Object
Get all tags by first char PornhubApi.tags(list: ‘a’) # => { “warning”: “We had to change the response structure due to high amount of tags. Please adjust your code”, “tagsCount”: 283196, “tags”: [ “płąnący”, “płaska”, “płaszcz”, “płaszczyk”, “pławska”, “płock”, “płonę” ] }.
-
.video_by_id(id:, **options) ⇒ Object
Get video by id ==== Example.
Class Method Details
.categories ⇒ Object
Get all categories PornhubApi.categories # => {
"categories": [
{
"id": "139",
"category": "verified-models"
}
]
}
185 186 187 |
# File 'lib/pornhub_api.rb', line 185 def categories webmasters_request("categories") end |
.is_video_active(id:, **options) ⇒ Object
Get video activeness rubocop:disable Naming/PredicateName
Example
PornhubApi.is_video_active(id: ‘ph5f59beb3df90a’) # => {
"active": {
"video_id": "ph5f59beb3df90a",
"is_active": "1"
}
}
169 170 171 |
# File 'lib/pornhub_api.rb', line 169 def is_video_active(id:, **) webmasters_request("is_video_active", { id: id, ** }) end |
.search(**options) ⇒ Object
Search pornhub videos
Example Request video search
PornhubApi.search # => {
"videos": [
{
"duration": "11:20",
"views": 2597,
"video_id": "ph5e7cddd1b610e",
"rating": "81.8182",
"ratings": 22,
"title": "Young babe Anna fed cum after anal banging and blowjob",
"url": "https://www.pornhub.com/view_video.php?viewkey=ph5e7cddd1b610e",
"default_thumb": "https://di.phncdn.com/videos/202003/26/296992831/original/(m=eaf8Ggaaaa)",
"thumb": "https://di.phncdn.com/videos/202003/26/296992831/original/(m=eaf8Ggaaaa)13.jpg",
"publish_date": "2020-12-26 12:10:17",
"thumbs": [
{
"size": "320x240",
"width": "320",
"height": "240",
"src": "https://di.phncdn.com/videos/202003/26/296992831/original/(mh=_Tyqk2i6XofP-YRe)1.jpg"
}
],
"tags": [
{ "tag_name": "hotbabes4k" }
],
"pornstars": [
{ "pornstar_name": "Sheena Ryder" }
],
"categories": [
{ "category": "babe" },
],
"segment": "straight"
},
]
}
64 65 66 |
# File 'lib/pornhub_api.rb', line 64 def search(**) webmasters_request("search", ) end |
.stars ⇒ Object
Get pornstars list
Example
PornhubApi.stars # => {
"stars": [
{
"star": {
"star_name": " Vixxen Goddess"
}
}
]
}
82 83 84 |
# File 'lib/pornhub_api.rb', line 82 def stars webmasters_request("stars") end |
.stars_detailed ⇒ Object
Get detailed pornstars list
Example
PornhubApi.stars_detailed # => {
"stars": [
{
"star": {
"star_name": " Melisa Wide",
"star_thumb": "https://di.phncdn.com/pics/pornstars/default/(m=lciuhScOb_c)female.jpg",
"star_url": "https://www.pornhub.com/pornstar/videos_overview?pornstar=melisa-wide",
"gender": "female",
"videos_count_all": "0"
}
},
]
}
104 105 106 |
# File 'lib/pornhub_api.rb', line 104 def stars_detailed webmasters_request("stars_detailed") end |
.tags(list:) ⇒ Object
Get all tags by first char PornhubApi.tags(list: ‘a’) # =>
"warning": "We had to change the response structure due to high amount of tags. Please adjust your code",
"tagsCount": 283196,
"tags": [
"płąnący",
"płaska",
"płaszcz",
"płaszczyk",
"pławska",
"płock",
"płonę"
]
206 207 208 |
# File 'lib/pornhub_api.rb', line 206 def (list:) webmasters_request("tags", { list: list }) end |
.video_by_id(id:, **options) ⇒ Object
Get video by id
Example
PornhubApi.video_by_id(id: ‘ph5f59beb3df90a’) # => {
"video": {
"duration": "0:04",
"views": 2,
"video_id": "ph5f59beb3df90a",
"rating": 0,
"ratings": 0,
"title": "Dick stroke",
"url": "https://www.pornhub.com/view_video.php?viewkey=ph5f59beb3df90a",
"default_thumb": "https://ei.phncdn.com/videos/202009/10/350564541/original/(m=eaf8Ggaaaa)12.jpg",
"thumb": "https://ei.phncdn.com/videos/202009/10/350564541/original/(m=eaf8Ggaaaa)13.jpg",
"publish_date": "2020-12-26 22:44:47",
"thumbs": [
{
"size": "320x240",
"width": "320",
"height": "240",
"src": "https://ei.phncdn.com/videos/202009/10/350564541/original/(m=eaf8Ggaaaa)15.jpg"
}
],
"tags": [
{
"tag_name": "big cock"
}
],
"pornstars": [],
"categories": [
{
"category": "amateur"
}
],
"segment": "straight"
}
}
151 152 153 |
# File 'lib/pornhub_api.rb', line 151 def video_by_id(id:, **) webmasters_request("video_by_id", { id: id, ** }) end |