mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Add media extractor tests (#100462)
* Add tests for media extractor * Complete test coverage * Fix test dep
This commit is contained in:
parent
a826f26642
commit
71aef4e95a
@ -719,7 +719,6 @@ omit =
|
||||
homeassistant/components/matter/__init__.py
|
||||
homeassistant/components/meater/__init__.py
|
||||
homeassistant/components/meater/sensor.py
|
||||
homeassistant/components/media_extractor/*
|
||||
homeassistant/components/mediaroom/media_player.py
|
||||
homeassistant/components/melcloud/__init__.py
|
||||
homeassistant/components/melcloud/climate.py
|
||||
|
@ -741,6 +741,7 @@ build.json @home-assistant/supervisor
|
||||
/homeassistant/components/meater/ @Sotolotl @emontnemery
|
||||
/tests/components/meater/ @Sotolotl @emontnemery
|
||||
/homeassistant/components/media_extractor/ @joostlek
|
||||
/tests/components/media_extractor/ @joostlek
|
||||
/homeassistant/components/media_player/ @home-assistant/core
|
||||
/tests/components/media_player/ @home-assistant/core
|
||||
/homeassistant/components/media_source/ @hunterjm
|
||||
|
@ -2054,6 +2054,9 @@ youless-api==1.0.1
|
||||
# homeassistant.components.youtube
|
||||
youtubeaio==1.1.5
|
||||
|
||||
# homeassistant.components.media_extractor
|
||||
yt-dlp==2023.7.6
|
||||
|
||||
# homeassistant.components.zamg
|
||||
zamg==0.3.0
|
||||
|
||||
|
50
tests/components/media_extractor/__init__.py
Normal file
50
tests/components/media_extractor/__init__.py
Normal file
@ -0,0 +1,50 @@
|
||||
"""The tests for Media Extractor integration."""
|
||||
from typing import Any
|
||||
|
||||
from tests.common import load_json_object_fixture
|
||||
from tests.components.media_extractor.const import (
|
||||
AUDIO_QUERY,
|
||||
NO_FORMATS_RESPONSE,
|
||||
SOUNDCLOUD_TRACK,
|
||||
YOUTUBE_EMPTY_PLAYLIST,
|
||||
YOUTUBE_PLAYLIST,
|
||||
YOUTUBE_VIDEO,
|
||||
)
|
||||
|
||||
|
||||
def _get_base_fixture(url: str) -> str:
|
||||
return {
|
||||
YOUTUBE_VIDEO: "youtube_1",
|
||||
YOUTUBE_PLAYLIST: "youtube_playlist",
|
||||
YOUTUBE_EMPTY_PLAYLIST: "youtube_empty_playlist",
|
||||
SOUNDCLOUD_TRACK: "soundcloud",
|
||||
NO_FORMATS_RESPONSE: "no_formats",
|
||||
}[url]
|
||||
|
||||
|
||||
def _get_query_fixture(query: str | None) -> str:
|
||||
return {AUDIO_QUERY: "_bestaudio", "best": ""}.get(query, "")
|
||||
|
||||
|
||||
class MockYoutubeDL:
|
||||
"""Mock object for YoutubeDL."""
|
||||
|
||||
_fixture = None
|
||||
|
||||
def __init__(self, params: dict[str, Any]) -> None:
|
||||
"""Initialize mock object for YoutubeDL."""
|
||||
self.params = params
|
||||
|
||||
def extract_info(self, url: str, *, process: bool = False) -> dict[str, Any]:
|
||||
"""Return info."""
|
||||
self._fixture = _get_base_fixture(url)
|
||||
return load_json_object_fixture(f"media_extractor/{self._fixture}_info.json")
|
||||
|
||||
def process_ie_result(
|
||||
self, selected_media: dict[str, Any], *, download: bool = False
|
||||
) -> dict[str, Any]:
|
||||
"""Return result."""
|
||||
query_fixture = _get_query_fixture(self.params["format"])
|
||||
return load_json_object_fixture(
|
||||
f"media_extractor/{self._fixture}_result{query_fixture}.json"
|
||||
)
|
54
tests/components/media_extractor/conftest.py
Normal file
54
tests/components/media_extractor/conftest.py
Normal file
@ -0,0 +1,54 @@
|
||||
"""The tests for Media Extractor integration."""
|
||||
from typing import Any
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.media_extractor import DOMAIN
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import async_mock_service
|
||||
from tests.components.media_extractor import MockYoutubeDL
|
||||
from tests.components.media_extractor.const import AUDIO_QUERY
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
async def setup_homeassistant(hass: HomeAssistant):
|
||||
"""Set up the homeassistant integration."""
|
||||
await async_setup_component(hass, "homeassistant", {})
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
async def setup_media_player(hass: HomeAssistant) -> None:
|
||||
"""Set up the demo media player."""
|
||||
await async_setup_component(
|
||||
hass, "media_player", {"media_player": {"platform": "demo"}}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def calls(hass: HomeAssistant) -> list[ServiceCall]:
|
||||
"""Track calls to a mock service."""
|
||||
return async_mock_service(hass, "media_player", "play_media")
|
||||
|
||||
|
||||
@pytest.fixture(name="mock_youtube_dl")
|
||||
async def setup_mock_yt_dlp(hass: HomeAssistant) -> MockYoutubeDL:
|
||||
"""Mock YoutubeDL."""
|
||||
mock = MockYoutubeDL({})
|
||||
with patch("homeassistant.components.media_extractor.YoutubeDL", return_value=mock):
|
||||
yield mock
|
||||
|
||||
|
||||
@pytest.fixture(name="empty_media_extractor_config")
|
||||
def empty_media_extractor_config() -> dict[str, Any]:
|
||||
"""Return base media extractor config."""
|
||||
return {DOMAIN: {}}
|
||||
|
||||
|
||||
@pytest.fixture(name="audio_media_extractor_config")
|
||||
def audio_media_extractor_config() -> dict[str, Any]:
|
||||
"""Media extractor config for audio."""
|
||||
return {DOMAIN: {"default_query": AUDIO_QUERY}}
|
17
tests/components/media_extractor/const.py
Normal file
17
tests/components/media_extractor/const.py
Normal file
@ -0,0 +1,17 @@
|
||||
"""The tests for Media Extractor integration."""
|
||||
|
||||
AUDIO_QUERY = "bestaudio[ext=m4a]/bestaudio[ext=mp3]/bestaudio"
|
||||
|
||||
YOUTUBE_VIDEO = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
||||
YOUTUBE_PLAYLIST = (
|
||||
"https://www.youtube.com/playlist?list=PLZ4DbyIWUwCq4V8bIEa8jm2ozHZVuREJP"
|
||||
)
|
||||
YOUTUBE_EMPTY_PLAYLIST = (
|
||||
"https://www.youtube.com/playlist?list=PLZ4DbyIWUwCq4V8bIEa8jm2ozHZVuREJO"
|
||||
)
|
||||
|
||||
SOUNDCLOUD_TRACK = "https://soundcloud.com/bruttoband/brutto-11"
|
||||
|
||||
# The ytdlp code indicates formats can be none.
|
||||
# This acts as temporary fixtures until a real situation is found.
|
||||
NO_FORMATS_RESPONSE = "https://test.com/abc"
|
@ -0,0 +1,85 @@
|
||||
{
|
||||
"id": "223644255",
|
||||
"uploader": "BRUTTOBAND",
|
||||
"uploader_id": "111488150",
|
||||
"uploader_url": "https://soundcloud.com/bruttoband",
|
||||
"timestamp": 1442140228,
|
||||
"title": "BRUTTO - \u0420\u043e\u0434\u043d\u044b \u043a\u0440\u0430\u0439",
|
||||
"description": "",
|
||||
"thumbnails": [
|
||||
{
|
||||
"id": "mini",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-mini.jpg",
|
||||
"width": 16,
|
||||
"height": 16
|
||||
},
|
||||
{
|
||||
"id": "tiny",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-tiny.jpg",
|
||||
"width": 20,
|
||||
"height": 20
|
||||
},
|
||||
{
|
||||
"id": "small",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-small.jpg",
|
||||
"width": 32,
|
||||
"height": 32
|
||||
},
|
||||
{
|
||||
"id": "badge",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-badge.jpg",
|
||||
"width": 47,
|
||||
"height": 47
|
||||
},
|
||||
{
|
||||
"id": "t67x67",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t67x67.jpg",
|
||||
"width": 67,
|
||||
"height": 67
|
||||
},
|
||||
{
|
||||
"id": "large",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-large.jpg",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
{
|
||||
"id": "t300x300",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t300x300.jpg",
|
||||
"width": 300,
|
||||
"height": 300
|
||||
},
|
||||
{
|
||||
"id": "crop",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-crop.jpg",
|
||||
"width": 400,
|
||||
"height": 400
|
||||
},
|
||||
{
|
||||
"id": "t500x500",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t500x500.jpg",
|
||||
"width": 500,
|
||||
"height": 500
|
||||
},
|
||||
{
|
||||
"id": "original",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-original.jpg",
|
||||
"preference": 10
|
||||
}
|
||||
],
|
||||
"duration": 229.089,
|
||||
"webpage_url": "https://soundcloud.com/bruttoband/brutto-11",
|
||||
"license": "all-rights-reserved",
|
||||
"view_count": 290864,
|
||||
"like_count": 3342,
|
||||
"comment_count": 14,
|
||||
"repost_count": 60,
|
||||
"genre": "Brutto",
|
||||
"original_url": "https://soundcloud.com/bruttoband/brutto-11",
|
||||
"webpage_url_basename": "brutto-11",
|
||||
"webpage_url_domain": "soundcloud.com",
|
||||
"extractor": "soundcloud",
|
||||
"extractor_key": "Soundcloud",
|
||||
"heatmap": [],
|
||||
"automatic_captions": {}
|
||||
}
|
124
tests/components/media_extractor/fixtures/no_formats_result.json
Normal file
124
tests/components/media_extractor/fixtures/no_formats_result.json
Normal file
@ -0,0 +1,124 @@
|
||||
{
|
||||
"id": "223644255",
|
||||
"uploader": "BRUTTOBAND",
|
||||
"uploader_id": "111488150",
|
||||
"uploader_url": "https://soundcloud.com/bruttoband",
|
||||
"timestamp": 1442140228,
|
||||
"title": "BRUTTO - \u0420\u043e\u0434\u043d\u044b \u043a\u0440\u0430\u0439",
|
||||
"description": "",
|
||||
"thumbnails": [
|
||||
{
|
||||
"id": "mini",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-mini.jpg",
|
||||
"width": 16,
|
||||
"height": 16,
|
||||
"resolution": "16x16"
|
||||
},
|
||||
{
|
||||
"id": "tiny",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-tiny.jpg",
|
||||
"width": 20,
|
||||
"height": 20,
|
||||
"resolution": "20x20"
|
||||
},
|
||||
{
|
||||
"id": "small",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-small.jpg",
|
||||
"width": 32,
|
||||
"height": 32,
|
||||
"resolution": "32x32"
|
||||
},
|
||||
{
|
||||
"id": "badge",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-badge.jpg",
|
||||
"width": 47,
|
||||
"height": 47,
|
||||
"resolution": "47x47"
|
||||
},
|
||||
{
|
||||
"id": "t67x67",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t67x67.jpg",
|
||||
"width": 67,
|
||||
"height": 67,
|
||||
"resolution": "67x67"
|
||||
},
|
||||
{
|
||||
"id": "large",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-large.jpg",
|
||||
"width": 100,
|
||||
"height": 100,
|
||||
"resolution": "100x100"
|
||||
},
|
||||
{
|
||||
"id": "t300x300",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t300x300.jpg",
|
||||
"width": 300,
|
||||
"height": 300,
|
||||
"resolution": "300x300"
|
||||
},
|
||||
{
|
||||
"id": "crop",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-crop.jpg",
|
||||
"width": 400,
|
||||
"height": 400,
|
||||
"resolution": "400x400"
|
||||
},
|
||||
{
|
||||
"id": "t500x500",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t500x500.jpg",
|
||||
"width": 500,
|
||||
"height": 500,
|
||||
"resolution": "500x500"
|
||||
},
|
||||
{
|
||||
"id": "original",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-original.jpg",
|
||||
"preference": 10
|
||||
}
|
||||
],
|
||||
"duration": 229.089,
|
||||
"webpage_url": "https://soundcloud.com/bruttoband/brutto-11",
|
||||
"license": "all-rights-reserved",
|
||||
"view_count": 290864,
|
||||
"like_count": 3342,
|
||||
"comment_count": 14,
|
||||
"repost_count": 60,
|
||||
"genre": "Brutto",
|
||||
"original_url": "https://soundcloud.com/bruttoband/brutto-11",
|
||||
"webpage_url_basename": "brutto-11",
|
||||
"webpage_url_domain": "soundcloud.com",
|
||||
"extractor": "soundcloud",
|
||||
"extractor_key": "Soundcloud",
|
||||
"heatmap": [],
|
||||
"automatic_captions": {},
|
||||
"playlist": null,
|
||||
"playlist_index": null,
|
||||
"thumbnail": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-original.jpg",
|
||||
"display_id": "223644255",
|
||||
"fulltitle": "BRUTTO - \u0420\u043e\u0434\u043d\u044b \u043a\u0440\u0430\u0439",
|
||||
"duration_string": "3:49",
|
||||
"upload_date": "20150913",
|
||||
"requested_subtitles": null,
|
||||
"_has_drm": null,
|
||||
"epoch": 1694798244,
|
||||
"url": "https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk4NTkzfX19XX0_&Signature=flALJvEBnzS0ZOOhf0-07Ap~NURw2Gn2OqkeKKTTMX5HRGJw9eXFay79tcC4GsMMXWUgWoCx-n3yelpyilE2MOEIufBNUbjqRfMSJaX5YhYxjQdoDYuiU~gqBzJyPw9pKzr6P8~5HNKL3Idr0CNhUzdV6FQLaUPKMMibq9ghV833mUmdyvdk1~GZBc8MOg9GrTdcigGgpPzd-vrIMICMvFzFnwBOeOotxX2Vfqf9~wVekBKGlvB9A~7TlZ71lv9Fl9u4m8rse9E-mByweVc1M784ehJV3~tRPjuF~FXXWKP8x0nGJmoq7RAnG7iFIt~fQFmsfOq2o~PG7dHMRPh7hw__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "mp3",
|
||||
"abr": 128,
|
||||
"format_id": "http_mp3_128",
|
||||
"protocol": "http",
|
||||
"preference": null,
|
||||
"vcodec": "none",
|
||||
"resolution": "audio only",
|
||||
"aspect_ratio": null,
|
||||
"http_headers": {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en-us,en;q=0.5",
|
||||
"Sec-Fetch-Mode": "navigate"
|
||||
},
|
||||
"audio_ext": "mp3",
|
||||
"video_ext": "none",
|
||||
"vbr": 0,
|
||||
"tbr": 128,
|
||||
"format": "http_mp3_128 - audio only"
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
{
|
||||
"id": "223644255",
|
||||
"uploader": "BRUTTOBAND",
|
||||
"uploader_id": "111488150",
|
||||
"uploader_url": "https://soundcloud.com/bruttoband",
|
||||
"timestamp": 1442140228,
|
||||
"title": "BRUTTO - \u0420\u043e\u0434\u043d\u044b \u043a\u0440\u0430\u0439",
|
||||
"description": "",
|
||||
"thumbnails": [
|
||||
{
|
||||
"id": "mini",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-mini.jpg",
|
||||
"width": 16,
|
||||
"height": 16,
|
||||
"resolution": "16x16"
|
||||
},
|
||||
{
|
||||
"id": "tiny",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-tiny.jpg",
|
||||
"width": 20,
|
||||
"height": 20,
|
||||
"resolution": "20x20"
|
||||
},
|
||||
{
|
||||
"id": "small",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-small.jpg",
|
||||
"width": 32,
|
||||
"height": 32,
|
||||
"resolution": "32x32"
|
||||
},
|
||||
{
|
||||
"id": "badge",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-badge.jpg",
|
||||
"width": 47,
|
||||
"height": 47,
|
||||
"resolution": "47x47"
|
||||
},
|
||||
{
|
||||
"id": "t67x67",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t67x67.jpg",
|
||||
"width": 67,
|
||||
"height": 67,
|
||||
"resolution": "67x67"
|
||||
},
|
||||
{
|
||||
"id": "large",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-large.jpg",
|
||||
"width": 100,
|
||||
"height": 100,
|
||||
"resolution": "100x100"
|
||||
},
|
||||
{
|
||||
"id": "t300x300",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t300x300.jpg",
|
||||
"width": 300,
|
||||
"height": 300,
|
||||
"resolution": "300x300"
|
||||
},
|
||||
{
|
||||
"id": "crop",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-crop.jpg",
|
||||
"width": 400,
|
||||
"height": 400,
|
||||
"resolution": "400x400"
|
||||
},
|
||||
{
|
||||
"id": "t500x500",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t500x500.jpg",
|
||||
"width": 500,
|
||||
"height": 500,
|
||||
"resolution": "500x500"
|
||||
},
|
||||
{
|
||||
"id": "original",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-original.jpg",
|
||||
"preference": 10
|
||||
}
|
||||
],
|
||||
"duration": 229.089,
|
||||
"webpage_url": "https://soundcloud.com/bruttoband/brutto-11",
|
||||
"license": "all-rights-reserved",
|
||||
"view_count": 290870,
|
||||
"like_count": 3342,
|
||||
"comment_count": 14,
|
||||
"repost_count": 60,
|
||||
"genre": "Brutto",
|
||||
"original_url": "https://soundcloud.com/bruttoband/brutto-11",
|
||||
"webpage_url_basename": "brutto-11",
|
||||
"webpage_url_domain": "soundcloud.com",
|
||||
"extractor": "soundcloud",
|
||||
"extractor_key": "Soundcloud",
|
||||
"heatmap": [],
|
||||
"automatic_captions": {},
|
||||
"playlist": null,
|
||||
"playlist_index": null,
|
||||
"thumbnail": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-original.jpg",
|
||||
"display_id": "223644255",
|
||||
"fulltitle": "BRUTTO - \u0420\u043e\u0434\u043d\u044b \u043a\u0440\u0430\u0439",
|
||||
"duration_string": "3:49",
|
||||
"upload_date": "20150913",
|
||||
"requested_subtitles": null,
|
||||
"_has_drm": null,
|
||||
"epoch": 1694798829,
|
||||
"url": "https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk5MTc5fX19XX0_&Signature=JtF8BXxTCElhjCrhnSAq3W6z960VmdVXx7BPhQvI0MCxr~J43JFGO8CVw9-VBM2oEf14mqWo63-C0FO29DvUuBZnmLD3dhDfryVfWJsrix7voimoRDaNFE~3zntDbg7O2S8uWYyZK8OZC9anzwokvjH7jbmviWqK4~2IM9dwgejGgzrQU1aadV2Yro7NJZnF7SD~7tVjkM-hBg~X5zDYVxmGrdzN3tFoLwRmUch6RNDL~1DcWBk0AveBKQFAdBrFBjDDUeIyDz9Idhw2aG9~fjfckcf95KwqrVQxz1N5XEzfNDDo8xkUgDt0eb9dtXdwxLJ0swC6e5VLS8bsH91GMg__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "mp3",
|
||||
"abr": 128,
|
||||
"format_id": "http_mp3_128",
|
||||
"protocol": "http",
|
||||
"preference": null,
|
||||
"vcodec": "none",
|
||||
"resolution": "audio only",
|
||||
"aspect_ratio": null,
|
||||
"http_headers": {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en-us,en;q=0.5",
|
||||
"Sec-Fetch-Mode": "navigate"
|
||||
},
|
||||
"audio_ext": "mp3",
|
||||
"video_ext": "none",
|
||||
"vbr": 0,
|
||||
"tbr": 128,
|
||||
"format": "http_mp3_128 - audio only"
|
||||
}
|
114
tests/components/media_extractor/fixtures/soundcloud_info.json
Normal file
114
tests/components/media_extractor/fixtures/soundcloud_info.json
Normal file
@ -0,0 +1,114 @@
|
||||
{
|
||||
"id": "223644255",
|
||||
"uploader": "BRUTTOBAND",
|
||||
"uploader_id": "111488150",
|
||||
"uploader_url": "https://soundcloud.com/bruttoband",
|
||||
"timestamp": 1442140228,
|
||||
"title": "BRUTTO - \u0420\u043e\u0434\u043d\u044b \u043a\u0440\u0430\u0439",
|
||||
"description": "",
|
||||
"thumbnails": [
|
||||
{
|
||||
"id": "mini",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-mini.jpg",
|
||||
"width": 16,
|
||||
"height": 16
|
||||
},
|
||||
{
|
||||
"id": "tiny",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-tiny.jpg",
|
||||
"width": 20,
|
||||
"height": 20
|
||||
},
|
||||
{
|
||||
"id": "small",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-small.jpg",
|
||||
"width": 32,
|
||||
"height": 32
|
||||
},
|
||||
{
|
||||
"id": "badge",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-badge.jpg",
|
||||
"width": 47,
|
||||
"height": 47
|
||||
},
|
||||
{
|
||||
"id": "t67x67",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t67x67.jpg",
|
||||
"width": 67,
|
||||
"height": 67
|
||||
},
|
||||
{
|
||||
"id": "large",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-large.jpg",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
{
|
||||
"id": "t300x300",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t300x300.jpg",
|
||||
"width": 300,
|
||||
"height": 300
|
||||
},
|
||||
{
|
||||
"id": "crop",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-crop.jpg",
|
||||
"width": 400,
|
||||
"height": 400
|
||||
},
|
||||
{
|
||||
"id": "t500x500",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t500x500.jpg",
|
||||
"width": 500,
|
||||
"height": 500
|
||||
},
|
||||
{
|
||||
"id": "original",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-original.jpg",
|
||||
"preference": 10
|
||||
}
|
||||
],
|
||||
"duration": 229.089,
|
||||
"webpage_url": "https://soundcloud.com/bruttoband/brutto-11",
|
||||
"license": "all-rights-reserved",
|
||||
"view_count": 290864,
|
||||
"like_count": 3342,
|
||||
"comment_count": 14,
|
||||
"repost_count": 60,
|
||||
"genre": "Brutto",
|
||||
"formats": [
|
||||
{
|
||||
"url": "https://cf-hls-media.sndcdn.com/playlist/50remGX1OqRY.128.mp3/playlist.m3u8?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLWhscy1tZWRpYS5zbmRjZG4uY29tL3BsYXlsaXN0LzUwcmVtR1gxT3FSWS4xMjgubXAzL3BsYXlsaXN0Lm0zdTgqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk4NTkzfX19XX0_&Signature=Nz4jXIokS4VBJ3AB~qzud7B2lEiGOZsu~k3BAOw4MdaT3Vqpq2wFoN9Nj5adjhPziclvTCitiro7oAYgHx-T6sKoUkgXXaanrhpUnmtnSWKSGHMIcGRjZD5~WnN9jc3VXt7kC1-1UMR3eiCgsNs~~iZSdr0EOk-W6IIJZ-XdIHJFekpcf3tt56uyoyicFfgRndjfbB9qijp3w1JVbNrAWL0oOHjk-76zspjytDQkunxtcT1cVd5VC1FiLd1azwX9bWkCHsb4Kk2sE0RRhycN7FePoG1FQysuN8deZ17NYD0CVi6QaHYzoQKrARODt1J-o0xAZWTbiwSobWcyZVc2ug__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "mp3",
|
||||
"abr": 128,
|
||||
"format_id": "hls_mp3_128",
|
||||
"protocol": "m3u8_native",
|
||||
"preference": null,
|
||||
"vcodec": "none"
|
||||
},
|
||||
{
|
||||
"url": "https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk4NTkzfX19XX0_&Signature=flALJvEBnzS0ZOOhf0-07Ap~NURw2Gn2OqkeKKTTMX5HRGJw9eXFay79tcC4GsMMXWUgWoCx-n3yelpyilE2MOEIufBNUbjqRfMSJaX5YhYxjQdoDYuiU~gqBzJyPw9pKzr6P8~5HNKL3Idr0CNhUzdV6FQLaUPKMMibq9ghV833mUmdyvdk1~GZBc8MOg9GrTdcigGgpPzd-vrIMICMvFzFnwBOeOotxX2Vfqf9~wVekBKGlvB9A~7TlZ71lv9Fl9u4m8rse9E-mByweVc1M784ehJV3~tRPjuF~FXXWKP8x0nGJmoq7RAnG7iFIt~fQFmsfOq2o~PG7dHMRPh7hw__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "mp3",
|
||||
"abr": 128,
|
||||
"format_id": "http_mp3_128",
|
||||
"protocol": "http",
|
||||
"preference": null,
|
||||
"vcodec": "none"
|
||||
},
|
||||
{
|
||||
"url": "https://cf-hls-opus-media.sndcdn.com/playlist/50remGX1OqRY.64.opus/playlist.m3u8?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLWhscy1vcHVzLW1lZGlhLnNuZGNkbi5jb20vcGxheWxpc3QvNTByZW1HWDFPcVJZLjY0Lm9wdXMvcGxheWxpc3QubTN1OCoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2OTQ3OTg1OTN9fX1dfQ__&Signature=R2kxbkBwFOP8olMikw3IMYlC5gqMY173VH07Rq9Aq1vDkGbQwZzMd2OocIFQlsIhHDacH7WKPWdAqMFzuSb4KpHo6hi7KouM3dxXY5QgzQPRtfACyIbR3Kka7DGSVScJaCejp1xy5YoqEIhr8N36iogBPELiZs1jDAHf99cJnMHFN8SCMrej2BSNMSbCAaUXN2TlyViMR3yiG-kGY-RIs8pHDg0QE-M1tPAAAc94GynFDhbexHqFl-QIFQ4RxG9Pu7ooXqEG~xV848fgOUPUYC3yjCDZ7KKkW5BexSPD-ebavodz6kNU62GdIeuNzY3g-wftNLSQgwaMkg3aWj3VMA__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "opus",
|
||||
"abr": 64,
|
||||
"format_id": "hls_opus_64",
|
||||
"protocol": "m3u8_native",
|
||||
"preference": null,
|
||||
"vcodec": "none"
|
||||
}
|
||||
],
|
||||
"original_url": "https://soundcloud.com/bruttoband/brutto-11",
|
||||
"webpage_url_basename": "brutto-11",
|
||||
"webpage_url_domain": "soundcloud.com",
|
||||
"extractor": "soundcloud",
|
||||
"extractor_key": "Soundcloud",
|
||||
"heatmap": [],
|
||||
"automatic_captions": {}
|
||||
}
|
192
tests/components/media_extractor/fixtures/soundcloud_result.json
Normal file
192
tests/components/media_extractor/fixtures/soundcloud_result.json
Normal file
@ -0,0 +1,192 @@
|
||||
{
|
||||
"id": "223644255",
|
||||
"uploader": "BRUTTOBAND",
|
||||
"uploader_id": "111488150",
|
||||
"uploader_url": "https://soundcloud.com/bruttoband",
|
||||
"timestamp": 1442140228,
|
||||
"title": "BRUTTO - \u0420\u043e\u0434\u043d\u044b \u043a\u0440\u0430\u0439",
|
||||
"description": "",
|
||||
"thumbnails": [
|
||||
{
|
||||
"id": "mini",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-mini.jpg",
|
||||
"width": 16,
|
||||
"height": 16,
|
||||
"resolution": "16x16"
|
||||
},
|
||||
{
|
||||
"id": "tiny",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-tiny.jpg",
|
||||
"width": 20,
|
||||
"height": 20,
|
||||
"resolution": "20x20"
|
||||
},
|
||||
{
|
||||
"id": "small",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-small.jpg",
|
||||
"width": 32,
|
||||
"height": 32,
|
||||
"resolution": "32x32"
|
||||
},
|
||||
{
|
||||
"id": "badge",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-badge.jpg",
|
||||
"width": 47,
|
||||
"height": 47,
|
||||
"resolution": "47x47"
|
||||
},
|
||||
{
|
||||
"id": "t67x67",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t67x67.jpg",
|
||||
"width": 67,
|
||||
"height": 67,
|
||||
"resolution": "67x67"
|
||||
},
|
||||
{
|
||||
"id": "large",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-large.jpg",
|
||||
"width": 100,
|
||||
"height": 100,
|
||||
"resolution": "100x100"
|
||||
},
|
||||
{
|
||||
"id": "t300x300",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t300x300.jpg",
|
||||
"width": 300,
|
||||
"height": 300,
|
||||
"resolution": "300x300"
|
||||
},
|
||||
{
|
||||
"id": "crop",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-crop.jpg",
|
||||
"width": 400,
|
||||
"height": 400,
|
||||
"resolution": "400x400"
|
||||
},
|
||||
{
|
||||
"id": "t500x500",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t500x500.jpg",
|
||||
"width": 500,
|
||||
"height": 500,
|
||||
"resolution": "500x500"
|
||||
},
|
||||
{
|
||||
"id": "original",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-original.jpg",
|
||||
"preference": 10
|
||||
}
|
||||
],
|
||||
"duration": 229.089,
|
||||
"webpage_url": "https://soundcloud.com/bruttoband/brutto-11",
|
||||
"license": "all-rights-reserved",
|
||||
"view_count": 290864,
|
||||
"like_count": 3342,
|
||||
"comment_count": 14,
|
||||
"repost_count": 60,
|
||||
"genre": "Brutto",
|
||||
"formats": [
|
||||
{
|
||||
"url": "https://cf-hls-opus-media.sndcdn.com/playlist/50remGX1OqRY.64.opus/playlist.m3u8?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLWhscy1vcHVzLW1lZGlhLnNuZGNkbi5jb20vcGxheWxpc3QvNTByZW1HWDFPcVJZLjY0Lm9wdXMvcGxheWxpc3QubTN1OCoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2OTQ3OTg1OTN9fX1dfQ__&Signature=R2kxbkBwFOP8olMikw3IMYlC5gqMY173VH07Rq9Aq1vDkGbQwZzMd2OocIFQlsIhHDacH7WKPWdAqMFzuSb4KpHo6hi7KouM3dxXY5QgzQPRtfACyIbR3Kka7DGSVScJaCejp1xy5YoqEIhr8N36iogBPELiZs1jDAHf99cJnMHFN8SCMrej2BSNMSbCAaUXN2TlyViMR3yiG-kGY-RIs8pHDg0QE-M1tPAAAc94GynFDhbexHqFl-QIFQ4RxG9Pu7ooXqEG~xV848fgOUPUYC3yjCDZ7KKkW5BexSPD-ebavodz6kNU62GdIeuNzY3g-wftNLSQgwaMkg3aWj3VMA__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "opus",
|
||||
"abr": 64,
|
||||
"format_id": "hls_opus_64",
|
||||
"protocol": "m3u8_native",
|
||||
"preference": null,
|
||||
"vcodec": "none",
|
||||
"resolution": "audio only",
|
||||
"aspect_ratio": null,
|
||||
"http_headers": {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en-us,en;q=0.5",
|
||||
"Sec-Fetch-Mode": "navigate"
|
||||
},
|
||||
"audio_ext": "opus",
|
||||
"video_ext": "none",
|
||||
"vbr": 0,
|
||||
"tbr": 64,
|
||||
"format": "hls_opus_64 - audio only"
|
||||
},
|
||||
{
|
||||
"url": "https://cf-hls-media.sndcdn.com/playlist/50remGX1OqRY.128.mp3/playlist.m3u8?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLWhscy1tZWRpYS5zbmRjZG4uY29tL3BsYXlsaXN0LzUwcmVtR1gxT3FSWS4xMjgubXAzL3BsYXlsaXN0Lm0zdTgqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk4NTkzfX19XX0_&Signature=Nz4jXIokS4VBJ3AB~qzud7B2lEiGOZsu~k3BAOw4MdaT3Vqpq2wFoN9Nj5adjhPziclvTCitiro7oAYgHx-T6sKoUkgXXaanrhpUnmtnSWKSGHMIcGRjZD5~WnN9jc3VXt7kC1-1UMR3eiCgsNs~~iZSdr0EOk-W6IIJZ-XdIHJFekpcf3tt56uyoyicFfgRndjfbB9qijp3w1JVbNrAWL0oOHjk-76zspjytDQkunxtcT1cVd5VC1FiLd1azwX9bWkCHsb4Kk2sE0RRhycN7FePoG1FQysuN8deZ17NYD0CVi6QaHYzoQKrARODt1J-o0xAZWTbiwSobWcyZVc2ug__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "mp3",
|
||||
"abr": 128,
|
||||
"format_id": "hls_mp3_128",
|
||||
"protocol": "m3u8_native",
|
||||
"preference": null,
|
||||
"vcodec": "none",
|
||||
"resolution": "audio only",
|
||||
"aspect_ratio": null,
|
||||
"http_headers": {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en-us,en;q=0.5",
|
||||
"Sec-Fetch-Mode": "navigate"
|
||||
},
|
||||
"audio_ext": "mp3",
|
||||
"video_ext": "none",
|
||||
"vbr": 0,
|
||||
"tbr": 128,
|
||||
"format": "hls_mp3_128 - audio only"
|
||||
},
|
||||
{
|
||||
"url": "https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk4NTkzfX19XX0_&Signature=flALJvEBnzS0ZOOhf0-07Ap~NURw2Gn2OqkeKKTTMX5HRGJw9eXFay79tcC4GsMMXWUgWoCx-n3yelpyilE2MOEIufBNUbjqRfMSJaX5YhYxjQdoDYuiU~gqBzJyPw9pKzr6P8~5HNKL3Idr0CNhUzdV6FQLaUPKMMibq9ghV833mUmdyvdk1~GZBc8MOg9GrTdcigGgpPzd-vrIMICMvFzFnwBOeOotxX2Vfqf9~wVekBKGlvB9A~7TlZ71lv9Fl9u4m8rse9E-mByweVc1M784ehJV3~tRPjuF~FXXWKP8x0nGJmoq7RAnG7iFIt~fQFmsfOq2o~PG7dHMRPh7hw__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "mp3",
|
||||
"abr": 128,
|
||||
"format_id": "http_mp3_128",
|
||||
"protocol": "http",
|
||||
"preference": null,
|
||||
"vcodec": "none",
|
||||
"resolution": "audio only",
|
||||
"aspect_ratio": null,
|
||||
"http_headers": {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en-us,en;q=0.5",
|
||||
"Sec-Fetch-Mode": "navigate"
|
||||
},
|
||||
"audio_ext": "mp3",
|
||||
"video_ext": "none",
|
||||
"vbr": 0,
|
||||
"tbr": 128,
|
||||
"format": "http_mp3_128 - audio only"
|
||||
}
|
||||
],
|
||||
"original_url": "https://soundcloud.com/bruttoband/brutto-11",
|
||||
"webpage_url_basename": "brutto-11",
|
||||
"webpage_url_domain": "soundcloud.com",
|
||||
"extractor": "soundcloud",
|
||||
"extractor_key": "Soundcloud",
|
||||
"heatmap": [],
|
||||
"automatic_captions": {},
|
||||
"playlist": null,
|
||||
"playlist_index": null,
|
||||
"thumbnail": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-original.jpg",
|
||||
"display_id": "223644255",
|
||||
"fulltitle": "BRUTTO - \u0420\u043e\u0434\u043d\u044b \u043a\u0440\u0430\u0439",
|
||||
"duration_string": "3:49",
|
||||
"upload_date": "20150913",
|
||||
"requested_subtitles": null,
|
||||
"_has_drm": null,
|
||||
"epoch": 1694798244,
|
||||
"url": "https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk4NTkzfX19XX0_&Signature=flALJvEBnzS0ZOOhf0-07Ap~NURw2Gn2OqkeKKTTMX5HRGJw9eXFay79tcC4GsMMXWUgWoCx-n3yelpyilE2MOEIufBNUbjqRfMSJaX5YhYxjQdoDYuiU~gqBzJyPw9pKzr6P8~5HNKL3Idr0CNhUzdV6FQLaUPKMMibq9ghV833mUmdyvdk1~GZBc8MOg9GrTdcigGgpPzd-vrIMICMvFzFnwBOeOotxX2Vfqf9~wVekBKGlvB9A~7TlZ71lv9Fl9u4m8rse9E-mByweVc1M784ehJV3~tRPjuF~FXXWKP8x0nGJmoq7RAnG7iFIt~fQFmsfOq2o~PG7dHMRPh7hw__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "mp3",
|
||||
"abr": 128,
|
||||
"format_id": "http_mp3_128",
|
||||
"protocol": "http",
|
||||
"preference": null,
|
||||
"vcodec": "none",
|
||||
"resolution": "audio only",
|
||||
"aspect_ratio": null,
|
||||
"http_headers": {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en-us,en;q=0.5",
|
||||
"Sec-Fetch-Mode": "navigate"
|
||||
},
|
||||
"audio_ext": "mp3",
|
||||
"video_ext": "none",
|
||||
"vbr": 0,
|
||||
"tbr": 128,
|
||||
"format": "http_mp3_128 - audio only"
|
||||
}
|
@ -0,0 +1,192 @@
|
||||
{
|
||||
"id": "223644255",
|
||||
"uploader": "BRUTTOBAND",
|
||||
"uploader_id": "111488150",
|
||||
"uploader_url": "https://soundcloud.com/bruttoband",
|
||||
"timestamp": 1442140228,
|
||||
"title": "BRUTTO - \u0420\u043e\u0434\u043d\u044b \u043a\u0440\u0430\u0439",
|
||||
"description": "",
|
||||
"thumbnails": [
|
||||
{
|
||||
"id": "mini",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-mini.jpg",
|
||||
"width": 16,
|
||||
"height": 16,
|
||||
"resolution": "16x16"
|
||||
},
|
||||
{
|
||||
"id": "tiny",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-tiny.jpg",
|
||||
"width": 20,
|
||||
"height": 20,
|
||||
"resolution": "20x20"
|
||||
},
|
||||
{
|
||||
"id": "small",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-small.jpg",
|
||||
"width": 32,
|
||||
"height": 32,
|
||||
"resolution": "32x32"
|
||||
},
|
||||
{
|
||||
"id": "badge",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-badge.jpg",
|
||||
"width": 47,
|
||||
"height": 47,
|
||||
"resolution": "47x47"
|
||||
},
|
||||
{
|
||||
"id": "t67x67",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t67x67.jpg",
|
||||
"width": 67,
|
||||
"height": 67,
|
||||
"resolution": "67x67"
|
||||
},
|
||||
{
|
||||
"id": "large",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-large.jpg",
|
||||
"width": 100,
|
||||
"height": 100,
|
||||
"resolution": "100x100"
|
||||
},
|
||||
{
|
||||
"id": "t300x300",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t300x300.jpg",
|
||||
"width": 300,
|
||||
"height": 300,
|
||||
"resolution": "300x300"
|
||||
},
|
||||
{
|
||||
"id": "crop",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-crop.jpg",
|
||||
"width": 400,
|
||||
"height": 400,
|
||||
"resolution": "400x400"
|
||||
},
|
||||
{
|
||||
"id": "t500x500",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-t500x500.jpg",
|
||||
"width": 500,
|
||||
"height": 500,
|
||||
"resolution": "500x500"
|
||||
},
|
||||
{
|
||||
"id": "original",
|
||||
"url": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-original.jpg",
|
||||
"preference": 10
|
||||
}
|
||||
],
|
||||
"duration": 229.089,
|
||||
"webpage_url": "https://soundcloud.com/bruttoband/brutto-11",
|
||||
"license": "all-rights-reserved",
|
||||
"view_count": 290870,
|
||||
"like_count": 3342,
|
||||
"comment_count": 14,
|
||||
"repost_count": 60,
|
||||
"genre": "Brutto",
|
||||
"formats": [
|
||||
{
|
||||
"url": "https://cf-hls-opus-media.sndcdn.com/playlist/50remGX1OqRY.64.opus/playlist.m3u8?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLWhscy1vcHVzLW1lZGlhLnNuZGNkbi5jb20vcGxheWxpc3QvNTByZW1HWDFPcVJZLjY0Lm9wdXMvcGxheWxpc3QubTN1OCoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2OTQ3OTkxNzl9fX1dfQ__&Signature=RwhiR-Mxl364C~ElpyNWLOwq1zkMdy8koxJB09jy6BxU0YAFlRQb4vB34s6gMN7ycK7ubC7kDOyJ5TAoXu8M4Jtxh8zkAmhy4RFwclsrquliRmszQBPyMXYTdsNa~JJCydEEUlSmxUCGxZZXtXWvKLDBkqcz5PAlFRQZFKnow3xJleM~Oy6sYkRvq6YH3G3sR4svUdU6V8582QpnLqB0BZp3xtcNaHFQQutpneIWzULhSKp65iGZIKL2d9xCB5PF4YUSQwXGfec6O~6G63HN~lGwq5HOWZm2jN87d4Q30QnETh3FThcf5~TomYcEzV1hKqBFneRs8jRhOkdExiCdWg__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "opus",
|
||||
"abr": 64,
|
||||
"format_id": "hls_opus_64",
|
||||
"protocol": "m3u8_native",
|
||||
"preference": null,
|
||||
"vcodec": "none",
|
||||
"resolution": "audio only",
|
||||
"aspect_ratio": null,
|
||||
"http_headers": {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en-us,en;q=0.5",
|
||||
"Sec-Fetch-Mode": "navigate"
|
||||
},
|
||||
"audio_ext": "opus",
|
||||
"video_ext": "none",
|
||||
"vbr": 0,
|
||||
"tbr": 64,
|
||||
"format": "hls_opus_64 - audio only"
|
||||
},
|
||||
{
|
||||
"url": "https://cf-hls-media.sndcdn.com/playlist/50remGX1OqRY.128.mp3/playlist.m3u8?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLWhscy1tZWRpYS5zbmRjZG4uY29tL3BsYXlsaXN0LzUwcmVtR1gxT3FSWS4xMjgubXAzL3BsYXlsaXN0Lm0zdTgqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk5MTc5fX19XX0_&Signature=OZGdUNyVgOztaOWLoe8FPCDNtLrAmQK8nNfecpnMReiO3bsRPTL8bD7E1nVOfXMYPB4MD-lHDFtWM4nJenCmi6ctyHI-H48A9ELM2-bDbLuD2I6cgweJ5xUSVKFpS8CmWHIgAhVXycUYiWD9cqgf4-EsVNgJr41vIFGmw1RJZsKcC3zC3xxg6enb4fJZ0Q~vwNjUoMb3gBaIsEC-Hoy5LRZC5kp1ro8kLKH-Yi~9i2nYkqIZkDqpt7PrIKP379MYexxsmXWOUeL0iRXZ93qM10YHxOS09d22o~kVaUQx0MDRZgrm8ku7gV~tmAN77JmZ9cnDAuKdh6vHwzVVOTdqCg__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "mp3",
|
||||
"abr": 128,
|
||||
"format_id": "hls_mp3_128",
|
||||
"protocol": "m3u8_native",
|
||||
"preference": null,
|
||||
"vcodec": "none",
|
||||
"resolution": "audio only",
|
||||
"aspect_ratio": null,
|
||||
"http_headers": {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en-us,en;q=0.5",
|
||||
"Sec-Fetch-Mode": "navigate"
|
||||
},
|
||||
"audio_ext": "mp3",
|
||||
"video_ext": "none",
|
||||
"vbr": 0,
|
||||
"tbr": 128,
|
||||
"format": "hls_mp3_128 - audio only"
|
||||
},
|
||||
{
|
||||
"url": "https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk5MTc5fX19XX0_&Signature=JtF8BXxTCElhjCrhnSAq3W6z960VmdVXx7BPhQvI0MCxr~J43JFGO8CVw9-VBM2oEf14mqWo63-C0FO29DvUuBZnmLD3dhDfryVfWJsrix7voimoRDaNFE~3zntDbg7O2S8uWYyZK8OZC9anzwokvjH7jbmviWqK4~2IM9dwgejGgzrQU1aadV2Yro7NJZnF7SD~7tVjkM-hBg~X5zDYVxmGrdzN3tFoLwRmUch6RNDL~1DcWBk0AveBKQFAdBrFBjDDUeIyDz9Idhw2aG9~fjfckcf95KwqrVQxz1N5XEzfNDDo8xkUgDt0eb9dtXdwxLJ0swC6e5VLS8bsH91GMg__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "mp3",
|
||||
"abr": 128,
|
||||
"format_id": "http_mp3_128",
|
||||
"protocol": "http",
|
||||
"preference": null,
|
||||
"vcodec": "none",
|
||||
"resolution": "audio only",
|
||||
"aspect_ratio": null,
|
||||
"http_headers": {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en-us,en;q=0.5",
|
||||
"Sec-Fetch-Mode": "navigate"
|
||||
},
|
||||
"audio_ext": "mp3",
|
||||
"video_ext": "none",
|
||||
"vbr": 0,
|
||||
"tbr": 128,
|
||||
"format": "http_mp3_128 - audio only"
|
||||
}
|
||||
],
|
||||
"original_url": "https://soundcloud.com/bruttoband/brutto-11",
|
||||
"webpage_url_basename": "brutto-11",
|
||||
"webpage_url_domain": "soundcloud.com",
|
||||
"extractor": "soundcloud",
|
||||
"extractor_key": "Soundcloud",
|
||||
"heatmap": [],
|
||||
"automatic_captions": {},
|
||||
"playlist": null,
|
||||
"playlist_index": null,
|
||||
"thumbnail": "https://i1.sndcdn.com/artworks-000129385232-ysbisn-original.jpg",
|
||||
"display_id": "223644255",
|
||||
"fulltitle": "BRUTTO - \u0420\u043e\u0434\u043d\u044b \u043a\u0440\u0430\u0439",
|
||||
"duration_string": "3:49",
|
||||
"upload_date": "20150913",
|
||||
"requested_subtitles": null,
|
||||
"_has_drm": null,
|
||||
"epoch": 1694798829,
|
||||
"url": "https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk5MTc5fX19XX0_&Signature=JtF8BXxTCElhjCrhnSAq3W6z960VmdVXx7BPhQvI0MCxr~J43JFGO8CVw9-VBM2oEf14mqWo63-C0FO29DvUuBZnmLD3dhDfryVfWJsrix7voimoRDaNFE~3zntDbg7O2S8uWYyZK8OZC9anzwokvjH7jbmviWqK4~2IM9dwgejGgzrQU1aadV2Yro7NJZnF7SD~7tVjkM-hBg~X5zDYVxmGrdzN3tFoLwRmUch6RNDL~1DcWBk0AveBKQFAdBrFBjDDUeIyDz9Idhw2aG9~fjfckcf95KwqrVQxz1N5XEzfNDDo8xkUgDt0eb9dtXdwxLJ0swC6e5VLS8bsH91GMg__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ",
|
||||
"ext": "mp3",
|
||||
"abr": 128,
|
||||
"format_id": "http_mp3_128",
|
||||
"protocol": "http",
|
||||
"preference": null,
|
||||
"vcodec": "none",
|
||||
"resolution": "audio only",
|
||||
"aspect_ratio": null,
|
||||
"http_headers": {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en-us,en;q=0.5",
|
||||
"Sec-Fetch-Mode": "navigate"
|
||||
},
|
||||
"audio_ext": "mp3",
|
||||
"video_ext": "none",
|
||||
"vbr": 0,
|
||||
"tbr": 128,
|
||||
"format": "http_mp3_128 - audio only"
|
||||
}
|
1430
tests/components/media_extractor/fixtures/youtube_1_info.json
Normal file
1430
tests/components/media_extractor/fixtures/youtube_1_info.json
Normal file
File diff suppressed because it is too large
Load Diff
2264
tests/components/media_extractor/fixtures/youtube_1_result.json
Normal file
2264
tests/components/media_extractor/fixtures/youtube_1_result.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,49 @@
|
||||
{
|
||||
"id": "PLZ4DbyIWUwCq4V8bIEa8jm2ozHZVuREJO",
|
||||
"title": "Very important videos",
|
||||
"availability": "public",
|
||||
"channel_follower_count": null,
|
||||
"description": "Not original",
|
||||
"tags": [],
|
||||
"thumbnails": [
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/q6EoRBvdVPQ/hqdefault.jpg?sqp=-oaymwEwCKgBEF5IWvKriqkDIwgBFQAAiEIYAfABAfgB3gOAAugCigIMCAAQARg8IGUoPzAP&rs=AOn4CLDBCH5IQ0obogxXhAzIH8pE0d7r1Q",
|
||||
"height": 94,
|
||||
"width": 168
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/q6EoRBvdVPQ/hqdefault.jpg?sqp=-oaymwEwCMQBEG5IWvKriqkDIwgBFQAAiEIYAfABAfgB3gOAAugCigIMCAAQARg8IGUoPzAP&rs=AOn4CLAybhgn-CoPMjBE-0VfBDqvy0jyOQ",
|
||||
"height": 110,
|
||||
"width": 196
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/q6EoRBvdVPQ/hqdefault.jpg?sqp=-oaymwExCPYBEIoBSFryq4qpAyMIARUAAIhCGAHwAQH4Ad4DgALoAooCDAgAEAEYPCBlKD8wDw==&rs=AOn4CLDutIdjr5zTE9G78eWf83-mGXYnUA",
|
||||
"height": 138,
|
||||
"width": 246
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/q6EoRBvdVPQ/hqdefault.jpg?sqp=-oaymwExCNACELwBSFryq4qpAyMIARUAAIhCGAHwAQH4Ad4DgALoAooCDAgAEAEYPCBlKD8wDw==&rs=AOn4CLD2884fHuvAv8ysHA48LD3uArB6bA",
|
||||
"height": 188,
|
||||
"width": 336
|
||||
}
|
||||
],
|
||||
"modified_date": "20230813",
|
||||
"view_count": 5680730,
|
||||
"playlist_count": 5,
|
||||
"channel": "Armand314",
|
||||
"channel_id": "UChOLuQpsxxmJiJUeSU2tSTw",
|
||||
"uploader_id": "@Armand314",
|
||||
"uploader": "Armand314",
|
||||
"channel_url": "https://www.youtube.com/channel/UChOLuQpsxxmJiJUeSU2tSTw",
|
||||
"uploader_url": "https://www.youtube.com/@Armand314",
|
||||
"_type": "playlist",
|
||||
"entries": [],
|
||||
"extractor_key": "YoutubeTab",
|
||||
"extractor": "youtube:tab",
|
||||
"webpage_url": "https://www.youtube.com/playlist?list=PLZ4DbyIWUwCq4V8bIEa8jm2ozHZVuREJO",
|
||||
"original_url": "https://www.youtube.com/playlist?list=PLZ4DbyIWUwCq4V8bIEa8jm2ozHZVuREJO",
|
||||
"webpage_url_basename": "playlist",
|
||||
"webpage_url_domain": "youtube.com",
|
||||
"heatmap": [],
|
||||
"automatic_captions": {}
|
||||
}
|
@ -0,0 +1,265 @@
|
||||
{
|
||||
"id": "PLZ4DbyIWUwCq4V8bIEa8jm2ozHZVuREJP",
|
||||
"title": "Very important videos",
|
||||
"availability": "public",
|
||||
"channel_follower_count": null,
|
||||
"description": "Not original",
|
||||
"tags": [],
|
||||
"thumbnails": [
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/q6EoRBvdVPQ/hqdefault.jpg?sqp=-oaymwEwCKgBEF5IWvKriqkDIwgBFQAAiEIYAfABAfgB3gOAAugCigIMCAAQARg8IGUoPzAP&rs=AOn4CLDBCH5IQ0obogxXhAzIH8pE0d7r1Q",
|
||||
"height": 94,
|
||||
"width": 168
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/q6EoRBvdVPQ/hqdefault.jpg?sqp=-oaymwEwCMQBEG5IWvKriqkDIwgBFQAAiEIYAfABAfgB3gOAAugCigIMCAAQARg8IGUoPzAP&rs=AOn4CLAybhgn-CoPMjBE-0VfBDqvy0jyOQ",
|
||||
"height": 110,
|
||||
"width": 196
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/q6EoRBvdVPQ/hqdefault.jpg?sqp=-oaymwExCPYBEIoBSFryq4qpAyMIARUAAIhCGAHwAQH4Ad4DgALoAooCDAgAEAEYPCBlKD8wDw==&rs=AOn4CLDutIdjr5zTE9G78eWf83-mGXYnUA",
|
||||
"height": 138,
|
||||
"width": 246
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/q6EoRBvdVPQ/hqdefault.jpg?sqp=-oaymwExCNACELwBSFryq4qpAyMIARUAAIhCGAHwAQH4Ad4DgALoAooCDAgAEAEYPCBlKD8wDw==&rs=AOn4CLD2884fHuvAv8ysHA48LD3uArB6bA",
|
||||
"height": 188,
|
||||
"width": 336
|
||||
}
|
||||
],
|
||||
"modified_date": "20230813",
|
||||
"view_count": 5680730,
|
||||
"playlist_count": 5,
|
||||
"channel": "Armand314",
|
||||
"channel_id": "UChOLuQpsxxmJiJUeSU2tSTw",
|
||||
"uploader_id": "@Armand314",
|
||||
"uploader": "Armand314",
|
||||
"channel_url": "https://www.youtube.com/channel/UChOLuQpsxxmJiJUeSU2tSTw",
|
||||
"uploader_url": "https://www.youtube.com/@Armand314",
|
||||
"_type": "playlist",
|
||||
"entries": [
|
||||
{
|
||||
"_type": "url",
|
||||
"ie_key": "Youtube",
|
||||
"id": "q6EoRBvdVPQ",
|
||||
"url": "https://www.youtube.com/watch?v=q6EoRBvdVPQ",
|
||||
"title": "Yee",
|
||||
"description": null,
|
||||
"duration": 10,
|
||||
"channel_id": "UC-fD_qwTEQQ1L-MUWx_mNvg",
|
||||
"channel": "revergo",
|
||||
"channel_url": "https://www.youtube.com/channel/UC-fD_qwTEQQ1L-MUWx_mNvg",
|
||||
"uploader": "revergo",
|
||||
"uploader_id": "@revergo",
|
||||
"uploader_url": "https://www.youtube.com/@revergo",
|
||||
"thumbnails": [
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/q6EoRBvdVPQ/hqdefault.jpg?sqp=-oaymwE1CKgBEF5IVfKriqkDKAgBFQAAiEIYAXABwAEG8AEB-AHeA4AC6AKKAgwIABABGDwgZSg_MA8=&rs=AOn4CLAJYg16HMBdEsv9lYBJyNqA5G3anQ",
|
||||
"height": 94,
|
||||
"width": 168
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/q6EoRBvdVPQ/hqdefault.jpg?sqp=-oaymwE1CMQBEG5IVfKriqkDKAgBFQAAiEIYAXABwAEG8AEB-AHeA4AC6AKKAgwIABABGDwgZSg_MA8=&rs=AOn4CLAgCNP9UuQas-D59hHHM-RqkUvA6g",
|
||||
"height": 110,
|
||||
"width": 196
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/q6EoRBvdVPQ/hqdefault.jpg?sqp=-oaymwE2CPYBEIoBSFXyq4qpAygIARUAAIhCGAFwAcABBvABAfgB3gOAAugCigIMCAAQARg8IGUoPzAP&rs=AOn4CLCTWaY5897XxhcpRyVtGQQNuMHfTg",
|
||||
"height": 138,
|
||||
"width": 246
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/q6EoRBvdVPQ/hqdefault.jpg?sqp=-oaymwE2CNACELwBSFXyq4qpAygIARUAAIhCGAFwAcABBvABAfgB3gOAAugCigIMCAAQARg8IGUoPzAP&rs=AOn4CLCeS6NC75yTYvyP4DsehZ3oXNuxMQ",
|
||||
"height": 188,
|
||||
"width": 336
|
||||
}
|
||||
],
|
||||
"timestamp": null,
|
||||
"release_timestamp": null,
|
||||
"availability": null,
|
||||
"view_count": 96000000,
|
||||
"live_status": null,
|
||||
"channel_is_verified": null
|
||||
},
|
||||
{
|
||||
"_type": "url",
|
||||
"ie_key": "Youtube",
|
||||
"id": "8YWl7tDGUPA",
|
||||
"url": "https://www.youtube.com/watch?v=8YWl7tDGUPA",
|
||||
"title": "color red",
|
||||
"description": null,
|
||||
"duration": 17,
|
||||
"channel_id": "UCbYMTn6xKV0IKshL4pRCV3g",
|
||||
"channel": "Alex Jimenez",
|
||||
"channel_url": "https://www.youtube.com/channel/UCbYMTn6xKV0IKshL4pRCV3g",
|
||||
"uploader": "Alex Jimenez",
|
||||
"uploader_id": "@alexjimenez1237",
|
||||
"uploader_url": "https://www.youtube.com/@alexjimenez1237",
|
||||
"thumbnails": [
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/8YWl7tDGUPA/hqdefault.jpg?sqp=-oaymwE1CKgBEF5IVfKriqkDKAgBFQAAiEIYAXABwAEG8AEB-AG2BIACwAKKAgwIABABGGUgXShUMA8=&rs=AOn4CLBqzngIx-4i_HFvqloetUfeN8yrYw",
|
||||
"height": 94,
|
||||
"width": 168
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/8YWl7tDGUPA/hqdefault.jpg?sqp=-oaymwE1CMQBEG5IVfKriqkDKAgBFQAAiEIYAXABwAEG8AEB-AG2BIACwAKKAgwIABABGGUgXShUMA8=&rs=AOn4CLB7mWPQmdL2QBLxTHhrgbFj2jFaCg",
|
||||
"height": 110,
|
||||
"width": 196
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/8YWl7tDGUPA/hqdefault.jpg?sqp=-oaymwE2CPYBEIoBSFXyq4qpAygIARUAAIhCGAFwAcABBvABAfgBtgSAAsACigIMCAAQARhlIF0oVDAP&rs=AOn4CLA9YAIO3g_DnClsuc5LjMQn4O9ZQQ",
|
||||
"height": 138,
|
||||
"width": 246
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/8YWl7tDGUPA/hqdefault.jpg?sqp=-oaymwE2CNACELwBSFXyq4qpAygIARUAAIhCGAFwAcABBvABAfgBtgSAAsACigIMCAAQARhlIF0oVDAP&rs=AOn4CLDPHY6aG08hlTJMlc-LJt9ywtpWEg",
|
||||
"height": 188,
|
||||
"width": 336
|
||||
}
|
||||
],
|
||||
"timestamp": null,
|
||||
"release_timestamp": null,
|
||||
"availability": null,
|
||||
"view_count": 30000000,
|
||||
"live_status": null,
|
||||
"channel_is_verified": null
|
||||
},
|
||||
{
|
||||
"_type": "url",
|
||||
"ie_key": "Youtube",
|
||||
"id": "6bnanI9jXps",
|
||||
"url": "https://www.youtube.com/watch?v=6bnanI9jXps",
|
||||
"title": "Terrible Mall Commercial",
|
||||
"description": null,
|
||||
"duration": 31,
|
||||
"channel_id": "UCLmnB20wsih9F5N0o5K0tig",
|
||||
"channel": "quantim",
|
||||
"channel_url": "https://www.youtube.com/channel/UCLmnB20wsih9F5N0o5K0tig",
|
||||
"uploader": "quantim",
|
||||
"uploader_id": "@Potatoflesh",
|
||||
"uploader_url": "https://www.youtube.com/@Potatoflesh",
|
||||
"thumbnails": [
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/6bnanI9jXps/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLAsyI0ZJA9STG8vlSdRkKk55ls5Dg",
|
||||
"height": 94,
|
||||
"width": 168
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/6bnanI9jXps/hqdefault.jpg?sqp=-oaymwEbCMQBEG5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLD2bZ9S8AB4UGsZlx_8TjBoL72enA",
|
||||
"height": 110,
|
||||
"width": 196
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/6bnanI9jXps/hqdefault.jpg?sqp=-oaymwEcCPYBEIoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCKNlgvl_7lKoFq8vyDYZRtTs4woA",
|
||||
"height": 138,
|
||||
"width": 246
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/6bnanI9jXps/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBeZv8F8IyICmKD9qjo9pTMJmM8ug",
|
||||
"height": 188,
|
||||
"width": 336
|
||||
}
|
||||
],
|
||||
"timestamp": null,
|
||||
"release_timestamp": null,
|
||||
"availability": null,
|
||||
"view_count": 26000000,
|
||||
"live_status": null,
|
||||
"channel_is_verified": null
|
||||
},
|
||||
{
|
||||
"_type": "url",
|
||||
"ie_key": "Youtube",
|
||||
"id": "SBeYzoQPbu8",
|
||||
"url": "https://www.youtube.com/watch?v=SBeYzoQPbu8",
|
||||
"title": "name a yellow fruit",
|
||||
"description": null,
|
||||
"duration": 4,
|
||||
"channel_id": "UCkRDJpXb96HrsdDSF8AwysA",
|
||||
"channel": "DaRkMaGiCiAn5009",
|
||||
"channel_url": "https://www.youtube.com/channel/UCkRDJpXb96HrsdDSF8AwysA",
|
||||
"uploader": "DaRkMaGiCiAn5009",
|
||||
"uploader_id": "@DaRkMaGiCiAn5009",
|
||||
"uploader_url": "https://www.youtube.com/@DaRkMaGiCiAn5009",
|
||||
"thumbnails": [
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/SBeYzoQPbu8/hqdefault.jpg?sqp=-oaymwE1CKgBEF5IVfKriqkDKAgBFQAAiEIYAXABwAEG8AEB-AHmAoAC6AKKAgwIABABGGUgUShHMA8=&rs=AOn4CLAZhgooxUn_fTi4K4OnWOcObof3TA",
|
||||
"height": 94,
|
||||
"width": 168
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/SBeYzoQPbu8/hqdefault.jpg?sqp=-oaymwE1CMQBEG5IVfKriqkDKAgBFQAAiEIYAXABwAEG8AEB-AHmAoAC6AKKAgwIABABGGUgUShHMA8=&rs=AOn4CLApcEdGLsf088qGyT2ITBRMD-toAg",
|
||||
"height": 110,
|
||||
"width": 196
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/SBeYzoQPbu8/hqdefault.jpg?sqp=-oaymwE2CPYBEIoBSFXyq4qpAygIARUAAIhCGAFwAcABBvABAfgB5gKAAugCigIMCAAQARhlIFEoRzAP&rs=AOn4CLBv0kiYaUPOX8JIg1rASAUhtxBxxA",
|
||||
"height": 138,
|
||||
"width": 246
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/SBeYzoQPbu8/hqdefault.jpg?sqp=-oaymwE2CNACELwBSFXyq4qpAygIARUAAIhCGAFwAcABBvABAfgB5gKAAugCigIMCAAQARhlIFEoRzAP&rs=AOn4CLBXN-tNsOG3AzyPZ7UgOuwS7mEs7g",
|
||||
"height": 188,
|
||||
"width": 336
|
||||
}
|
||||
],
|
||||
"timestamp": null,
|
||||
"release_timestamp": null,
|
||||
"availability": null,
|
||||
"view_count": 14000000,
|
||||
"live_status": null,
|
||||
"channel_is_verified": null
|
||||
},
|
||||
{
|
||||
"_type": "url",
|
||||
"ie_key": "Youtube",
|
||||
"id": "ixQkcuZhXg8",
|
||||
"url": "https://www.youtube.com/watch?v=ixQkcuZhXg8",
|
||||
"title": "The moment an old lady questions her own sanity",
|
||||
"description": null,
|
||||
"duration": 31,
|
||||
"channel_id": "UCVsKh1uG6_T0o8nYrtmqmyA",
|
||||
"channel": "Marcus",
|
||||
"channel_url": "https://www.youtube.com/channel/UCVsKh1uG6_T0o8nYrtmqmyA",
|
||||
"uploader": "Marcus",
|
||||
"uploader_id": "@Marcuskb92",
|
||||
"uploader_url": "https://www.youtube.com/@Marcuskb92",
|
||||
"thumbnails": [
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/ixQkcuZhXg8/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLCelxa91oGbhu8LhhLkcSiHF7YSGg",
|
||||
"height": 94,
|
||||
"width": 168
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/ixQkcuZhXg8/hqdefault.jpg?sqp=-oaymwEbCMQBEG5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLAAJnPf2Rl67uaRBR2lgkkBojkTiw",
|
||||
"height": 110,
|
||||
"width": 196
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/ixQkcuZhXg8/hqdefault.jpg?sqp=-oaymwEcCPYBEIoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBNoK36znIiRCoNE5tKnfF1oYXJ8A",
|
||||
"height": 138,
|
||||
"width": 246
|
||||
},
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/ixQkcuZhXg8/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCA_twfGS2acx005yqJgAYOT40qvQ",
|
||||
"height": 188,
|
||||
"width": 336
|
||||
}
|
||||
],
|
||||
"timestamp": null,
|
||||
"release_timestamp": null,
|
||||
"availability": null,
|
||||
"view_count": 17000000,
|
||||
"live_status": null,
|
||||
"channel_is_verified": null
|
||||
}
|
||||
],
|
||||
"extractor_key": "YoutubeTab",
|
||||
"extractor": "youtube:tab",
|
||||
"webpage_url": "https://www.youtube.com/playlist?list=PLZ4DbyIWUwCq4V8bIEa8jm2ozHZVuREJP",
|
||||
"original_url": "https://www.youtube.com/playlist?list=PLZ4DbyIWUwCq4V8bIEa8jm2ozHZVuREJP",
|
||||
"webpage_url_basename": "playlist",
|
||||
"webpage_url_domain": "youtube.com",
|
||||
"heatmap": [],
|
||||
"automatic_captions": {}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
120
tests/components/media_extractor/snapshots/test_init.ambr
Normal file
120
tests/components/media_extractor/snapshots/test_init.ambr
Normal file
@ -0,0 +1,120 @@
|
||||
# serializer version: 1
|
||||
# name: test_no_target_entity
|
||||
ReadOnlyDict({
|
||||
'device_id': list([
|
||||
'fb034c3a9fefe47c584c32a6b51817eb',
|
||||
]),
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1694805294/ei/zlgEZcCPFpqOx_APj42f2Ao/ip/45.93.75.130/id/750c38c3d5a05dc4/itag/616/source/youtube/requiressl/yes/ratebypass/yes/pfa/1/wft/1/sgovp/clen%3D99471214%3Bdur%3D212.040%3Bgir%3Dyes%3Bitag%3D356%3Blmt%3D1694043438471036/hls_chunk_host/rr3---sn-5hne6nzy.googlevideo.com/mh/7c/mm/31,26/mn/sn-5hne6nzy,sn-aigzrnld/ms/au,onr/mv/m/mvi/3/pl/22/initcwndbps/2095000/vprv/1/playlist_type/DVR/dover/13/txp/4532434/mt/1694783390/fvip/1/short_key/1/keepalive/yes/fexp/24007246,24362685/beids/24350017/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,pfa,wft,sgovp,vprv,playlist_type/sig/AOq0QJ8wRgIhANCPwWNfq6wBp1Xo1L8bRJpDrzOyv7kfH_J65cZ_PRZLAiEAwo-0wQgeIjPe7OgyAAvMCx_A9wd1h8Qyh7VntKwGJUs%3D/lsparams/hls_chunk_host,mh,mm,mn,ms,mv,mvi,pl,initcwndbps/lsig/AG3C_xAwRQIgIqS9Ub_6L9ScKXr0T9bkeu6TZsEsyNApYfF_MqeukqECIQCMSeJ1sSEw5QGMgHAW8Fhsir4TYHEK5KVg-PzJbrT6hw%3D%3D/playlist/index.m3u8',
|
||||
'media_content_type': 'VIDEO',
|
||||
})
|
||||
# ---
|
||||
# name: test_play_media_service
|
||||
ReadOnlyDict({
|
||||
'entity_id': 'media_player.bedroom',
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1694794256/ei/sC0EZYCPHbuZx_AP3bGz0Ac/ip/84.31.234.146/id/750c38c3d5a05dc4/itag/616/source/youtube/requiressl/yes/ratebypass/yes/pfa/1/wft/1/sgovp/clen%3D99471214%3Bdur%3D212.040%3Bgir%3Dyes%3Bitag%3D356%3Blmt%3D1694043438471036/hls_chunk_host/rr2---sn-5hnekn7k.googlevideo.com/mh/7c/mm/31,29/mn/sn-5hnekn7k,sn-5hne6nzy/ms/au,rdu/mv/m/mvi/2/pl/14/initcwndbps/2267500/vprv/1/playlist_type/DVR/dover/13/txp/4532434/mt/1694772337/fvip/3/short_key/1/keepalive/yes/fexp/24007246,24362685/beids/24350018/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,pfa,wft,sgovp,vprv,playlist_type/sig/AOq0QJ8wRgIhAIC0iobMnRschmQ3QaYsytXg9eg7l9B_-UNvMciis4bmAiEAg-3jr6SwOfAGCCU-JyTyxcXmraug-hPcjjJzm__43ug%3D/lsparams/hls_chunk_host,mh,mm,mn,ms,mv,mvi,pl,initcwndbps/lsig/AG3C_xAwRQIhAOlqbgmuueNhIuGENYKCsdwiNAUPheXw-RMUqsiaB7YuAiANN43FxJl14Ve_H_c9K-aDoXG4sI7PDCqKDhov6Qro_g%3D%3D/playlist/index.m3u8',
|
||||
'media_content_type': 'VIDEO',
|
||||
})
|
||||
# ---
|
||||
# name: test_play_media_service[https://soundcloud.com/bruttoband/brutto-11-AUDIO-audio_media_extractor_config]
|
||||
ReadOnlyDict({
|
||||
'entity_id': 'media_player.bedroom',
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk5MTc5fX19XX0_&Signature=JtF8BXxTCElhjCrhnSAq3W6z960VmdVXx7BPhQvI0MCxr~J43JFGO8CVw9-VBM2oEf14mqWo63-C0FO29DvUuBZnmLD3dhDfryVfWJsrix7voimoRDaNFE~3zntDbg7O2S8uWYyZK8OZC9anzwokvjH7jbmviWqK4~2IM9dwgejGgzrQU1aadV2Yro7NJZnF7SD~7tVjkM-hBg~X5zDYVxmGrdzN3tFoLwRmUch6RNDL~1DcWBk0AveBKQFAdBrFBjDDUeIyDz9Idhw2aG9~fjfckcf95KwqrVQxz1N5XEzfNDDo8xkUgDt0eb9dtXdwxLJ0swC6e5VLS8bsH91GMg__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ',
|
||||
'media_content_type': 'AUDIO',
|
||||
})
|
||||
# ---
|
||||
# name: test_play_media_service[https://soundcloud.com/bruttoband/brutto-11-AUDIO-empty_media_extractor_config]
|
||||
ReadOnlyDict({
|
||||
'entity_id': 'media_player.bedroom',
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk4NTkzfX19XX0_&Signature=flALJvEBnzS0ZOOhf0-07Ap~NURw2Gn2OqkeKKTTMX5HRGJw9eXFay79tcC4GsMMXWUgWoCx-n3yelpyilE2MOEIufBNUbjqRfMSJaX5YhYxjQdoDYuiU~gqBzJyPw9pKzr6P8~5HNKL3Idr0CNhUzdV6FQLaUPKMMibq9ghV833mUmdyvdk1~GZBc8MOg9GrTdcigGgpPzd-vrIMICMvFzFnwBOeOotxX2Vfqf9~wVekBKGlvB9A~7TlZ71lv9Fl9u4m8rse9E-mByweVc1M784ehJV3~tRPjuF~FXXWKP8x0nGJmoq7RAnG7iFIt~fQFmsfOq2o~PG7dHMRPh7hw__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ',
|
||||
'media_content_type': 'AUDIO',
|
||||
})
|
||||
# ---
|
||||
# name: test_play_media_service[https://soundcloud.com/bruttoband/brutto-11-VIDEO-audio_media_extractor_config]
|
||||
ReadOnlyDict({
|
||||
'entity_id': 'media_player.bedroom',
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk5MTc5fX19XX0_&Signature=JtF8BXxTCElhjCrhnSAq3W6z960VmdVXx7BPhQvI0MCxr~J43JFGO8CVw9-VBM2oEf14mqWo63-C0FO29DvUuBZnmLD3dhDfryVfWJsrix7voimoRDaNFE~3zntDbg7O2S8uWYyZK8OZC9anzwokvjH7jbmviWqK4~2IM9dwgejGgzrQU1aadV2Yro7NJZnF7SD~7tVjkM-hBg~X5zDYVxmGrdzN3tFoLwRmUch6RNDL~1DcWBk0AveBKQFAdBrFBjDDUeIyDz9Idhw2aG9~fjfckcf95KwqrVQxz1N5XEzfNDDo8xkUgDt0eb9dtXdwxLJ0swC6e5VLS8bsH91GMg__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ',
|
||||
'media_content_type': 'VIDEO',
|
||||
})
|
||||
# ---
|
||||
# name: test_play_media_service[https://soundcloud.com/bruttoband/brutto-11-VIDEO-empty_media_extractor_config]
|
||||
ReadOnlyDict({
|
||||
'entity_id': 'media_player.bedroom',
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk4NTkzfX19XX0_&Signature=flALJvEBnzS0ZOOhf0-07Ap~NURw2Gn2OqkeKKTTMX5HRGJw9eXFay79tcC4GsMMXWUgWoCx-n3yelpyilE2MOEIufBNUbjqRfMSJaX5YhYxjQdoDYuiU~gqBzJyPw9pKzr6P8~5HNKL3Idr0CNhUzdV6FQLaUPKMMibq9ghV833mUmdyvdk1~GZBc8MOg9GrTdcigGgpPzd-vrIMICMvFzFnwBOeOotxX2Vfqf9~wVekBKGlvB9A~7TlZ71lv9Fl9u4m8rse9E-mByweVc1M784ehJV3~tRPjuF~FXXWKP8x0nGJmoq7RAnG7iFIt~fQFmsfOq2o~PG7dHMRPh7hw__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ',
|
||||
'media_content_type': 'VIDEO',
|
||||
})
|
||||
# ---
|
||||
# name: test_play_media_service[https://test.com/abc-AUDIO-audio_media_extractor_config]
|
||||
ReadOnlyDict({
|
||||
'entity_id': 'media_player.bedroom',
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk5MTc5fX19XX0_&Signature=JtF8BXxTCElhjCrhnSAq3W6z960VmdVXx7BPhQvI0MCxr~J43JFGO8CVw9-VBM2oEf14mqWo63-C0FO29DvUuBZnmLD3dhDfryVfWJsrix7voimoRDaNFE~3zntDbg7O2S8uWYyZK8OZC9anzwokvjH7jbmviWqK4~2IM9dwgejGgzrQU1aadV2Yro7NJZnF7SD~7tVjkM-hBg~X5zDYVxmGrdzN3tFoLwRmUch6RNDL~1DcWBk0AveBKQFAdBrFBjDDUeIyDz9Idhw2aG9~fjfckcf95KwqrVQxz1N5XEzfNDDo8xkUgDt0eb9dtXdwxLJ0swC6e5VLS8bsH91GMg__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ',
|
||||
'media_content_type': 'AUDIO',
|
||||
})
|
||||
# ---
|
||||
# name: test_play_media_service[https://test.com/abc-AUDIO-empty_media_extractor_config]
|
||||
ReadOnlyDict({
|
||||
'entity_id': 'media_player.bedroom',
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://cf-media.sndcdn.com/50remGX1OqRY.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vNTByZW1HWDFPcVJZLjEyOC5tcDMqIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjk0Nzk4NTkzfX19XX0_&Signature=flALJvEBnzS0ZOOhf0-07Ap~NURw2Gn2OqkeKKTTMX5HRGJw9eXFay79tcC4GsMMXWUgWoCx-n3yelpyilE2MOEIufBNUbjqRfMSJaX5YhYxjQdoDYuiU~gqBzJyPw9pKzr6P8~5HNKL3Idr0CNhUzdV6FQLaUPKMMibq9ghV833mUmdyvdk1~GZBc8MOg9GrTdcigGgpPzd-vrIMICMvFzFnwBOeOotxX2Vfqf9~wVekBKGlvB9A~7TlZ71lv9Fl9u4m8rse9E-mByweVc1M784ehJV3~tRPjuF~FXXWKP8x0nGJmoq7RAnG7iFIt~fQFmsfOq2o~PG7dHMRPh7hw__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ',
|
||||
'media_content_type': 'AUDIO',
|
||||
})
|
||||
# ---
|
||||
# name: test_play_media_service[https://www.youtube.com/watch?v=dQw4w9WgXcQ-VIDEO-audio_media_extractor_config-]
|
||||
ReadOnlyDict({
|
||||
'entity_id': 'media_player.bedroom',
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1694805268/ei/tFgEZcu0DoOD-gaqg47wBA/ip/45.93.75.130/id/750c38c3d5a05dc4/itag/616/source/youtube/requiressl/yes/ratebypass/yes/pfa/1/wft/1/sgovp/clen%3D99471214%3Bdur%3D212.040%3Bgir%3Dyes%3Bitag%3D356%3Blmt%3D1694043438471036/hls_chunk_host/rr3---sn-5hne6nzy.googlevideo.com/mh/7c/mm/31,29/mn/sn-5hne6nzy,sn-5hnekn7k/ms/au,rdu/mv/m/mvi/3/pl/22/initcwndbps/1957500/vprv/1/playlist_type/DVR/dover/13/txp/4532434/mt/1694783146/fvip/2/short_key/1/keepalive/yes/fexp/24007246/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,pfa,wft,sgovp,vprv,playlist_type/sig/AOq0QJ8wRQIhALAASH0_ZDQQoMA82qWNCXSHPZ0bb9TQldIs7AAxktiiAiASA5bQy7IAa6NwdGIOpfye5OgcY_BNuo0WgSdh84tosw%3D%3D/lsparams/hls_chunk_host,mh,mm,mn,ms,mv,mvi,pl,initcwndbps/lsig/AG3C_xAwRgIhAIsDcLGH8KJpQpBgyJ5VWlDxfr75HyO8hMSVS9v7nRu4AiEA2xjtLZOzeNFoJlxwCsH3YqsUQt-BF_4gikhi_P4FbBc%3D/playlist/index.m3u8',
|
||||
'media_content_type': 'VIDEO',
|
||||
})
|
||||
# ---
|
||||
# name: test_play_media_service[https://www.youtube.com/watch?v=dQw4w9WgXcQ-VIDEO-audio_media_extractor_config]
|
||||
ReadOnlyDict({
|
||||
'entity_id': 'media_player.bedroom',
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1694805268/ei/tFgEZcu0DoOD-gaqg47wBA/ip/45.93.75.130/id/750c38c3d5a05dc4/itag/616/source/youtube/requiressl/yes/ratebypass/yes/pfa/1/wft/1/sgovp/clen%3D99471214%3Bdur%3D212.040%3Bgir%3Dyes%3Bitag%3D356%3Blmt%3D1694043438471036/hls_chunk_host/rr3---sn-5hne6nzy.googlevideo.com/mh/7c/mm/31,29/mn/sn-5hne6nzy,sn-5hnekn7k/ms/au,rdu/mv/m/mvi/3/pl/22/initcwndbps/1957500/vprv/1/playlist_type/DVR/dover/13/txp/4532434/mt/1694783146/fvip/2/short_key/1/keepalive/yes/fexp/24007246/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,pfa,wft,sgovp,vprv,playlist_type/sig/AOq0QJ8wRQIhALAASH0_ZDQQoMA82qWNCXSHPZ0bb9TQldIs7AAxktiiAiASA5bQy7IAa6NwdGIOpfye5OgcY_BNuo0WgSdh84tosw%3D%3D/lsparams/hls_chunk_host,mh,mm,mn,ms,mv,mvi,pl,initcwndbps/lsig/AG3C_xAwRgIhAIsDcLGH8KJpQpBgyJ5VWlDxfr75HyO8hMSVS9v7nRu4AiEA2xjtLZOzeNFoJlxwCsH3YqsUQt-BF_4gikhi_P4FbBc%3D/playlist/index.m3u8',
|
||||
'media_content_type': 'VIDEO',
|
||||
})
|
||||
# ---
|
||||
# name: test_play_media_service[https://www.youtube.com/watch?v=dQw4w9WgXcQ-VIDEO-empty_media_extractor_config-]
|
||||
ReadOnlyDict({
|
||||
'entity_id': 'media_player.bedroom',
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1694805294/ei/zlgEZcCPFpqOx_APj42f2Ao/ip/45.93.75.130/id/750c38c3d5a05dc4/itag/616/source/youtube/requiressl/yes/ratebypass/yes/pfa/1/wft/1/sgovp/clen%3D99471214%3Bdur%3D212.040%3Bgir%3Dyes%3Bitag%3D356%3Blmt%3D1694043438471036/hls_chunk_host/rr3---sn-5hne6nzy.googlevideo.com/mh/7c/mm/31,26/mn/sn-5hne6nzy,sn-aigzrnld/ms/au,onr/mv/m/mvi/3/pl/22/initcwndbps/2095000/vprv/1/playlist_type/DVR/dover/13/txp/4532434/mt/1694783390/fvip/1/short_key/1/keepalive/yes/fexp/24007246,24362685/beids/24350017/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,pfa,wft,sgovp,vprv,playlist_type/sig/AOq0QJ8wRgIhANCPwWNfq6wBp1Xo1L8bRJpDrzOyv7kfH_J65cZ_PRZLAiEAwo-0wQgeIjPe7OgyAAvMCx_A9wd1h8Qyh7VntKwGJUs%3D/lsparams/hls_chunk_host,mh,mm,mn,ms,mv,mvi,pl,initcwndbps/lsig/AG3C_xAwRQIgIqS9Ub_6L9ScKXr0T9bkeu6TZsEsyNApYfF_MqeukqECIQCMSeJ1sSEw5QGMgHAW8Fhsir4TYHEK5KVg-PzJbrT6hw%3D%3D/playlist/index.m3u8',
|
||||
'media_content_type': 'VIDEO',
|
||||
})
|
||||
# ---
|
||||
# name: test_play_media_service[https://www.youtube.com/watch?v=dQw4w9WgXcQ-VIDEO-empty_media_extractor_config]
|
||||
ReadOnlyDict({
|
||||
'entity_id': 'media_player.bedroom',
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1694805294/ei/zlgEZcCPFpqOx_APj42f2Ao/ip/45.93.75.130/id/750c38c3d5a05dc4/itag/616/source/youtube/requiressl/yes/ratebypass/yes/pfa/1/wft/1/sgovp/clen%3D99471214%3Bdur%3D212.040%3Bgir%3Dyes%3Bitag%3D356%3Blmt%3D1694043438471036/hls_chunk_host/rr3---sn-5hne6nzy.googlevideo.com/mh/7c/mm/31,26/mn/sn-5hne6nzy,sn-aigzrnld/ms/au,onr/mv/m/mvi/3/pl/22/initcwndbps/2095000/vprv/1/playlist_type/DVR/dover/13/txp/4532434/mt/1694783390/fvip/1/short_key/1/keepalive/yes/fexp/24007246,24362685/beids/24350017/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,pfa,wft,sgovp,vprv,playlist_type/sig/AOq0QJ8wRgIhANCPwWNfq6wBp1Xo1L8bRJpDrzOyv7kfH_J65cZ_PRZLAiEAwo-0wQgeIjPe7OgyAAvMCx_A9wd1h8Qyh7VntKwGJUs%3D/lsparams/hls_chunk_host,mh,mm,mn,ms,mv,mvi,pl,initcwndbps/lsig/AG3C_xAwRQIgIqS9Ub_6L9ScKXr0T9bkeu6TZsEsyNApYfF_MqeukqECIQCMSeJ1sSEw5QGMgHAW8Fhsir4TYHEK5KVg-PzJbrT6hw%3D%3D/playlist/index.m3u8',
|
||||
'media_content_type': 'VIDEO',
|
||||
})
|
||||
# ---
|
||||
# name: test_playlist
|
||||
ReadOnlyDict({
|
||||
'entity_id': 'media_player.bedroom',
|
||||
'extra': dict({
|
||||
}),
|
||||
'media_content_id': 'https://rr2---sn-5hne6nzk.googlevideo.com/videoplayback?expire=1694818322&ei=sosEZcmcMdGVgQeatIDABA&ip=45.93.75.130&id=o-ANZGIl8-Lo8u8x_fU-l5VosaHna8zx8_6Ab0CCT-vzjQ&itag=243&source=youtube&requiressl=yes&mh=6Q&mm=31%2C29&mn=sn-5hne6nzk%2Csn-5hnednss&ms=au%2Crdu&mv=m&mvi=2&pl=22&initcwndbps=1868750&vprv=1&svpuc=1&mime=video%2Fwebm&gir=yes&clen=104373&dur=9.009&lmt=1660945832037331&mt=1694796392&fvip=5&keepalive=yes&fexp=24007246&c=IOS&txp=4437434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAMLnlCaLvJ2scyVr6qYrCp3rzn_Op9eerIVWyp62NXKIAiEAnswRfxH5KssHQAKETF2MPncVWX_eDgpTXBEHN589-Xo%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAN9Und25H4_kUjcAoZ_LVv0lAVTnPDkI-t5f7JJBA_jhAiAsXrF-84K_iBGiTwIwXS_eOlp5JPXxLEhyDj_cB8zdxQ%3D%3D',
|
||||
'media_content_type': 'VIDEO',
|
||||
})
|
||||
# ---
|
211
tests/components/media_extractor/test_init.py
Normal file
211
tests/components/media_extractor/test_init.py
Normal file
@ -0,0 +1,211 @@
|
||||
"""The tests for Media Extractor integration."""
|
||||
from typing import Any
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
from yt_dlp import DownloadError
|
||||
|
||||
from homeassistant.components.media_extractor import DOMAIN
|
||||
from homeassistant.components.media_player import SERVICE_PLAY_MEDIA
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import load_json_object_fixture
|
||||
from tests.components.media_extractor import (
|
||||
YOUTUBE_EMPTY_PLAYLIST,
|
||||
YOUTUBE_PLAYLIST,
|
||||
YOUTUBE_VIDEO,
|
||||
MockYoutubeDL,
|
||||
)
|
||||
from tests.components.media_extractor.const import NO_FORMATS_RESPONSE, SOUNDCLOUD_TRACK
|
||||
|
||||
|
||||
async def test_play_media_service_is_registered(hass: HomeAssistant) -> None:
|
||||
"""Test play media service is registered."""
|
||||
await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.services.has_service(DOMAIN, SERVICE_PLAY_MEDIA)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"config_fixture", ["empty_media_extractor_config", "audio_media_extractor_config"]
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
("media_content_id", "media_content_type"),
|
||||
[
|
||||
(YOUTUBE_VIDEO, "VIDEO"),
|
||||
(SOUNDCLOUD_TRACK, "AUDIO"),
|
||||
(NO_FORMATS_RESPONSE, "AUDIO"),
|
||||
],
|
||||
)
|
||||
async def test_play_media_service(
|
||||
hass: HomeAssistant,
|
||||
mock_youtube_dl: MockYoutubeDL,
|
||||
calls: list[ServiceCall],
|
||||
snapshot: SnapshotAssertion,
|
||||
request: pytest.FixtureRequest,
|
||||
config_fixture: str,
|
||||
media_content_id: str,
|
||||
media_content_type: str,
|
||||
) -> None:
|
||||
"""Test play media service is registered."""
|
||||
config: dict[str, Any] = request.getfixturevalue(config_fixture)
|
||||
await async_setup_component(hass, DOMAIN, config)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_PLAY_MEDIA,
|
||||
{
|
||||
"entity_id": "media_player.bedroom",
|
||||
"media_content_type": media_content_type,
|
||||
"media_content_id": media_content_id,
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert calls[0].data == snapshot
|
||||
|
||||
|
||||
async def test_download_error(
|
||||
hass: HomeAssistant,
|
||||
empty_media_extractor_config: dict[str, Any],
|
||||
calls: list[ServiceCall],
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test handling DownloadError."""
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.media_extractor.YoutubeDL.extract_info",
|
||||
side_effect=DownloadError("Message"),
|
||||
):
|
||||
await async_setup_component(hass, DOMAIN, empty_media_extractor_config)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_PLAY_MEDIA,
|
||||
{
|
||||
"entity_id": "media_player.bedroom",
|
||||
"media_content_type": "VIDEO",
|
||||
"media_content_id": YOUTUBE_VIDEO,
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(calls) == 0
|
||||
assert f"Could not retrieve data for the URL: {YOUTUBE_VIDEO}" in caplog.text
|
||||
|
||||
|
||||
async def test_no_target_entity(
|
||||
hass: HomeAssistant,
|
||||
mock_youtube_dl: MockYoutubeDL,
|
||||
empty_media_extractor_config: dict[str, Any],
|
||||
calls: list[ServiceCall],
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test having no target entity."""
|
||||
|
||||
await async_setup_component(hass, DOMAIN, empty_media_extractor_config)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_PLAY_MEDIA,
|
||||
{
|
||||
"device_id": "fb034c3a9fefe47c584c32a6b51817eb",
|
||||
"media_content_type": "VIDEO",
|
||||
"media_content_id": YOUTUBE_VIDEO,
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert calls[0].data == snapshot
|
||||
|
||||
|
||||
async def test_playlist(
|
||||
hass: HomeAssistant,
|
||||
mock_youtube_dl: MockYoutubeDL,
|
||||
empty_media_extractor_config: dict[str, Any],
|
||||
calls: list[ServiceCall],
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test extracting a playlist."""
|
||||
|
||||
await async_setup_component(hass, DOMAIN, empty_media_extractor_config)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_PLAY_MEDIA,
|
||||
{
|
||||
"entity_id": "media_player.bedroom",
|
||||
"media_content_type": "VIDEO",
|
||||
"media_content_id": YOUTUBE_PLAYLIST,
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert calls[0].data == snapshot
|
||||
|
||||
|
||||
async def test_playlist_no_entries(
|
||||
hass: HomeAssistant,
|
||||
mock_youtube_dl: MockYoutubeDL,
|
||||
empty_media_extractor_config: dict[str, Any],
|
||||
calls: list[ServiceCall],
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test extracting a playlist without entries."""
|
||||
|
||||
await async_setup_component(hass, DOMAIN, empty_media_extractor_config)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_PLAY_MEDIA,
|
||||
{
|
||||
"entity_id": "media_player.bedroom",
|
||||
"media_content_type": "VIDEO",
|
||||
"media_content_id": YOUTUBE_EMPTY_PLAYLIST,
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(calls) == 0
|
||||
assert (
|
||||
f"Could not retrieve data for the URL: {YOUTUBE_EMPTY_PLAYLIST}" in caplog.text
|
||||
)
|
||||
|
||||
|
||||
async def test_query_error(
|
||||
hass: HomeAssistant,
|
||||
empty_media_extractor_config: dict[str, Any],
|
||||
calls: list[ServiceCall],
|
||||
) -> None:
|
||||
"""Test handling error with query."""
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.media_extractor.YoutubeDL.extract_info",
|
||||
return_value=load_json_object_fixture("media_extractor/youtube_1_info.json"),
|
||||
), patch(
|
||||
"homeassistant.components.media_extractor.YoutubeDL.process_ie_result",
|
||||
side_effect=DownloadError("Message"),
|
||||
):
|
||||
await async_setup_component(hass, DOMAIN, empty_media_extractor_config)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_PLAY_MEDIA,
|
||||
{
|
||||
"entity_id": "media_player.bedroom",
|
||||
"media_content_type": "VIDEO",
|
||||
"media_content_id": YOUTUBE_VIDEO,
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(calls) == 0
|
Loading…
x
Reference in New Issue
Block a user