From 3fd2f26fa442b9953bcf40908cb81a230737675f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=9A=E9=A3=8E=E6=8B=82=E6=9F=B3=E9=A2=9C?= <434857005@qq.com> Date: Fri, 12 May 2023 12:45:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=8E=E7=AB=AF=E4=BB=A3?= =?UTF-8?q?=E7=90=86,=E8=A7=A3=E5=86=B3=E9=83=A8=E5=88=86=E7=BD=91?= =?UTF-8?q?=E9=A1=B5=E7=9A=84=E6=92=AD=E6=94=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/web.py | 18 ++++++++++++------ doc/更新日志.md | 3 +++ js/drpy.txt | 2 +- js/version.txt | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/controllers/web.py b/controllers/web.py index a75cc56..f3288c9 100644 --- a/controllers/web.py +++ b/controllers/web.py @@ -6,7 +6,7 @@ import functools import json import os -from urllib.parse import urljoin +from urllib.parse import urljoin, unquote import requests from flask import Blueprint, abort, request, render_template, send_from_directory, render_template_string, jsonify, \ make_response, redirect, \ @@ -116,24 +116,30 @@ def get302UrlResponse(): # 'referer': url, 'user-agent': 'Mozilla/5.0' } - print('开始调用接口:', url) + logger.info(f'开始调用接口:{url}') r = requests.get(url, headers=headers, timeout=timeout, verify=False) rurl = r.url + res_data = r.text + try: + res_data = r.json() + except: + pass # rurl = url_for('vod.vod_home', **params) # print(rurl) - print('结束调用接口:', rurl) + logger.info(f'结束调用接口:{rurl}') + is_redirect = unquote(rurl) != unquote(url) return jsonify({ 'url': rurl, - 'redirect': rurl != url, - 'data': r.text, + 'redirect': is_redirect, + 'data': res_data, }) except Exception as e: logger.info(f'发生了错误:{e}') return jsonify({ 'url': rurl, - 'redirect': rurl != url, + 'redirect': False, 'data': None, 'error': f'{e}', }) diff --git a/doc/更新日志.md b/doc/更新日志.md index 8140aa6..33b5ee0 100644 --- a/doc/更新日志.md +++ b/doc/更新日志.md @@ -1,3 +1,6 @@ +###### 2023/05/12 +- [X] 3.9.42beta1 后端代理解决302跨域问题,支持部分源的网页播放功能,由于无法解决嗅探跨域问题,网页版项目终结 + ###### 2023/05/11 - [X] 3.9.41beta23 完成播放功能 - [X] 优化部分显示bug diff --git a/js/drpy.txt b/js/drpy.txt index f2dde86..117d359 100644 --- a/js/drpy.txt +++ b/js/drpy.txt @@ -1 +1 @@ -{"showTime":89200000,"txt":"drpy 3.9.41beta18 -道长"} \ No newline at end of file +{"showTime":89200000,"txt":"drpy 3.9.42beta1 -道长"} \ No newline at end of file diff --git a/js/version.txt b/js/version.txt index daec681..e2eb7a0 100644 --- a/js/version.txt +++ b/js/version.txt @@ -1 +1 @@ -3.9.41beta27 \ No newline at end of file +3.9.42beta1 \ No newline at end of file