Skip to content

Commit

Permalink
更新 1.1.15 版。
Browse files Browse the repository at this point in the history
- 1.如果下載 ssl 錯誤則關閉 ssl。
- 2.更新部分套件版本 requirements.txt。
  • Loading branch information
hgalytoby committed May 9, 2023
1 parent 25624a1 commit 97792b2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
7 changes: 7 additions & 0 deletions UpdateLog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# 更新日誌

## ver1.1.15 2023/05/09

- 1.如果下載 ssl 錯誤則關閉 ssl。
- 2.更新部分套件版本 requirements.txt。

## ver1.1.14 2022/12/24

- 1.新增另一種拿影片的方式。
- 2.改用 m3u8 套件拿數量與 uri。
- 3.修正部分資料轉換的方式。

## ver1.1.13 2022/11/17

- 1.修正下載很慢甚至進度完全不會動的問題。

## ver1.1.12 2022/11/17
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
CheckVersion, ReDownload, CheckTsStatus, SearchAnimateThread
from myself_tools import badname, kill_pid, load_localhost_end_anime_data, get_all_page, connect_myself_anime

VERSION = '1.1.14'
VERSION = '1.1.15'

# if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'):
# QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
Expand Down
28 changes: 18 additions & 10 deletions myself_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@
import m3u8
import psutil
import websocket
import ssl
from PyQt5 import QtCore

from myself_tools import get_weekly_update, get_end_anime_list, get_anime_data, requests_RequestException, \
requests_ChunkedEncodingError, requests_ConnectionError, download_request, get_total_page, get_now_page_anime_data, \
download_end_anime_preview, badname, check_version, cpu_memory, myself_login, get_login_select, search_animate, \
record

ws_opt = {
'url': "wss://v.myself-bbs.com/ws",
'header': {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
},
'host': 'v.myself-bbs.com',
'origin': 'https://v.myself-bbs.com',
}


class WeeklyUpdate(QtCore.QThread):
"""
Expand Down Expand Up @@ -298,16 +308,10 @@ def get_m3u8_data_v2(self, url, tid, vid, video_id):
# url = res['host'][index]['host'] + res['video']['720p']
time.sleep(5)

def ws_get_host_and_m3u8_url(self, tid, vid, video_id):
@classmethod
def ws_get_host_and_m3u8_url(cls, tid, vid, video_id):
try:
with closing(websocket.create_connection(
"wss://v.myself-bbs.com/ws",
header={
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
},
host='v.myself-bbs.com',
origin='https://v.myself-bbs.com',
)) as ws:
with closing(websocket.create_connection(**ws_opt)) as ws:
ws.send(json.dumps({'tid': tid, 'vid': vid, 'id': video_id}))
recv = ws.recv()
res = json.loads(recv)
Expand All @@ -317,8 +321,12 @@ def ws_get_host_and_m3u8_url(self, tid, vid, video_id):
else:
video_url = m3u8_url[:m3u8_url.rfind('/')]
return video_url, m3u8_url
except ssl.SSLCertVerificationError:
ws_opt['sslopt'] = {'cert_reqs': ssl.CERT_NONE}
print(f'ssl 憑證有問題: ws_opt: {ws_opt}')
return '', ''
except BaseException as e:
print('websocket 短時間連線太多會出問題')
print(f'websocket 短時間連線太多會出問題: ws_opt: {ws_opt}')
return '', ''

def run(self):
Expand Down
Binary file modified requirements.txt
Binary file not shown.

0 comments on commit 97792b2

Please sign in to comment.