fix(card): 修复cgc卡不存在抛异常

This commit is contained in:
xingc
2025-04-25 17:41:59 +08:00
parent 0f21491ec2
commit eec6b00685
2 changed files with 28 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
"""trim card table
Revision ID: 2d63d72e671a
Revises: bde4f21924c8
Create Date: 2025-04-25 16:42:04.000778
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '2d63d72e671a'
down_revision: Union[str, None] = 'bde4f21924c8'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column("system_cards",
sa.Column('diy_source', sa.String(length=50), nullable=True, comment='自定义品牌名')
)
def downgrade() -> None:
pass

View File

@@ -279,7 +279,7 @@ class CardScraper:
"""CGC""" """CGC"""
r = await self.api.cgc(cert_number) r = await self.api.cgc(cert_number)
html = Selector(r.text) html = Selector(r.text)
if html.xpath('//div[@class="error" and @ng-show]').get() is None: if html.xpath('//div[@class="certlookup-search-box"]').get() is None:
return return
info_elements = html.xpath('//div[@class="content-wrapper"]//dl') info_elements = html.xpath('//div[@class="content-wrapper"]//dl')