Browse Source

[fix] piratebay engine date and pep8 indentation

Emilien Devos 4 years ago
parent
commit
c15a91a534
1 changed files with 3 additions and 3 deletions
  1. 3 3
      searx/engines/piratebay.py

+ 3 - 3
searx/engines/piratebay.py

@@ -62,8 +62,8 @@ def response(resp):
     # parse results
     for result in search_res:
         link = url + "description.php?id=" + result["id"]
-        magnetlink = "magnet:?xt=urn:btih:" + result["info_hash"] + "&dn=" + result["name"]
-        + "&tr=" + "&tr=".join(trackers)
+        magnetlink = "magnet:?xt=urn:btih:" + result["info_hash"] + \
+            "&dn=" + result["name"] + "&tr=" + "&tr=".join(trackers)
 
         params = {
             "url": link,
@@ -76,7 +76,7 @@ def response(resp):
 
         # extract and convert creation date
         try:
-            date = datetime.fromtimestamp(result.added)
+            date = datetime.fromtimestamp(float(result["added"]))
             params['publishedDate'] = date
         except:
             pass