浏览代码

[fix] results with digbit don't truncate anymore

marc 8 年前
父节点
当前提交
d1d4ed4376
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 1
    1
      searx/engines/digbt.py
  2. 3
    1
      tests/unit/engines/test_digbt.py

+ 1
- 1
searx/engines/digbt.py 查看文件

@@ -40,7 +40,7 @@ def response(resp):
40 40
     results = list()
41 41
     for result in search_res:
42 42
         url = urljoin(URL, result.xpath('.//a[@title]/@href')[0])
43
-        title = result.xpath('.//a[@title]/text()')[0]
43
+        title = extract_text(result.xpath('.//a[@title]'))
44 44
         content = extract_text(result.xpath('.//div[@class="files"]'))
45 45
         files_data = extract_text(result.xpath('.//div[@class="tail"]')).split()
46 46
         filesize = get_torrent_size(files_data[FILESIZE], files_data[FILESIZE_MULTIPLIER])

+ 3
- 1
tests/unit/engines/test_digbt.py 查看文件

@@ -28,7 +28,9 @@ class TestDigBTEngine(SearxTestCase):
28 28
         <table class="table">
29 29
             <tr><td class="x-item">
30 30
             <div>
31
-                <a title="The Big Bang Theory" class="title" href="/The-Big-Bang-Theory-d2.html">The Big Bang Theory</a>
31
+                <a title="The Big Bang Theory" class="title" href="/The-Big-Bang-Theory-d2.html">
32
+                    The Big <span class="highlight">Bang</span> Theory
33
+                </a>
32 34
                 <span class="ctime"><span style="color:red;">4 hours ago</span></span>
33 35
             </div>
34 36
             <div class="files">