tribler.core.libtorrent.uris

Attributes

logger

Functions

url_to_path(→ str)

Convert a URL to a path.

unshorten(→ tuple[str, bool])

Unshorten a URI if it is a short URI. Return the original URI if it is not a short URI.

get_url(→ bytes)

Get the body of the given URL.

Module Contents

tribler.core.libtorrent.uris.logger
tribler.core.libtorrent.uris.url_to_path(file_url: str) str

Convert a URL to a path.

For example:

'file:///path/to/file' -> '/path/to/file'
Parameters:

file_url – the URL for a file.

Returns:

the filesystem path for the file.

async tribler.core.libtorrent.uris.unshorten(uri: str) tuple[str, bool]

Unshorten a URI if it is a short URI. Return the original URI if it is not a short URI.

Parameters:

uri – A string representing the shortened URL that needs to be unshortened.

Returns:

The unshortened URL, or the URL if not redirected, and whether the certificate is valid.

async tribler.core.libtorrent.uris.get_url(url: str) bytes

Get the body of the given URL.