-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (22 loc) · 839 Bytes
/
app.py
File metadata and controls
31 lines (22 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from flask import Flask, jsonify
from libgen_api import LibgenSearch
app = Flask(__name__)
@app.route('/')
def home():
return "working"
@app.route('/<path:data>')
def find_book(data):
print('data')
filters = list(data.split(','))
print(filters)
lb = LibgenSearch()
title = filters[0]
author = filters[1]
year = filters[2]
lang = filters[3]
extension = filters[4]
api_filters = {"Year":year, "Extension":extension, "Language":lang, "Author":author} #{"Title" : title, "Author" : author, "ID" : book_id, "Year" : year, "Language": lang}
results = lb.search_title_filtered(title, api_filters, exact_match=False) #search_title_filtered(title, api_filters, exact_match = False)
return jsonify(results)
if __name__ == '__main__':
app.run(debug=True)