From f2d49a697124b8f4c6a4df68626b3d29ec959e70 Mon Sep 17 00:00:00 2001 From: Marc Abonce Seguin Date: Tue, 26 Mar 2019 20:33:36 -0600 Subject: [PATCH] [fix] get youtube results from js object Results are not appearing in the html document anymore, instead they are found inside an object embedded in a script. --- searx/engines/youtube_noapi.py | 64 +++++---- tests/unit/engines/test_youtube_noapi.py | 162 ++++++++--------------- 2 files changed, 87 insertions(+), 139 deletions(-) diff --git a/searx/engines/youtube_noapi.py b/searx/engines/youtube_noapi.py index 9f01841f..3bf25932 100644 --- a/searx/engines/youtube_noapi.py +++ b/searx/engines/youtube_noapi.py @@ -8,7 +8,8 @@ # @stable no # @parse url, title, content, publishedDate, thumbnail, embedded -from lxml import html +from functools import reduce +from json import loads from searx.engines.xpath import extract_text from searx.utils import list_get from searx.url_utils import quote_plus @@ -34,20 +35,6 @@ embedded_url = '