mirror of
				https://github.com/searxng/searxng.git
				synced 2025-11-03 19:17:07 -05:00 
			
		
		
		
	[mod] tokyotoshokan dependecy to other engine removed
This commit is contained in:
		
							parent
							
								
									e74aaa781e
								
							
						
					
					
						commit
						1e2b60f380
					
				@ -14,8 +14,8 @@ import re
 | 
				
			|||||||
from lxml import html
 | 
					from lxml import html
 | 
				
			||||||
from searx.engines.xpath import extract_text
 | 
					from searx.engines.xpath import extract_text
 | 
				
			||||||
from datetime import datetime
 | 
					from datetime import datetime
 | 
				
			||||||
from searx.engines.nyaa import int_or_zero, get_filesize_mul
 | 
					 | 
				
			||||||
from searx.url_utils import urlencode
 | 
					from searx.url_utils import urlencode
 | 
				
			||||||
 | 
					from searx.utils import get_torrent_size
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# engine dependent config
 | 
					# engine dependent config
 | 
				
			||||||
categories = ['files', 'videos', 'music']
 | 
					categories = ['files', 'videos', 'music']
 | 
				
			||||||
@ -26,6 +26,17 @@ base_url = 'https://www.tokyotosho.info/'
 | 
				
			|||||||
search_url = base_url + 'search.php?{query}'
 | 
					search_url = base_url + 'search.php?{query}'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# convert a variable to integer or return 0 if it's not a number
 | 
				
			||||||
 | 
					def int_or_zero(num):
 | 
				
			||||||
 | 
					    if isinstance(num, list):
 | 
				
			||||||
 | 
					        if len(num) < 1:
 | 
				
			||||||
 | 
					            return 0
 | 
				
			||||||
 | 
					        num = num[0]
 | 
				
			||||||
 | 
					    if num.isdigit():
 | 
				
			||||||
 | 
					        return int(num)
 | 
				
			||||||
 | 
					    return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# do search-request
 | 
					# do search-request
 | 
				
			||||||
def request(query, params):
 | 
					def request(query, params):
 | 
				
			||||||
    query = urlencode({'page': params['pageno'], 'terms': query})
 | 
					    query = urlencode({'page': params['pageno'], 'terms': query})
 | 
				
			||||||
@ -76,8 +87,7 @@ def response(resp):
 | 
				
			|||||||
                try:
 | 
					                try:
 | 
				
			||||||
                    # ('1.228', 'GB')
 | 
					                    # ('1.228', 'GB')
 | 
				
			||||||
                    groups = size_re.match(item).groups()
 | 
					                    groups = size_re.match(item).groups()
 | 
				
			||||||
                    multiplier = get_filesize_mul(groups[1])
 | 
					                    params['filesize'] = get_torrent_size(groups[0], groups[1])
 | 
				
			||||||
                    params['filesize'] = int(multiplier * float(groups[0]))
 | 
					 | 
				
			||||||
                except:
 | 
					                except:
 | 
				
			||||||
                    pass
 | 
					                    pass
 | 
				
			||||||
            elif item.startswith('Date:'):
 | 
					            elif item.startswith('Date:'):
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user