diff options
author | Adam Tauber <asciimoo@gmail.com> | 2017-09-03 23:09:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-03 23:09:49 +0200 |
commit | 234366b900b269ff2b7782a8210a581acc6de7a6 (patch) | |
tree | e453b0914a0fa8ad3ed8c620d8dfab43060adc34 /searx | |
parent | c505c3c1ca8959a238a8260fafebb0d94918a7e0 (diff) | |
parent | 2d66df0548bebabfb998098ef43c1b2010887952 (diff) | |
download | searxng-234366b900b269ff2b7782a8210a581acc6de7a6.tar.gz searxng-234366b900b269ff2b7782a8210a581acc6de7a6.zip |
Merge pull request #1018 from misnyo/generalfile
[mod]generalfile engine removed
Diffstat (limited to 'searx')
-rw-r--r-- | searx/engines/generalfile.py | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/searx/engines/generalfile.py b/searx/engines/generalfile.py deleted file mode 100644 index 3bb27444f..000000000 --- a/searx/engines/generalfile.py +++ /dev/null @@ -1,62 +0,0 @@ -""" - General Files (Files) - - @website http://www.general-files.org - @provide-api no (nothing found) - - @using-api no (because nothing found) - @results HTML (using search portal) - @stable no (HTML can change) - @parse url, title, content - - @todo detect torrents? -""" - -from lxml import html - -# engine dependent config -categories = ['files'] -paging = True - -# search-url -base_url = 'http://www.general-file.com' -search_url = base_url + '/files-{letter}/{query}/{pageno}' - -# specific xpath variables -result_xpath = '//table[@class="block-file"]' -title_xpath = './/h2/a//text()' -url_xpath = './/h2/a/@href' -content_xpath = './/p//text()' - - -# do search-request -def request(query, params): - - params['url'] = search_url.format(query=query, - letter=query[0], - pageno=params['pageno']) - - return params - - -# get response from search-request -def response(resp): - results = [] - - dom = html.fromstring(resp.text) - - # parse results - for result in dom.xpath(result_xpath): - url = result.xpath(url_xpath)[0] - - # skip fast download links - if not url.startswith('/'): - continue - - # append result - results.append({'url': base_url + url, - 'title': ''.join(result.xpath(title_xpath)), - 'content': ''.join(result.xpath(content_xpath))}) - - # return results - return results |