Skip to content

Commit

Permalink
fix: theporndb url (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
sqzw-x committed Mar 6, 2024
1 parent c4e996e commit 1c0d9d8
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/controllers/main_window/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', ''],
Expand Down
2 changes: 1 addition & 1 deletion src/models/base/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/models/config/config_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ class ManualConfig:
'cnmdb': 'cnmdb',
'kin8': 'kin8',
'fantastica': 'fantastica',
'metadataapi': 'theporndb',
'theporndb': 'theporndb',
'prestige': 'prestige',
}
char_list = [
Expand Down
27 changes: 13 additions & 14 deletions src/models/crawlers/theporndb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 = ''
Expand Down Expand Up @@ -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)
Expand All @@ -304,33 +304,32 @@ 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)

real_url = get_real_url(res_search, file_path, series_ex, date)
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
Expand Down Expand Up @@ -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')) # 多个,按相似度命中
Expand All @@ -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'))
21 changes: 10 additions & 11 deletions src/models/crawlers/theporndb_movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 = ''
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/views/MDCx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "<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>"))
self.label_356.setText(_translate("MDCx", "<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>"))
self.checkBox_theporndb_hash.setText(_translate("MDCx", "不使用Hash值匹配数据"))
self.label_422.setText(_translate("MDCx", "<html><head/><body><p>该网站的Hash值匹配结果可能错误</p></body></html>"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab3), _translate("MDCx", " 网络 "))
Expand Down
2 changes: 1 addition & 1 deletion src/views/MDCx.ui
Original file line number Diff line number Diff line change
Expand Up @@ -23102,7 +23102,7 @@ font-weight:bold</string>
<string notr="true">color: rgb(8, 128, 128);</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://metadataapi.net/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#094fd1;&quot;&gt;https://metadataapi.net/&lt;/span&gt;&lt;/a&gt; 注册登录后,点头像 - API Tokens - CREATE。复制生成的 API Token 填入此处。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://theporndb.net/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#094fd1;&quot;&gt;https://theporndb.net/&lt;/span&gt;&lt;/a&gt; 注册登录后,点头像 - API Tokens - CREATE。复制生成的 API Token 填入此处。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="scaledContents">
<bool>true</bool>
Expand Down

0 comments on commit 1c0d9d8

Please sign in to comment.