Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(covers): 拦截 JavDB 公开协议封面图床

longmeidao6fc53e1ceb4e
diff --git a/src/peach/jav_cover_fetch.py b/src/peach/jav_cover_fetch.py
index 0be1fd4e6..4699aa94e 100644
--- a/src/peach/jav_cover_fetch.py
+++ b/src/peach/jav_cover_fetch.py
@@ -120,7 +120,7 @@ def is_javdb_image(url: str = '', source: str = '') -> bool:
return True
host = urlparse(value).hostname if '://' in value else value
if host and any(host == domain or host.endswith('.' + domain)
- for domain in ('jdbstatic.com', 'javdb.com')):
+ for domain in ('jdbstatic.com', 'javdb.com', 'tp.spfcas.com')):
return True
return False
diff --git a/tests/test_javdb_public.py b/tests/test_javdb_public.py
index 37f304452..84f7b5717 100644
--- a/tests/test_javdb_public.py
+++ b/tests/test_javdb_public.py
@@ -277,12 +277,13 @@ class PublicProtocolTests(unittest.TestCase):
class DetailProjectionTests(unittest.TestCase):
def test_official_thumbnail_does_not_enable_a_javdb_cover(self):
from peach.web_jav_detail import _artwork_fields
- source = {'id': 'Exact', 'cover_url': 'https://c0.jdbstatic.com/a.jpg',
- 'thumb_url': 'https://pics.dmm.co.jp/a.jpg'}
- with patch('peach.web_jav_detail._preview_fields', return_value={}):
- result = _artwork_fields(self.contract, 'MIDA-085', {}, source)
- self.assertFalse(result['source_image'])
- self.assertEqual(result['cover_url'], '')
+ for url in ('https://c0.jdbstatic.com/a.jpg', 'https://tp.spfcas.com/a.jpg?expires=100'):
+ with self.subTest(url=url):
+ source = {'id': 'Exact', 'cover_url': url, 'thumb_url': 'https://pics.dmm.co.jp/a.jpg'}
+ with patch('peach.web_jav_detail._preview_fields', return_value={}):
+ result = _artwork_fields(self.contract, 'MIDA-085', {}, source)
+ self.assertFalse(result['source_image'])
+ self.assertEqual(result['cover_url'], '')
def test_explicit_source_evidence_reuses_detail_image_bytes(self):
import base64