Browse Source

[fix] google news dom xpath fix

misnyo 7 years ago
parent
commit
3182ba7069
2 changed files with 2 additions and 3 deletions
  1. 2 2
      searx/engines/google_news.py
  2. 0 1
      tests/unit/engines/test_google_news.py

+ 2 - 2
searx/engines/google_news.py

@@ -67,8 +67,8 @@ def response(resp):
     for result in dom.xpath('//div[@class="g"]|//div[@class="g _cy"]'):
     for result in dom.xpath('//div[@class="g"]|//div[@class="g _cy"]'):
         try:
         try:
             r = {
             r = {
-                'url': result.xpath('.//div[@class="_cnc"]//a/@href')[0],
-                'title': ''.join(result.xpath('.//div[@class="_cnc"]//h3//text()')),
+                'url': result.xpath('.//a[@class="l _PMs"]')[0].attrib.get("href"),
+                'title': ''.join(result.xpath('.//a[@class="l _PMs"]//text()')),
                 'content': ''.join(result.xpath('.//div[@class="st"]//text()')),
                 'content': ''.join(result.xpath('.//div[@class="st"]//text()')),
             }
             }
         except:
         except:

File diff suppressed because it is too large
+ 0 - 1
tests/unit/engines/test_google_news.py


Some files were not shown because too many files changed in this diff