resolve_url#
- scikitplot.corpus.resolve_url(url, kind=None)[source]#
Resolve a provider-specific URL to a direct-download URL.
- Parameters:
- urlstr
Original URL.
- kindURLKind or None, optional
Pre-computed classification. If
None,classify_urlis called. Default:None.
- Returns:
- str
Direct-download URL. For
WEB_PAGEandYOUTUBEkinds, the original URL is returned unchanged (they are not download targets). ForDOWNLOADABLEandGITHUB_RAW, the URL is returned as-is (already direct). ForGOOGLE_DRIVEandGITHUB_BLOB, the resolved URL is returned.
- Raises:
- ValueError
If the URL cannot be resolved (e.g. malformed Google Drive link).
- Parameters:
- Return type:
Examples
>>> resolve_url("https://drive.google.com/file/d/abc123/view") 'https://drive.google.com/uc?export=download&id=abc123' >>> resolve_url("https://github.com/user/repo/blob/main/data.csv") 'https://raw.githubusercontent.com/user/repo/main/data.csv'