[fix] gigablast url params
This commit is contained in:
		
							parent
							
								
									5da78f7b37
								
							
						
					
					
						commit
						f1ac794a07
					
				@ -13,6 +13,8 @@
 | 
				
			|||||||
from urllib import urlencode
 | 
					from urllib import urlencode
 | 
				
			||||||
from cgi import escape
 | 
					from cgi import escape
 | 
				
			||||||
from lxml import etree
 | 
					from lxml import etree
 | 
				
			||||||
 | 
					from random import randint
 | 
				
			||||||
 | 
					from time import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# engine dependent config
 | 
					# engine dependent config
 | 
				
			||||||
categories = ['general']
 | 
					categories = ['general']
 | 
				
			||||||
@ -21,7 +23,7 @@ number_of_results = 5
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# search-url, invalid HTTPS certificate
 | 
					# search-url, invalid HTTPS certificate
 | 
				
			||||||
base_url = 'http://gigablast.com/'
 | 
					base_url = 'http://gigablast.com/'
 | 
				
			||||||
search_string = 'search?{query}&n={number_of_results}&s={offset}&xml=1&qh=0'
 | 
					search_string = 'search?{query}&n={number_of_results}&s={offset}&xml=1&qh=0&uxid={uxid}&rand={rand}'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# specific xpath variables
 | 
					# specific xpath variables
 | 
				
			||||||
results_xpath = '//response//result'
 | 
					results_xpath = '//response//result'
 | 
				
			||||||
@ -37,7 +39,9 @@ def request(query, params):
 | 
				
			|||||||
    search_path = search_string.format(
 | 
					    search_path = search_string.format(
 | 
				
			||||||
        query=urlencode({'q': query}),
 | 
					        query=urlencode({'q': query}),
 | 
				
			||||||
        offset=offset,
 | 
					        offset=offset,
 | 
				
			||||||
        number_of_results=number_of_results)
 | 
					        number_of_results=number_of_results,
 | 
				
			||||||
 | 
					        uxid=randint(10000, 10000000),
 | 
				
			||||||
 | 
					        rand=int(time()))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    params['url'] = base_url + search_path
 | 
					    params['url'] = base_url + search_path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user