Created
April 27, 2018 11:16
-
-
Save kinoko3/33c522c7c0bc5228f4706954aabe44ff to your computer and use it in GitHub Desktop.
exhentai_rank
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymongo | |
SERVER = '120.79.9.80' | |
PORT = 27017 | |
DB_NAME = 'ex-rank' | |
COLLECTION = 'rank' | |
client = pymongo.MongoClient(SERVER, PORT) | |
db = client[DB_NAME] | |
collection = db[COLLECTION] | |
def fav(Collection): | |
a = Collection.find().sort("favorited", -1) | |
print("------------收藏数TOP10-----------------") | |
for a, i in enumerate(a): | |
print('|类型: '+ i['type']) | |
print('|平均评分: ' + str(i['average'])) | |
print('|收藏数: '+str(i['favorited'])) | |
print('|总打分: '+str(i['rating'])) | |
print('|发布时间: '+i['time']) | |
print('|名字: '+i['name']) | |
print('|长度: '+str(i['length'])+'页') | |
print('|url: '+i['url']) | |
print('|封面url: ' + i['cover_url']) | |
print('------------------------------------------------------------------------------------------------------------------------------------') | |
if a == 9: | |
break | |
def rate(Collection): | |
a = Collection.find().sort("rating", -1) | |
print("------------总评分TOP10-----------------") | |
for a, i in enumerate(a): | |
print('|类型: ' + i['type']) | |
print('|平均评分: ' + str(i['average'])) | |
print('|收藏数: ' + str(i['favorited'])) | |
print('|总打分: ' + str(i['rating'])) | |
print('|发布时间: ' + i['time']) | |
print('|名字: ' + i['name']) | |
print('|长度: ' + str(i['length']) + '页') | |
print('|url: ' + i['url']) | |
print('|封面url: '+ i['cover_url']) | |
print('------------------------------------------------------------------------------------------------------------------------------------') | |
if a == 9: | |
break | |
if __name__ == '__main__': | |
print(''' | |
___ ___ ____________ | |
| \/ | | _ \ ___ \\ | |
| . . | ___ _ __ __ _ ___ | | | | |_/ / | |
| |\/| |/ _ \| '_ \ / _` |/ _ \| | | | ___ \\ | |
| | | | (_) | | | | (_| | (_) | |/ /| |_/ / | |
\_| |_/\___/|_| |_|\__, |\___/|___/ \____/ | |
__/ | | |
|___/ | |
''') | |
print() | |
print('输入f查询:收藏TOP') | |
print('输入r查询:总评分TOP') | |
print('') | |
# fav(collection) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment