feat(pkg/site): 参考 Jackett 配置适配 concen#566
Conversation
Reviewer's GuideIntroduce Concen (Conspiracy Central) support by adding a new siteMetadata definition that mirrors Jackett configurations and previous PTD structure, including basic metadata, category filters, and comprehensive search setup. Entity relationship diagram for Concen siteMetadata structureerDiagram
SITE_METADATA {
version int
id varchar
name varchar
aka varchar[]
description text
type varchar
urls varchar[]
}
CATEGORY {
name varchar
key varchar
}
OPTION {
name varchar
value varchar
}
SEARCH {
keywordPath varchar
}
REQUEST_CONFIG {
url varchar
params json
}
SELECTORS {
rows json
id json
category json
title json
url json
link json
time json
size json
seeders json
leechers json
completed json
}
SITE_METADATA ||--|{ CATEGORY : has
CATEGORY ||--|{ OPTION : has
SITE_METADATA ||--|| SEARCH : has
SEARCH ||--|| REQUEST_CONFIG : has
SEARCH ||--|| SELECTORS : has
Class diagram for the new Concen siteMetadata definitionclassDiagram
class ISiteMetadata {
<<interface>>
version: number
id: string
name: string
aka: string[]
description: string
type: string
urls: string[]
category: Category[]
search: Search
}
class Category {
name: string
key: string
options: Option[]
}
class Option {
name: string
value: string
}
class Search {
keywordPath: string
requestConfig: RequestConfig
selectors: Selectors
}
class RequestConfig {
url: string
params: object
}
class Selectors {
rows: Selector
id: Selector
category: Selector
title: Selector
url: Selector
link: Selector
time: Selector
size: Selector
seeders: Selector
leechers: Selector
completed: Selector
}
class Selector {
selector: string | string[]
attr: string
text: string
filters: Filter[]
}
class Filter {
name: string
// or function
}
ISiteMetadata --> Category
Category --> Option
ISiteMetadata --> Search
Search --> RequestConfig
Search --> Selectors
Selectors --> Selector
Selector --> Filter
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for the Concen (Conspiracy Central) private tracker site to PT-depiler. The implementation follows the Jackett configuration and previous PT-depiler legacy code to provide search functionality for this conspiracy-related torrent index.
- Adds complete site definition for Concen including metadata, search configuration, and CSS selectors
- Implements sorting and ordering options for search results
- Configures torrent result parsing with appropriate selectors for extracting torrent information
| id: { | ||
| selector: "td.views-field-field-torrent a", | ||
| attr: "href", | ||
| filters: [(q: string) => q.match(/(\d+)\.torrent$/)![1]], |
There was a problem hiding this comment.
The non-null assertion operator (!) is used without null checking. If the regex match returns null, this will throw a runtime error. Consider using optional chaining and providing a fallback value.
| filters: [(q: string) => q.match(/(\d+)\.torrent$/)![1]], | |
| filters: [(q: string) => q.match(/(\d+)\.torrent$/)?.[1] ?? undefined], |
There was a problem hiding this comment.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/packages/site/definitions/concen.ts:57` </location>
<code_context>
+ id: {
+ selector: "td.views-field-field-torrent a",
+ attr: "href",
+ filters: [(q: string) => q.match(/(\d+)\.torrent$/)![1]],
+ },
+ category: { text: "Other" },
</code_context>
<issue_to_address>
Potential runtime error if RegExp match fails.
Consider handling cases where the match is null to prevent runtime errors, such as by adding a fallback value or conditional check.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| id: { | ||
| selector: "td.views-field-field-torrent a", | ||
| attr: "href", | ||
| filters: [(q: string) => q.match(/(\d+)\.torrent$/)![1]], |
There was a problem hiding this comment.
issue (bug_risk): Potential runtime error if RegExp match fails.
Consider handling cases where the match is null to prevent runtime errors, such as by adding a fallback value or conditional check.
Note
基于 Jackett 和 PTD重构前配置 适配,需要有用户报告该适配可用才会被合并
Summary by Sourcery
Add support for the Concen (Conspiracy Central) private torrent index by introducing its site metadata and search configuration based on Jackett definitions.
New Features: