Skip to content

Conversation

@Rhilip
Copy link
Collaborator

@Rhilip Rhilip commented Sep 10, 2025

Note

基于 JackettPTD重构前配置 适配,需要有用户报告该适配可用才会被合并

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:

  • Introduce siteMetadata for the Concen tracker, including its URLs, categories, and search parameters
  • Define selectors for parsing torrent listings (ID, title, link, time, size, seeders, leechers, and completed downloads)

@Rhilip Rhilip requested a review from Copilot September 10, 2025 12:22
@sourcery-ai
Copy link

sourcery-ai bot commented Sep 10, 2025

Reviewer's Guide

Introduce 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 structure

erDiagram
  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
Loading

Class diagram for the new Concen siteMetadata definition

classDiagram
  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
Loading

File-Level Changes

Change Details Files
Define basic site metadata
  • Set version, id, name, alias, description, and site type
  • List base URL(s) for Concen
src/packages/site/definitions/concen.ts
Configure category filters
  • Add 'Order' category with options for title, date, size, seeds, peers, completed
  • Add 'Sort' category with ascending/descending options
src/packages/site/definitions/concen.ts
Set up search request and selectors
  • Configure requestConfig with /torrents endpoint and default params
  • Define row selector and extractors for id, title, URL, download link
  • Apply filters for time (parseTTL), size (parseSize), and id extraction
src/packages/site/definitions/concen.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]],
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
filters: [(q: string) => q.match(/(\d+)\.torrent$/)![1]],
filters: [(q: string) => q.match(/(\d+)\.torrent$/)?.[1] ?? undefined],

Copilot uses AI. Check for mistakes.
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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]],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant