get cookies automatically

This commit is contained in:
sqzhang 2020-04-11 16:50:50 +08:00
parent cebcce50f8
commit 49e5ed514f
3 changed files with 10 additions and 5 deletions

View File

@ -80,6 +80,7 @@ class MainWindow(QMainWindow):
# 获取用户user_vid
if 'wr_vid' in self.DomainCookies.keys():
USER_VID = self.DomainCookies['wr_vid']
print('用户id:{}'.format(USER_VID))
# 关闭整个qt窗口
QCoreApplication.instance().quit()
@ -126,4 +127,6 @@ if __name__=='__main__':
print(get_bookshelf(USER_VID, HEADERS))
print(get_bookshelf(USER_VID, HEADERS))
print(get_bookmarklist(29845865, HEADERS))
#29845865

View File

@ -1,3 +1,4 @@
requests
clipboard
PyQt5==5.13.0
PyQtWebEngine==5.13.0

View File

@ -14,6 +14,8 @@ from operator import itemgetter
from itertools import chain
import requests
import json
import clipboard
import urllib3
# 禁用安全警告
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
@ -43,7 +45,7 @@ def get_bookmarklist(bookId, headers):
start = int(item['range'].split('-')[0])
contents[chapter].append((start, text))
chapters_map = {title: level for level, title in get_chapters(int(bookId))}
chapters_map = {title: level for level, title in get_chapters(int(bookId), headers)}
res = ''
for c in sorted(chapters.keys()):
title = chapters[c]
@ -136,10 +138,9 @@ def get_bookshelf(userVid, headers):
raise Exception(r.text)
books = set()
for book in chain(data['finishReadBooks'], data['recentBooks']):
if not book['bookId'].isdigit(): # 过滤公众号
if not book['bookId'].isdigit(): # 过滤公众号
continue
b = Book(book['bookId'], book['title'], book['author'],
book['cover'], book['category'])
b = Book(book['bookId'], book['title'], book['author'], book['cover'], book['category'])
books.add(b)
books = list(books)
books.sort(key=itemgetter(-1))