Merge branch 'master' into patch-2
@ -1,10 +1,10 @@
|
||||
certifi==2017.11.5
|
||||
flask==0.12.2
|
||||
flask==1.0.2
|
||||
flask-babel==0.11.2
|
||||
lxml==4.1.1
|
||||
idna==2.5
|
||||
lxml==4.2.3
|
||||
idna==2.7
|
||||
pygments==2.1.3
|
||||
pyopenssl==17.4.0
|
||||
python-dateutil==2.6.1
|
||||
pyyaml==3.12
|
||||
requests[socks]==2.18.4
|
||||
pyopenssl==18.0.0
|
||||
python-dateutil==2.7.3
|
||||
pyyaml==3.13
|
||||
requests[socks]==2.19.1
|
||||
|
@ -0,0 +1,14 @@
|
||||
{
|
||||
"ua": "Mozilla/5.0 ({os}; rv:{version}) Gecko/20100101 Firefox/{version}",
|
||||
"versions": [
|
||||
"61.0.1",
|
||||
"61.0",
|
||||
"60.0.2",
|
||||
"60.0.1",
|
||||
"60.0"
|
||||
],
|
||||
"os": [
|
||||
"Windows NT 10; WOW64",
|
||||
"X11; Linux x86_64"
|
||||
]
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
"""
|
||||
Acgsou (Japanese Animation/Music/Comics Bittorrent tracker)
|
||||
|
||||
@website https://www.acgsou.com/
|
||||
@provide-api no
|
||||
@using-api no
|
||||
@results HTML
|
||||
@stable no (HTML can change)
|
||||
@parse url, title, content, seed, leech, torrentfile
|
||||
"""
|
||||
|
||||
from lxml import html
|
||||
from searx.engines.xpath import extract_text
|
||||
from searx.url_utils import urlencode
|
||||
from searx.utils import get_torrent_size, int_or_zero
|
||||
|
||||
# engine dependent config
|
||||
categories = ['files', 'images', 'videos', 'music']
|
||||
paging = True
|
||||
|
||||
# search-url
|
||||
base_url = 'http://www.acgsou.com/'
|
||||
search_url = base_url + 'search.php?{query}&page={offset}'
|
||||
# xpath queries
|
||||
xpath_results = '//table[contains(@class, "list_style table_fixed")]//tr[not(th)]'
|
||||
xpath_category = './/td[2]/a[1]'
|
||||
xpath_title = './/td[3]/a[last()]'
|
||||
xpath_torrent_links = './/td[3]/a'
|
||||
xpath_filesize = './/td[4]/text()'
|
||||
|
||||
|
||||
def request(query, params):
|
||||
query = urlencode({'keyword': query})
|
||||
params['url'] = search_url.format(query=query, offset=params['pageno'])
|
||||
return params
|
||||
|
||||
|
||||
def response(resp):
|
||||
results = []
|
||||
dom = html.fromstring(resp.text)
|
||||
for result in dom.xpath(xpath_results):
|
||||
# defaults
|
||||
filesize = 0
|
||||
magnet_link = "magnet:?xt=urn:btih:{}&tr=http://tracker.acgsou.com:2710/announce"
|
||||
torrent_link = ""
|
||||
|
||||
try:
|
||||
category = extract_text(result.xpath(xpath_category)[0])
|
||||
except:
|
||||
pass
|
||||
|
||||
page_a = result.xpath(xpath_title)[0]
|
||||
title = extract_text(page_a)
|
||||
href = base_url + page_a.attrib.get('href')
|
||||
|
||||
magnet_link = magnet_link.format(page_a.attrib.get('href')[5:-5])
|
||||
|
||||
try:
|
||||
filesize_info = result.xpath(xpath_filesize)[0]
|
||||
filesize = filesize_info[:-2]
|
||||
filesize_multiplier = filesize_info[-2:]
|
||||
filesize = get_torrent_size(filesize, filesize_multiplier)
|
||||
except:
|
||||
pass
|
||||
# I didn't add download/seed/leech count since as I figured out they are generated randomly everytime
|
||||
content = u'Category: "{category}".'
|
||||
content = content.format(category=category)
|
||||
|
||||
results.append({'url': href,
|
||||
'title': title,
|
||||
'content': content,
|
||||
'filesize': filesize,
|
||||
'magnetlink': magnet_link,
|
||||
'template': 'torrent.html'})
|
||||
return results
|
@ -0,0 +1,115 @@
|
||||
"""
|
||||
FindX (General, Images, Videos)
|
||||
|
||||
@website https://www.findx.com
|
||||
@provide-api no
|
||||
@using-api no
|
||||
@results HTML
|
||||
@stable no
|
||||
@parse url, title, content, embedded, img_src, thumbnail_src
|
||||
"""
|
||||
|
||||
from dateutil import parser
|
||||
from json import loads
|
||||
import re
|
||||
|
||||
from lxml import html
|
||||
|
||||
from searx import logger
|
||||
from searx.engines.xpath import extract_text
|
||||
from searx.engines.youtube_noapi import base_youtube_url, embedded_url
|
||||
from searx.url_utils import urlencode
|
||||
|
||||
|
||||
paging = True
|
||||
results_xpath = '//script[@id="initial-state"]'
|
||||
search_url = 'https://www.findx.com/{category}?{q}'
|
||||
type_map = {
|
||||
'none': 'web',
|
||||
'general': 'web',
|
||||
'images': 'images',
|
||||
'videos': 'videos',
|
||||
}
|
||||
|
||||
|
||||
def request(query, params):
|
||||
params['url'] = search_url.format(
|
||||
category=type_map[params['category']],
|
||||
q=urlencode({
|
||||
'q': query,
|
||||
'page': params['pageno']
|
||||
})
|
||||
)
|
||||
return params
|
||||
|
||||
|
||||
def response(resp):
|
||||
dom = html.fromstring(resp.text)
|
||||
results_raw_json = dom.xpath(results_xpath)
|
||||
results_json = loads(extract_text(results_raw_json))
|
||||
|
||||
if len(results_json['web']['results']) > 0:
|
||||
return _general_results(results_json['web']['results']['webSearch']['results'])
|
||||
|
||||
if len(results_json['images']['results']) > 0:
|
||||
return _images_results(results_json['images']['results'])
|
||||
|
||||
if len(results_json['video']['results']) > 0:
|
||||
return _videos_results(results_json['video']['results'])
|
||||
|
||||
return []
|
||||
|
||||
|
||||
def _general_results(general_results):
|
||||
results = []
|
||||
for result in general_results:
|
||||
results.append({
|
||||
'url': result['url'],
|
||||
'title': result['title'],
|
||||
'content': result['sum'],
|
||||
})
|
||||
return results
|
||||
|
||||
|
||||
def _images_results(image_results):
|
||||
results = []
|
||||
for result in image_results:
|
||||
results.append({
|
||||
'url': result['sourceURL'],
|
||||
'title': result['title'],
|
||||
'content': result['source'],
|
||||
'thumbnail_src': _extract_url(result['assets']['thumb']['url']),
|
||||
'img_src': _extract_url(result['assets']['file']['url']),
|
||||
'template': 'images.html',
|
||||
})
|
||||
return results
|
||||
|
||||
|
||||
def _videos_results(video_results):
|
||||
results = []
|
||||
for result in video_results:
|
||||
if not result['kind'].startswith('youtube'):
|
||||
logger.warn('Unknown video kind in findx: {}'.format(result['kind']))
|
||||
continue
|
||||
|
||||
description = result['snippet']['description']
|
||||
if len(description) > 300:
|
||||
description = description[:300] + '...'
|
||||
|
||||
results.append({
|
||||
'url': base_youtube_url + result['id'],
|
||||
'title': result['snippet']['title'],
|
||||
'content': description,
|
||||
'thumbnail': _extract_url(result['snippet']['thumbnails']['default']['url']),
|
||||
'publishedDate': parser.parse(result['snippet']['publishedAt']),
|
||||
'embedded': embedded_url.format(videoid=result['id']),
|
||||
'template': 'videos.html',
|
||||
})
|
||||
return results
|
||||
|
||||
|
||||
def _extract_url(url):
|
||||
matching = re.search('(/https?://[^)]+)', url)
|
||||
if matching:
|
||||
return matching.group(0)[1:]
|
||||
return ''
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 587 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.4 KiB |
@ -0,0 +1 @@
|
||||
alexandre@alf-laptop.2449:1533915028
|
@ -0,0 +1,41 @@
|
||||
.loader,
|
||||
.loader:after {
|
||||
border-radius: 50%;
|
||||
width: 10em;
|
||||
height: 10em;
|
||||
}
|
||||
.loader {
|
||||
margin: 60px auto;
|
||||
font-size: 10px;
|
||||
position: relative;
|
||||
text-indent: -9999em;
|
||||
border-top: 1.1em solid rgba(255, 255, 255, 0.2);
|
||||
border-right: 1.1em solid rgba(255, 255, 255, 0.2);
|
||||
border-bottom: 1.1em solid rgba(255, 255, 255, 0.2);
|
||||
border-left: 1.1em solid #ffffff;
|
||||
-webkit-transform: translateZ(0);
|
||||
-ms-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
-webkit-animation: load8 1.1s infinite linear;
|
||||
animation: load8 1.1s infinite linear;
|
||||
}
|
||||
@-webkit-keyframes load8 {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@keyframes load8 {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|