aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_InfoExtractor.py
diff options
context:
space:
mode:
authornixxo <nixxo@protonmail.com>2022-01-01 20:50:27 +0100
committerGitHub <noreply@github.com>2022-01-02 01:20:27 +0530
commit7592749cbe377675688dfcad5b7c1d46bbb684e1 (patch)
treee35110d845c027a884216c4dabfa93c4dfc3ce7f /test/test_InfoExtractor.py
parent767f999b53705cdeda1b5bcca360aa1fc9c88135 (diff)
downloadhypervideo-pre-7592749cbe377675688dfcad5b7c1d46bbb684e1.tar.lz
hypervideo-pre-7592749cbe377675688dfcad5b7c1d46bbb684e1.tar.xz
hypervideo-pre-7592749cbe377675688dfcad5b7c1d46bbb684e1.zip
[extractor] Extract thumbnails from JSON-LD (#2195)
Authored by: nixxo
Diffstat (limited to 'test/test_InfoExtractor.py')
-rw-r--r--test/test_InfoExtractor.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_InfoExtractor.py b/test/test_InfoExtractor.py
index cf06dbde4..25bc00e0b 100644
--- a/test/test_InfoExtractor.py
+++ b/test/test_InfoExtractor.py
@@ -208,6 +208,32 @@ class TestInfoExtractor(unittest.TestCase):
},
{'expected_type': 'NewsArticle'},
),
+ (
+ # test multiple thumbnails in a list
+ r'''
+<script type="application/ld+json">
+{"@context":"https://schema.org",
+"@type":"VideoObject",
+"thumbnailUrl":["https://www.rainews.it/cropgd/640x360/dl/img/2021/12/30/1640886376927_GettyImages.jpg"]}
+</script>''',
+ {
+ 'thumbnails': [{'url': 'https://www.rainews.it/cropgd/640x360/dl/img/2021/12/30/1640886376927_GettyImages.jpg'}],
+ },
+ {},
+ ),
+ (
+ # test single thumbnail
+ r'''
+<script type="application/ld+json">
+{"@context":"https://schema.org",
+"@type":"VideoObject",
+"thumbnailUrl":"https://www.rainews.it/cropgd/640x360/dl/img/2021/12/30/1640886376927_GettyImages.jpg"}
+</script>''',
+ {
+ 'thumbnails': [{'url': 'https://www.rainews.it/cropgd/640x360/dl/img/2021/12/30/1640886376927_GettyImages.jpg'}],
+ },
+ {},
+ )
]
for html, expected_dict, search_json_ld_kwargs in _TESTS:
expect_dict(