mirror of
				https://github.com/searxng/searxng.git
				synced 2025-11-03 19:17:07 -05:00 
			
		
		
		
	
						commit
						1a9f8240b8
					
				
							
								
								
									
										40
									
								
								searx/engines/1337x.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								searx/engines/1337x.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,40 @@
 | 
			
		||||
from urllib import quote
 | 
			
		||||
from lxml import html
 | 
			
		||||
from searx.engines.xpath import extract_text
 | 
			
		||||
from searx.utils import get_torrent_size
 | 
			
		||||
from urlparse import urljoin
 | 
			
		||||
 | 
			
		||||
url = 'https://1337x.to/'
 | 
			
		||||
search_url = url + 'search/{search_term}/{pageno}/'
 | 
			
		||||
categories = ['videos']
 | 
			
		||||
paging = True
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def request(query, params):
 | 
			
		||||
    params['url'] = search_url.format(search_term=quote(query), pageno=params['pageno'])
 | 
			
		||||
 | 
			
		||||
    return params
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def response(resp):
 | 
			
		||||
    results = []
 | 
			
		||||
 | 
			
		||||
    dom = html.fromstring(resp.text)
 | 
			
		||||
 | 
			
		||||
    for result in dom.xpath('//table[contains(@class, "table-list")]/tbody//tr'):
 | 
			
		||||
        href = urljoin(url, result.xpath('./td[contains(@class, "name")]/a[2]/@href')[0])
 | 
			
		||||
        title = extract_text(result.xpath('./td[contains(@class, "name")]/a[2]'))
 | 
			
		||||
        seed = extract_text(result.xpath('.//td[contains(@class, "seeds")]'))
 | 
			
		||||
        leech = extract_text(result.xpath('.//td[contains(@class, "leeches")]'))
 | 
			
		||||
        filesize_info = extract_text(result.xpath('.//td[contains(@class, "size")]/text()'))
 | 
			
		||||
        filesize, filesize_multiplier = filesize_info.split()
 | 
			
		||||
        filesize = get_torrent_size(filesize, filesize_multiplier)
 | 
			
		||||
 | 
			
		||||
        results.append({'url': href,
 | 
			
		||||
                        'title': title,
 | 
			
		||||
                        'seed': seed,
 | 
			
		||||
                        'leech': leech,
 | 
			
		||||
                        'filesize': filesize,
 | 
			
		||||
                        'template': 'torrent.html'})
 | 
			
		||||
 | 
			
		||||
    return results
 | 
			
		||||
@ -588,6 +588,10 @@ engines:
 | 
			
		||||
    timeout : 10.0
 | 
			
		||||
    disabled : True
 | 
			
		||||
 | 
			
		||||
  - name : 1337x
 | 
			
		||||
    engine : 1337x
 | 
			
		||||
    shortcut : 1337x
 | 
			
		||||
    disabled : True
 | 
			
		||||
 | 
			
		||||
#The blekko technology and team have joined IBM Watson! -> https://blekko.com/
 | 
			
		||||
#  - name : blekko images
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								searx/static/themes/oscar/img/icons/1337x.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								searx/static/themes/oscar/img/icons/1337x.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 2.1 KiB  | 
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user