Skip to content

Mediahub provider

Mediahub - Fetch screenshots and gameclips

pythonxbox.api.provider.mediahub.MediahubProvider(client)

Bases: BaseProvider

Source code in src/pythonxbox/api/provider/baseprovider.py
def __init__(self, client: "XboxLiveClient") -> None:
    """
    Initialize an the BaseProvider

    Args:
        client (:class:`XboxLiveClient`): Instance of XboxLiveClient
    """
    self.client = client

MEDIAHUB_URL = 'https://mediahub.xboxlive.com' class-attribute instance-attribute

HEADERS = {'x-xbl-contract-version': '3'} class-attribute instance-attribute

fetch_own_clips(skip=0, count=500, **kwargs) async

Fetch own clips

Parameters:

Name Type Description Default
skip int

Number of items to skip

0
count int

Max entries to fetch

500

Returns:

Type Description
MediahubGameclips

class:MediahubGameclips: Gameclips

Source code in src/pythonxbox/api/provider/mediahub/__init__.py
async def fetch_own_clips(
    self, skip: int = 0, count: int = 500, **kwargs
) -> MediahubGameclips:
    """
    Fetch own clips

    Args:
        skip: Number of items to skip
        count: Max entries to fetch

    Returns:
        :class:`MediahubGameclips`: Gameclips
    """
    url = f"{self.MEDIAHUB_URL}/gameclips/search"
    post_data = {
        "max": count,
        "query": f"OwnerXuid eq {self.client.xuid}",
        "skip": skip,
    }
    resp = await self.client.session.post(
        url, json=post_data, headers=self.HEADERS, **kwargs
    )
    resp.raise_for_status()
    return MediahubGameclips.model_validate_json(resp.text)

fetch_own_screenshots(skip=0, count=500, **kwargs) async

Fetch own screenshots

Parameters:

Name Type Description Default
skip int

Number of items to skip

0
count int

Max entries to fetch

500

Returns:

Type Description
MediahubScreenshots

class:MediahubScreenshots: Screenshots

Source code in src/pythonxbox/api/provider/mediahub/__init__.py
async def fetch_own_screenshots(
    self, skip: int = 0, count: int = 500, **kwargs
) -> MediahubScreenshots:
    """
    Fetch own screenshots

    Args:
        skip: Number of items to skip
        count: Max entries to fetch

    Returns:
        :class:`MediahubScreenshots`: Screenshots
    """
    url = f"{self.MEDIAHUB_URL}/screenshots/search"
    post_data = {
        "max": count,
        "query": f"OwnerXuid eq {self.client.xuid}",
        "skip": skip,
    }
    resp = await self.client.session.post(
        url, json=post_data, headers=self.HEADERS, **kwargs
    )
    resp.raise_for_status()
    return MediahubScreenshots.model_validate_json(resp.text)