浏览代码

Merge pull request #702 from a01200356/digbt

[fix] results with digbit don't truncate anymore
Adam Tauber 8 年前
父节点
当前提交
aaf5d506e5
共有 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
     results = list()
40
     results = list()
41
     for result in search_res:
41
     for result in search_res:
42
         url = urljoin(URL, result.xpath('.//a[@title]/@href')[0])
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
         content = extract_text(result.xpath('.//div[@class="files"]'))
44
         content = extract_text(result.xpath('.//div[@class="files"]'))
45
         files_data = extract_text(result.xpath('.//div[@class="tail"]')).split()
45
         files_data = extract_text(result.xpath('.//div[@class="tail"]')).split()
46
         filesize = get_torrent_size(files_data[FILESIZE], files_data[FILESIZE_MULTIPLIER])
46
         filesize = get_torrent_size(files_data[FILESIZE], files_data[FILESIZE_MULTIPLIER])

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

28
         <table class="table">
28
         <table class="table">
29
             <tr><td class="x-item">
29
             <tr><td class="x-item">
30
             <div>
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
                 <span class="ctime"><span style="color:red;">4 hours ago</span></span>
34
                 <span class="ctime"><span style="color:red;">4 hours ago</span></span>
33
             </div>
35
             </div>
34
             <div class="files">
36
             <div class="files">