From 1c0d9d814d8ce0355929693d02f3c1394918656c Mon Sep 17 00:00:00 2001 From: sqzw-x Date: Wed, 6 Mar 2024 20:09:45 +0800 Subject: [PATCH] fix: theporndb url (#113) --- src/controllers/main_window/main_window.py | 2 +- src/models/base/web.py | 2 +- src/models/config/config_manual.py | 2 +- src/models/crawlers/theporndb.py | 27 +++++++++++----------- src/models/crawlers/theporndb_movies.py | 21 ++++++++--------- src/views/MDCx.py | 2 +- src/views/MDCx.ui | 2 +- 7 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/controllers/main_window/main_window.py b/src/controllers/main_window/main_window.py index 160041f..d310f88 100644 --- a/src/controllers/main_window/main_window.py +++ b/src/controllers/main_window/main_window.py @@ -2053,7 +2053,7 @@ def _netResult(self): 'dmm': ['https://www.dmm.co.jp', ''], 'mgstage': ['https://www.mgstage.com', ''], 'getchu': ['http://www.getchu.com', ''], - 'theporndb': ['https://api.metadataapi.net', ''], + 'theporndb': ['https://api.theporndb.net', ''], 'avsox': [get_avsox_domain(), ''], 'xcity': ['https://xcity.jp', ''], '7mmtv': ['https://7mmtv.tv', ''], diff --git a/src/models/base/web.py b/src/models/base/web.py index 9f57fab..f4924fb 100644 --- a/src/models/base/web.py +++ b/src/models/base/web.py @@ -698,7 +698,7 @@ def check_theporndb_api_token(): proxies = config.proxies timeout = config.timeout api_token = config.theporndb_api_token - url = 'https://api.metadataapi.net/scenes/hash/8679fcbdd29fa735' + url = 'https://api.theporndb.net/scenes/hash/8679fcbdd29fa735' headers = { 'Authorization': f'Bearer {api_token}', 'Content-Type': 'application/json', diff --git a/src/models/config/config_manual.py b/src/models/config/config_manual.py index ff95249..7517f4a 100644 --- a/src/models/config/config_manual.py +++ b/src/models/config/config_manual.py @@ -534,7 +534,7 @@ class ManualConfig: 'cnmdb': 'cnmdb', 'kin8': 'kin8', 'fantastica': 'fantastica', - 'metadataapi': 'theporndb', + 'theporndb': 'theporndb', 'prestige': 'prestige', } char_list = [ diff --git a/src/models/crawlers/theporndb.py b/src/models/crawlers/theporndb.py index 555cb34..0b32a88 100644 --- a/src/models/crawlers/theporndb.py +++ b/src/models/crawlers/theporndb.py @@ -75,7 +75,7 @@ def read_data(data): pass tag = ','.join(tag_list) slug = data['slug'] - real_url = f'https://metadataapi.net/scenes/{slug}' if slug else '' + real_url = f'https://api.theporndb.net/scenes/{slug}' if slug else '' all_actor_list = [] actor_list = [] try: @@ -106,7 +106,7 @@ def get_real_url(res_search, file_path, series_ex, date): res_title_list = [] res_actor_list = [] for each in search_data: - res_id_url = f"https://metadataapi.net/scenes/{each['slug']}" + res_id_url = f"https://api.theporndb.net/scenes/{each['slug']}" try: res_series = each['site']['short_name'] except: @@ -247,7 +247,7 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn', file api_token = config.theporndb_api_token theporndb_no_hash = config.theporndb_no_hash - real_url = appoint_url + real_url = appoint_url.replace("//theporndb", "//api.theporndb") title = '' cover_url = '' poster_url = '' @@ -278,7 +278,7 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn', file if not theporndb_no_hash: hash = oshash.oshash(file_path) # hash = '8679fcbdd29fa735' - url_hash = f'https://api.metadataapi.net/scenes/hash/{hash}' + url_hash = f'https://api.theporndb.net/scenes/hash/{hash}' debug_info = '请求地址: %s ' % url_hash log_info += web_info + debug_info result, hash_search = get_html(url_hash, headers=headers, json_data=True) @@ -304,17 +304,17 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn', file else: search_keyword_list, series_ex, date = get_search_keyword(file_path) for search_keyword in search_keyword_list: - url_search = f'https://api.metadataapi.net/scenes?parse={search_keyword}&per_page=100' - debug_info = '请求地址: %s ' % url_search.replace('//api.', '//') + url_search = f'https://api.theporndb.net/scenes?parse={search_keyword}&per_page=100' + debug_info = f'请求地址: {url_search} ' log_info += web_info + debug_info result, res_search = get_html(url_search, headers=headers, json_data=True) if not result: # 判断返回内容是否有问题 - debug_info = '请求错误: %s' % url_search.replace('//api.', '//') + debug_info = f'请求错误: {url_search}' log_info += web_info + debug_info if '401 http' in res_search: - debug_info = '请检查 API Token 是否正确: %s ' % api_token + debug_info = f'请检查 API Token 是否正确: {api_token} ' log_info += web_info + debug_info raise Exception(debug_info) @@ -322,15 +322,14 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn', file if real_url: break else: - debug_info = '未找到匹配的内容: %s' % url_search.replace('//api.', '//') + debug_info = f'未找到匹配的内容: {url_search}' log_info += web_info + debug_info raise Exception(debug_info) if real_url and not hash_data: debug_info = '番号地址: %s ' % real_url log_info += web_info + debug_info - req_url = real_url.replace('https://metadataapi.net', 'https://api.metadataapi.net') - result, res_real = get_html(req_url, headers=headers, json_data=True) + result, res_real = get_html(real_url, headers=headers, json_data=True) if not result: # 判断返回内容是否有问题 debug_info = '请求错误: %s ' % res_real @@ -432,7 +431,7 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn', file # print(main('', file_path='AdultTime.20.02.14.Angela.White.And.Courtney.Trouble.Love.Lust.Respect.XXX.1080p.MP4-KTR.mp4')) # 系列错了 # print(main('', file_path='AdultTime.20.02.17.Angela.White.Full.Body.Physical.Exam.XXX.1080p.MP4-KTR.mp4')) # 无命中演员,视为失败 # print(main('', file_path='SexArt_12.04.13-Elle Alexandra & Lexi Bloom & Malena Morgan-Stepping-Out_SexArt-1080p.mp4')) # 多个,按相似度命中 - # print(main('', file_path='SexArt.12.04.13 Sex Art.mp4')) # 多个,按相似度命中 + print(main('', file_path='SexArt.12.04.13 Sex Art.mp4')) # 多个,按相似度命中 # print(main('', file_path='SexArt_12.04.13-Elle Alexandra & Malena Morgan-Under-The-Elle-Tree_SexArt-1080p.mp4')) # 多个,按相似度命中 # print(main('', file_path='SexArt_12.04.13-Elle Alexandra & Rilee Marks-Whispers_SexArt-1080p.mp4')) # 多个,按相似度命中 # print(main('', file_path='SexArt_12.04.13-Hayden Hawkens & Malena Morgan-Golden_SexArt-1080p.mp4')) # 多个,按相似度命中 @@ -453,5 +452,5 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn', file # print(main('', file_path='hussie-pass-bts-new-boobies-a-brand-new-girl.ts')) # 演员没有性别 # print(main('SWhores.23.02.14', file_path='SWhores.23.02.14..Anal Girl with No Extras.1080P.ts')) # 未获取到演员 # print(main('', file_path='/test/work/CzechStreets.2019-01-01.18 Y O Virtuoso with Ddd Tits.Nada.mp4')) # 未获取到演员 - print(main('Evolvedfights.20.10.30', - file_path='AARM-018 - 2021-09-28 - 未知演员 - アロマ企画,アロマ企画/evolvedfights.20.10.30.kay.carter.vs.nathan.bronson.mp4')) + # print(main('Evolvedfights.20.10.30', + # file_path='AARM-018 - 2021-09-28 - 未知演员 - アロマ企画,アロマ企画/evolvedfights.20.10.30.kay.carter.vs.nathan.bronson.mp4')) diff --git a/src/models/crawlers/theporndb_movies.py b/src/models/crawlers/theporndb_movies.py index f7a0575..9277163 100644 --- a/src/models/crawlers/theporndb_movies.py +++ b/src/models/crawlers/theporndb_movies.py @@ -74,7 +74,7 @@ def read_data(data): pass tag = ','.join(tag_list) slug = data['slug'] - real_url = f'https://metadataapi.net/movies/{slug}' if slug else '' + real_url = f'https://api.theporndb.net/movies/{slug}' if slug else '' all_actor_list = [] actor_list = [] try: @@ -105,7 +105,7 @@ def get_real_url(res_search, file_path, series_ex, date): res_title_list = [] res_actor_list = [] for each in search_data: - res_id_url = f"https://metadataapi.net/movies/{each['slug']}" + res_id_url = f"https://api.theporndb.net/movies/{each['slug']}" try: res_series = each['site']['short_name'] except: @@ -245,7 +245,7 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn', file req_web += '-> %s' % website_name api_token = config.theporndb_api_token - real_url = appoint_url + real_url = appoint_url.replace('//theporndb', '//api.theporndb') title = '' cover_url = '' poster_url = '' @@ -273,8 +273,8 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn', file # 通过hash搜索 try: hash = oshash.oshash(file_path) - url_hash = f'https://api.metadataapi.net/movies/hash/{hash}' - debug_info = '请求地址: %s ' % url_hash + url_hash = f'https://api.theporndb.net/movies/hash/{hash}' + debug_info = f'请求地址: {url_hash} ' log_info += web_info + debug_info result, hash_search = get_html(url_hash, headers=headers, json_data=True) @@ -299,14 +299,14 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn', file else: search_keyword_list, series_ex, date = get_search_keyword(file_path) for search_keyword in search_keyword_list: - url_search = f'https://api.metadataapi.net/movies?q={search_keyword}&per_page=100' - debug_info = '请求地址: %s ' % url_search.replace('//api.', '//') + url_search = f'https://api.theporndb.net/movies?q={search_keyword}&per_page=100' + debug_info = f'请求地址: {url_search} ' log_info += web_info + debug_info result, res_search = get_html(url_search, headers=headers, json_data=True) if not result: # 判断返回内容是否有问题 - debug_info = '请求错误: %s' % url_search.replace('//api.', '//') + debug_info = f'请求错误: {url_search}' log_info += web_info + debug_info if '401 http' in res_search: debug_info = '请检查 API Token 是否正确: %s ' % api_token @@ -317,15 +317,14 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn', file if real_url: break else: - debug_info = '未找到匹配的内容: %s' % url_search.replace('//api.', '//') + debug_info = f'未找到匹配的内容: {url_search}' log_info += web_info + debug_info raise Exception(debug_info) if real_url and not hash_data: debug_info = '番号地址: %s ' % real_url log_info += web_info + debug_info - req_url = real_url.replace('https://metadataapi.net', 'https://api.metadataapi.net') - result, res_real = get_html(req_url, headers=headers, json_data=True) + result, res_real = get_html(real_url, headers=headers, json_data=True) if not result: # 判断返回内容是否有问题 debug_info = '请求错误: %s ' % res_real diff --git a/src/views/MDCx.py b/src/views/MDCx.py index dedce30..88ac7ab 100644 --- a/src/views/MDCx.py +++ b/src/views/MDCx.py @@ -11878,7 +11878,7 @@ def retranslateUi(self, MDCx): self.label_324.setText(_translate("MDCx", "⚠️ 修改后先点击保存再切换,否则修改将丢失")) self.groupBox_14.setTitle(_translate("MDCx", "API Token")) self.label_355.setText(_translate("MDCx", "ThePornDB:")) - self.label_356.setText(_translate("MDCx", "

https://metadataapi.net/ 注册登录后,点头像 - API Tokens - CREATE。复制生成的 API Token 填入此处。

")) + self.label_356.setText(_translate("MDCx", "

https://theporndb.net/ 注册登录后,点头像 - API Tokens - CREATE。复制生成的 API Token 填入此处。

")) self.checkBox_theporndb_hash.setText(_translate("MDCx", "不使用Hash值匹配数据")) self.label_422.setText(_translate("MDCx", "

该网站的Hash值匹配结果可能错误

")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab3), _translate("MDCx", " 网络 ")) diff --git a/src/views/MDCx.ui b/src/views/MDCx.ui index 29d79a9..58c867f 100644 --- a/src/views/MDCx.ui +++ b/src/views/MDCx.ui @@ -23102,7 +23102,7 @@ font-weight:bold color: rgb(8, 128, 128); - <html><head/><body><p><a href="https://metadataapi.net/"><span style=" text-decoration: underline; color:#094fd1;">https://metadataapi.net/</span></a> 注册登录后,点头像 - API Tokens - CREATE。复制生成的 API Token 填入此处。</p></body></html> + <html><head/><body><p><a href="https://theporndb.net/"><span style=" text-decoration: underline; color:#094fd1;">https://theporndb.net/</span></a> 注册登录后,点头像 - API Tokens - CREATE。复制生成的 API Token 填入此处。</p></body></html> true