Packages

Extube is a wrapper for the hubtraffic API. It gathers data from multiple tube sites including [x] Pornhub [x] Redtube [ ] Tube8 [x] Youporn [x] Xtube [ ] Spankwire [ ] Keezmovies [ ] Extremetube.

Current section

Files

Jump to
extube lib pornhub.ex
Raw

lib/pornhub.ex

defmodule Extube.Pornhub do
@moduledoc """
Pornhub API Wrapper.
For more information on the hubtraffic Pornhub API, see here
<https://www.hubtraffic.com/resources/api?site_id=3>
"""
@doc """
Queries the hubtraffic API to search for videos given a map of parameters.
Parameters right now include the following:
`:category` (Optional)
`:page` (Optional) Integer
`:search` (Optional) Text
`:ordering` (Optional) Text. Possible values are featured, newest, mostviewed and rating
`:period` (Optional) Text. Only works with ordering parameter. Possible values are weekly, monthly, and alltime
`:thumbsize` (Required). Possible values are small,medium,large,small_hd,medium_hd,large_hd
For information on possible values of the parameters, see here
<https://www.hubtraffic.com/resources/api?site_id=3>
"""
def search_videos(params \\ %{thumbsize: "medium"}) do
base_url = "https://www.pornhub.com/webmasters/search?"
Extube.handle_hubtraffic_call(base_url, params)
end
@doc """
Retrieves additional information about specific video by id parameter.
## Parameters:
`id` (Required) Integer
`thumbsize` (Optional) If set, provides additional thumbnails in different formats. Possible values are small,medium,large,small_hd,medium_hd,large_hd
"""
def get_video_by_id(video_id, thumbsize \\ "medium") do
base = "https://www.pornhub.com/webmasters/video_by_id?"
Extube.handle_hubtraffic_call(base, %{
id: video_id,
thumbsize: thumbsize
})
end
@doc """
Retrieves embed code for specific video by video_id parameter, which is useful to automatically embed videos.
## Parameters:
`id` (Required) Integer
"""
def get_video_embed_code(video_id) do
base = "https://www.pornhub.com/webmasters/video_embed_code?"
Extube.handle_hubtraffic_call(base, %{
id: video_id
})
end
@doc """
Retrieves all deleted videos.
## Parameters:
`page` (Required) Integer
"""
def get_deleted_videos(page) do
base = "https://www.pornhub.com/webmasters/deleted_videos?"
Extube.handle_hubtraffic_call(base, %{
page: page
})
end
@doc """
Retrieves state of a specific video specified by is_video_active parameter, which is useful in order to keep your embedded videos up to date.
## Parameters:
`id` (Required) Integer
"""
def is_video_active(video_id) do
base = "https://www.pornhub.com/webmasters/is_video_active?"
Extube.handle_hubtraffic_call(base, %{
id: video_id
})
end
@doc """
Retrieves all available categories.
"""
def get_categories_list do
Extube.handle_hubtraffic_call("http://www.pornhub.com/webmasters/categories", %{})
end
@doc """
Retrieves all tags available.
## Parameters:
`list` a-z for tag starting letter, 0 for other.
"""
def get_tags_list(starts_with) do
base = "https://www.pornhub.com/webmasters/tags?"
Extube.handle_hubtraffic_call(base, %{
list: starts_with
})
end
@doc """
Retrieves all pornstars available.
"""
def get_star_list do
Extube.handle_hubtraffic_call("https://www.pornhub.com/webmasters/stars", %{})
end
@doc """
Retrieves all pornstars available with details (page url and star's thumb).
"""
def get_star_detailed_list do
Extube.handle_hubtraffic_call("https://www.pornhub.com/webmasters/stars_detailed", %{})
end
end