Parcourir la source

[fix] google markup change - closes #489

Adam Tauber il y a 9 ans
Parent
révision
66f48c2bf5
2 fichiers modifiés avec 12 ajouts et 12 suppressions
  1. 2
    2
      searx/engines/google.py
  2. 10
    10
      searx/tests/engines/test_google.py

+ 2
- 2
searx/engines/google.py Voir le fichier

90
 search_path = '/search'
90
 search_path = '/search'
91
 search_url = ('https://{hostname}' +
91
 search_url = ('https://{hostname}' +
92
               search_path +
92
               search_path +
93
-              '?{query}&start={offset}&gbv=1&gws_rd=cr')
93
+              '?{query}&start={offset}&gbv=1&gws_rd=ssl')
94
 
94
 
95
 # other URLs
95
 # other URLs
96
 map_hostname_start = 'maps.google.'
96
 map_hostname_start = 'maps.google.'
99
 images_path = '/images'
99
 images_path = '/images'
100
 
100
 
101
 # specific xpath variables
101
 # specific xpath variables
102
-results_xpath = '//li[@class="g"]'
102
+results_xpath = '//div[@class="g"]'
103
 url_xpath = './/h3/a/@href'
103
 url_xpath = './/h3/a/@href'
104
 title_xpath = './/h3'
104
 title_xpath = './/h3'
105
 content_xpath = './/span[@class="st"]'
105
 content_xpath = './/span[@class="st"]'

+ 10
- 10
searx/tests/engines/test_google.py Voir le fichier

40
         self.assertEqual(google.response(response), [])
40
         self.assertEqual(google.response(response), [])
41
 
41
 
42
         html = """
42
         html = """
43
-        <li class="g">
43
+        <div class="g">
44
             <h3 class="r">
44
             <h3 class="r">
45
                 <a href="http://this.should.be.the.link/">
45
                 <a href="http://this.should.be.the.link/">
46
                     <b>This</b> is <b>the</b> title
46
                     <b>This</b> is <b>the</b> title
94
                     </a>
94
                     </a>
95
                 </div>
95
                 </div>
96
             </div>
96
             </div>
97
-        </li>
98
-        <li class="g">
97
+        </div>
98
+        <div class="g">
99
             <h3 class="r">
99
             <h3 class="r">
100
                 <a href="http://www.google.com/images?q=toto">
100
                 <a href="http://www.google.com/images?q=toto">
101
                     <b>This</b>
101
                     <b>This</b>
102
                 </a>
102
                 </a>
103
             </h3>
103
             </h3>
104
-        </li>
105
-        <li class="g">
104
+        </div>
105
+        <div class="g">
106
             <h3 class="r">
106
             <h3 class="r">
107
                 <a href="http://www.google.com/search?q=toto">
107
                 <a href="http://www.google.com/search?q=toto">
108
                     <b>This</b> is
108
                     <b>This</b> is
109
                 </a>
109
                 </a>
110
             </h3>
110
             </h3>
111
-        </li>
112
-        <li class="g">
111
+        </div>
112
+        <div class="g">
113
             <h3 class="r">
113
             <h3 class="r">
114
                 <a href="€">
114
                 <a href="€">
115
                     <b>This</b> is <b>the</b>
115
                     <b>This</b> is <b>the</b>
116
                 </a>
116
                 </a>
117
             </h3>
117
             </h3>
118
-        </li>
119
-        <li class="g">
118
+        </div>
119
+        <div class="g">
120
             <h3 class="r">
120
             <h3 class="r">
121
                 <a href="/url?q=url">
121
                 <a href="/url?q=url">
122
                     <b>This</b> is <b>the</b>
122
                     <b>This</b> is <b>the</b>
123
                 </a>
123
                 </a>
124
             </h3>
124
             </h3>
125
-        </li>
125
+        </div>
126
         <p class="_Bmc" style="margin:3px 8px">
126
         <p class="_Bmc" style="margin:3px 8px">
127
             <a href="/search?num=20&amp;safe=off&amp;q=t&amp;revid=1754833769&amp;sa=X&amp;ei=-&amp;ved=">
127
             <a href="/search?num=20&amp;safe=off&amp;q=t&amp;revid=1754833769&amp;sa=X&amp;ei=-&amp;ved=">
128
                 suggestion <b>title</b>
128
                 suggestion <b>title</b>