defmodule Extube.Youporn do @moduledoc """ Youporn API Wrapper. For more information on the hubtraffic Youporn API, see here """ @doc """ Queries the hubtraffic API to search for videos given a map of parameters. Parameters right now include the following: `:category` (Optional) text space separated `:page` (Optional) Integer `:search` (Optional) Text space separated `:ordering` (Optional) Text. Possible values are featured, newest, mostviewed and rating `:period` (Optional only work with ordering parameter) Possible values are weekly, monthly, alltime `:thumbsize` (Optional). Possible values are medium, small, big, all, medium1, medium2 """ def search_videos(params \\ %{thumbsize: "medium"}) do base_url = "https://www.youporn.com/api/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.youporn.com/api/webmasters/video_by_id/?" Extube.handle_hubtraffic_call(base, %{ video_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.youporn.com/api/webmasters/video_embed_code/?" Extube.handle_hubtraffic_call(base, %{ video_id: video_id }) end @doc """ Retrieves all deleted videos. ## Parameters: `page` (Required) Integer """ def get_deleted_videos(page) do base = "https://www.youporn.com/api/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.youporn.com/api/webmasters/is_video_active/?" Extube.handle_hubtraffic_call(base, %{ video_id: video_id }) end @doc """ Retrieves all available categories. """ def get_categories_list do Extube.handle_hubtraffic_call("https://www.youporn.com/api/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.youporn.com/api/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.youporn.com/api/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.youporn.com/api/webmasters/stars_detailed/", %{}) end end