2024-01-14 12:30:33 +02:00

280 lines
21 KiB
Markdown

# peertube.SearchApi
All URIs are relative to *https://peertube2.cpy.re*
Method | HTTP request | Description
------------- | ------------- | -------------
[**search_channels**](SearchApi.md#search_channels) | **GET** /api/v1/search/video-channels | Search channels
[**search_playlists**](SearchApi.md#search_playlists) | **GET** /api/v1/search/video-playlists | Search playlists
[**search_videos**](SearchApi.md#search_videos) | **GET** /api/v1/search/videos | Search videos
# **search_channels**
> VideoChannelList search_channels(search, start=start, count=count, search_target=search_target, sort=sort)
Search channels
### Example
```python
import peertube
from peertube.models.video_channel_list import VideoChannelList
from peertube.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://peertube2.cpy.re
# See configuration.py for a list of all supported configuration parameters.
configuration = peertube.Configuration(
host = "https://peertube2.cpy.re"
)
# Enter a context with an instance of the API client
with peertube.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = peertube.SearchApi(api_client)
search = 'search_example' # str | String to search. If the user can make a remote URI search, and the string is an URI then the PeerTube instance will fetch the remote object and add it to its database. Then, you can use the REST API to fetch the complete channel information and interact with it.
start = 56 # int | Offset used to paginate results (optional)
count = 15 # int | Number of items to return (optional) (default to 15)
search_target = 'search_target_example' # str | If the administrator enabled search index support, you can override the default search target. **Warning**: If you choose to make an index search, PeerTube will get results from a third party service. It means the instance may not yet know the objects you fetched. If you want to load video/channel information: * If the current user has the ability to make a remote URI search (this information is available in the config endpoint), then reuse the search API to make a search using the object URI so PeerTube instance fetches the remote object and fill its database. After that, you can use the classic REST API endpoints to fetch the complete object or interact with it * If the current user doesn't have the ability to make a remote URI search, then redirect the user on the origin instance or fetch the data from the origin instance API (optional)
sort = '-createdAt' # str | Sort column (optional)
try:
# Search channels
api_response = api_instance.search_channels(search, start=start, count=count, search_target=search_target, sort=sort)
print("The response of SearchApi->search_channels:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SearchApi->search_channels: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**search** | **str**| String to search. If the user can make a remote URI search, and the string is an URI then the PeerTube instance will fetch the remote object and add it to its database. Then, you can use the REST API to fetch the complete channel information and interact with it. |
**start** | **int**| Offset used to paginate results | [optional]
**count** | **int**| Number of items to return | [optional] [default to 15]
**search_target** | **str**| If the administrator enabled search index support, you can override the default search target. **Warning**: If you choose to make an index search, PeerTube will get results from a third party service. It means the instance may not yet know the objects you fetched. If you want to load video/channel information: * If the current user has the ability to make a remote URI search (this information is available in the config endpoint), then reuse the search API to make a search using the object URI so PeerTube instance fetches the remote object and fill its database. After that, you can use the classic REST API endpoints to fetch the complete object or interact with it * If the current user doesn't have the ability to make a remote URI search, then redirect the user on the origin instance or fetch the data from the origin instance API | [optional]
**sort** | **str**| Sort column | [optional]
### Return type
[**VideoChannelList**](VideoChannelList.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
**500** | search index unavailable | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **search_playlists**
> ApiV1VideoChannelsChannelHandleVideoPlaylistsGet200Response search_playlists(search, start=start, count=count, search_target=search_target, sort=sort)
Search playlists
### Example
```python
import peertube
from peertube.models.api_v1_video_channels_channel_handle_video_playlists_get200_response import ApiV1VideoChannelsChannelHandleVideoPlaylistsGet200Response
from peertube.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://peertube2.cpy.re
# See configuration.py for a list of all supported configuration parameters.
configuration = peertube.Configuration(
host = "https://peertube2.cpy.re"
)
# Enter a context with an instance of the API client
with peertube.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = peertube.SearchApi(api_client)
search = 'search_example' # str | String to search. If the user can make a remote URI search, and the string is an URI then the PeerTube instance will fetch the remote object and add it to its database. Then, you can use the REST API to fetch the complete playlist information and interact with it.
start = 56 # int | Offset used to paginate results (optional)
count = 15 # int | Number of items to return (optional) (default to 15)
search_target = 'search_target_example' # str | If the administrator enabled search index support, you can override the default search target. **Warning**: If you choose to make an index search, PeerTube will get results from a third party service. It means the instance may not yet know the objects you fetched. If you want to load video/channel information: * If the current user has the ability to make a remote URI search (this information is available in the config endpoint), then reuse the search API to make a search using the object URI so PeerTube instance fetches the remote object and fill its database. After that, you can use the classic REST API endpoints to fetch the complete object or interact with it * If the current user doesn't have the ability to make a remote URI search, then redirect the user on the origin instance or fetch the data from the origin instance API (optional)
sort = '-createdAt' # str | Sort column (optional)
try:
# Search playlists
api_response = api_instance.search_playlists(search, start=start, count=count, search_target=search_target, sort=sort)
print("The response of SearchApi->search_playlists:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SearchApi->search_playlists: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**search** | **str**| String to search. If the user can make a remote URI search, and the string is an URI then the PeerTube instance will fetch the remote object and add it to its database. Then, you can use the REST API to fetch the complete playlist information and interact with it. |
**start** | **int**| Offset used to paginate results | [optional]
**count** | **int**| Number of items to return | [optional] [default to 15]
**search_target** | **str**| If the administrator enabled search index support, you can override the default search target. **Warning**: If you choose to make an index search, PeerTube will get results from a third party service. It means the instance may not yet know the objects you fetched. If you want to load video/channel information: * If the current user has the ability to make a remote URI search (this information is available in the config endpoint), then reuse the search API to make a search using the object URI so PeerTube instance fetches the remote object and fill its database. After that, you can use the classic REST API endpoints to fetch the complete object or interact with it * If the current user doesn't have the ability to make a remote URI search, then redirect the user on the origin instance or fetch the data from the origin instance API | [optional]
**sort** | **str**| Sort column | [optional]
### Return type
[**ApiV1VideoChannelsChannelHandleVideoPlaylistsGet200Response**](ApiV1VideoChannelsChannelHandleVideoPlaylistsGet200Response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
**500** | search index unavailable | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **search_videos**
> VideoListResponse search_videos(search, category_one_of=category_one_of, is_live=is_live, tags_one_of=tags_one_of, tags_all_of=tags_all_of, licence_one_of=licence_one_of, language_one_of=language_one_of, nsfw=nsfw, is_local=is_local, include=include, privacy_one_of=privacy_one_of, uuids=uuids, has_hls_files=has_hls_files, has_web_video_files=has_web_video_files, skip_count=skip_count, start=start, count=count, search_target=search_target, sort=sort, exclude_already_watched=exclude_already_watched, start_date=start_date, end_date=end_date, originally_published_start_date=originally_published_start_date, originally_published_end_date=originally_published_end_date, duration_min=duration_min, duration_max=duration_max)
Search videos
### Example
```python
import peertube
from peertube.models.video_list_response import VideoListResponse
from peertube.models.video_privacy_set import VideoPrivacySet
from peertube.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://peertube2.cpy.re
# See configuration.py for a list of all supported configuration parameters.
configuration = peertube.Configuration(
host = "https://peertube2.cpy.re"
)
# Enter a context with an instance of the API client
with peertube.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = peertube.SearchApi(api_client)
search = 'search_example' # str | String to search. If the user can make a remote URI search, and the string is an URI then the PeerTube instance will fetch the remote object and add it to its database. Then, you can use the REST API to fetch the complete video information and interact with it.
category_one_of = peertube.GetAccountVideosCategoryOneOfParameter() # GetAccountVideosCategoryOneOfParameter | category id of the video (see [/videos/categories](#operation/getCategories)) (optional)
is_live = True # bool | whether or not the video is a live (optional)
tags_one_of = peertube.GetAccountVideosTagsOneOfParameter() # GetAccountVideosTagsOneOfParameter | tag(s) of the video (optional)
tags_all_of = peertube.GetAccountVideosTagsAllOfParameter() # GetAccountVideosTagsAllOfParameter | tag(s) of the video, where all should be present in the video (optional)
licence_one_of = peertube.GetAccountVideosLicenceOneOfParameter() # GetAccountVideosLicenceOneOfParameter | licence id of the video (see [/videos/licences](#operation/getLicences)) (optional)
language_one_of = peertube.GetAccountVideosLanguageOneOfParameter() # GetAccountVideosLanguageOneOfParameter | language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language (optional)
nsfw = 'nsfw_example' # str | whether to include nsfw videos, if any (optional)
is_local = True # bool | **PeerTube >= 4.0** Display only local or remote videos (optional)
include = 56 # int | **PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES (optional)
privacy_one_of = peertube.VideoPrivacySet() # VideoPrivacySet | **PeerTube >= 4.0** Display only videos in this specific privacy/privacies (optional)
uuids = ['uuids_example'] # List[str] | Find videos with specific UUIDs (optional)
has_hls_files = True # bool | **PeerTube >= 4.0** Display only videos that have HLS files (optional)
has_web_video_files = True # bool | **PeerTube >= 6.0** Display only videos that have Web Video files (optional)
skip_count = 'false' # str | if you don't need the `total` in the response (optional) (default to 'false')
start = 56 # int | Offset used to paginate results (optional)
count = 15 # int | Number of items to return (optional) (default to 15)
search_target = 'search_target_example' # str | If the administrator enabled search index support, you can override the default search target. **Warning**: If you choose to make an index search, PeerTube will get results from a third party service. It means the instance may not yet know the objects you fetched. If you want to load video/channel information: * If the current user has the ability to make a remote URI search (this information is available in the config endpoint), then reuse the search API to make a search using the object URI so PeerTube instance fetches the remote object and fill its database. After that, you can use the classic REST API endpoints to fetch the complete object or interact with it * If the current user doesn't have the ability to make a remote URI search, then redirect the user on the origin instance or fetch the data from the origin instance API (optional)
sort = 'sort_example' # str | Sort videos by criteria (prefixing with `-` means `DESC` order): (optional)
exclude_already_watched = True # bool | Whether or not to exclude videos that are in the user's video history (optional)
start_date = '2013-10-20T19:20:30+01:00' # datetime | Get videos that are published after this date (optional)
end_date = '2013-10-20T19:20:30+01:00' # datetime | Get videos that are published before this date (optional)
originally_published_start_date = '2013-10-20T19:20:30+01:00' # datetime | Get videos that are originally published after this date (optional)
originally_published_end_date = '2013-10-20T19:20:30+01:00' # datetime | Get videos that are originally published before this date (optional)
duration_min = 56 # int | Get videos that have this minimum duration (optional)
duration_max = 56 # int | Get videos that have this maximum duration (optional)
try:
# Search videos
api_response = api_instance.search_videos(search, category_one_of=category_one_of, is_live=is_live, tags_one_of=tags_one_of, tags_all_of=tags_all_of, licence_one_of=licence_one_of, language_one_of=language_one_of, nsfw=nsfw, is_local=is_local, include=include, privacy_one_of=privacy_one_of, uuids=uuids, has_hls_files=has_hls_files, has_web_video_files=has_web_video_files, skip_count=skip_count, start=start, count=count, search_target=search_target, sort=sort, exclude_already_watched=exclude_already_watched, start_date=start_date, end_date=end_date, originally_published_start_date=originally_published_start_date, originally_published_end_date=originally_published_end_date, duration_min=duration_min, duration_max=duration_max)
print("The response of SearchApi->search_videos:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SearchApi->search_videos: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**search** | **str**| String to search. If the user can make a remote URI search, and the string is an URI then the PeerTube instance will fetch the remote object and add it to its database. Then, you can use the REST API to fetch the complete video information and interact with it. |
**category_one_of** | [**GetAccountVideosCategoryOneOfParameter**](.md)| category id of the video (see [/videos/categories](#operation/getCategories)) | [optional]
**is_live** | **bool**| whether or not the video is a live | [optional]
**tags_one_of** | [**GetAccountVideosTagsOneOfParameter**](.md)| tag(s) of the video | [optional]
**tags_all_of** | [**GetAccountVideosTagsAllOfParameter**](.md)| tag(s) of the video, where all should be present in the video | [optional]
**licence_one_of** | [**GetAccountVideosLicenceOneOfParameter**](.md)| licence id of the video (see [/videos/licences](#operation/getLicences)) | [optional]
**language_one_of** | [**GetAccountVideosLanguageOneOfParameter**](.md)| language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language | [optional]
**nsfw** | **str**| whether to include nsfw videos, if any | [optional]
**is_local** | **bool**| **PeerTube >= 4.0** Display only local or remote videos | [optional]
**include** | **int**| **PeerTube >= 4.0** Include additional videos in results (can be combined using bitwise or operator) - `0` NONE - `1` NOT_PUBLISHED_STATE - `2` BLACKLISTED - `4` BLOCKED_OWNER - `8` FILES | [optional]
**privacy_one_of** | [**VideoPrivacySet**](.md)| **PeerTube >= 4.0** Display only videos in this specific privacy/privacies | [optional]
**uuids** | [**List[str]**](str.md)| Find videos with specific UUIDs | [optional]
**has_hls_files** | **bool**| **PeerTube >= 4.0** Display only videos that have HLS files | [optional]
**has_web_video_files** | **bool**| **PeerTube >= 6.0** Display only videos that have Web Video files | [optional]
**skip_count** | **str**| if you don't need the `total` in the response | [optional] [default to 'false']
**start** | **int**| Offset used to paginate results | [optional]
**count** | **int**| Number of items to return | [optional] [default to 15]
**search_target** | **str**| If the administrator enabled search index support, you can override the default search target. **Warning**: If you choose to make an index search, PeerTube will get results from a third party service. It means the instance may not yet know the objects you fetched. If you want to load video/channel information: * If the current user has the ability to make a remote URI search (this information is available in the config endpoint), then reuse the search API to make a search using the object URI so PeerTube instance fetches the remote object and fill its database. After that, you can use the classic REST API endpoints to fetch the complete object or interact with it * If the current user doesn't have the ability to make a remote URI search, then redirect the user on the origin instance or fetch the data from the origin instance API | [optional]
**sort** | **str**| Sort videos by criteria (prefixing with `-` means `DESC` order): | [optional]
**exclude_already_watched** | **bool**| Whether or not to exclude videos that are in the user's video history | [optional]
**start_date** | **datetime**| Get videos that are published after this date | [optional]
**end_date** | **datetime**| Get videos that are published before this date | [optional]
**originally_published_start_date** | **datetime**| Get videos that are originally published after this date | [optional]
**originally_published_end_date** | **datetime**| Get videos that are originally published before this date | [optional]
**duration_min** | **int**| Get videos that have this minimum duration | [optional]
**duration_max** | **int**| Get videos that have this maximum duration | [optional]
### Return type
[**VideoListResponse**](VideoListResponse.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
**500** | search index unavailable | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)