Skip to content

How to Add Unsupported Sites

Rick Lee edited this page Mar 8, 2023 · 3 revisions

Site Config Rules

To configure a site properly, it's important to understand the related configuration for the target site. For example, let's take the HDHome config as an example to explain the rules in detail.

  • YAML config files should be placed in the src/config folder with a unique and common abbreviation for the site.

  • the video attributes should be standardized into a unified format that includes category, videoType, videoCodec, audioCodec, source, and resolution.

  • While only the category selection on the upload page has multiple video attributes by default, category in Chinese sites often includes a mix of video category and other attributes. For example, the Movie Remux is composed of category and videotype. Other attributes usually have definite meanings and can be directly matched with attributes defined in the formed data. However, in special cases where category can be directly matched, but videoType is still in multiple attributes, like in BHD, the values of Category and VideoType should be swapped, and filtering after this relies on category by default.

  • Filtering with category and other attributes can help you get the unique value of type on the upload page and assign a value in the drop-down select element. Even if other attributes can be directly matched, the corresponding values of category should be added together with the attributes to filter out the unique value with category. For instance, on the HDH upload form, the option value for 2160P is 1, which should be set as the initial digit in its array (IMPORTANT). Similarly, the values of Movies UHD Blu-ray and Movies 2160p in type should be set as the last few digits in the array since the video resolution of these two types is 2160P. Other attributes should be configured accordingly until the unique type can be derived from the intersecting.

  • If some of the attributes in the standard data have no corresponding form to be filled in on a site, the attribute of the selector key is no longer needed. In this case, only the map key needs to be configured, following the above rule.

  • Different sites may have additional or reduced sub-attributes under the map of different attributes. For instance, in BHD, bluray is further divided into BD100, BD66, BD50, etc. To account for these differences, add these items to the map and perform the corresponding processing when handling target data in these sites.

  • Tags also need to be checked in some Chinese sites, and only the tags of Mandarin, Chinese, Cantonese, HDR10, HDR10+, DolbyVision, DIY are currently supported. Configure the tag attribute with the corresponding CSS selector.

  • Add corresponding quick search config for a new site, following the example of config.

Config YAML example

 HDHome:
    url: 'https://hdhome.org'
    host: hdhome.org
    siteType: NexusPHP
    asSource: false
    asTarget: true
    uploadPath: /upload.php
    # quick search related config
    search:
      # search path
      path: /browse.php
      # option value of imdb search select element
      imdbOptionKey: '4'
      # option value of movie name search select element
      nameOptionKey: '0'
      # imdb replacer
      replaceKey: ['tt','imdb']
      # params for search default ordered in torrent size
      params:
        # key with search parm
        search: '{imdb}'
        # if imdb search key differs from the name search key,an independent search key is needed
        search: '{name}'
        sort: '5'
        type: desc
        # search type 
        search_area: '{optionKey}'
    # name or title
    name: 
      # dom selector of corresponding input or select element
      selector: '#name'  
    subtitle:
      selector: 'input[name="small_descr"]'
    description:
      selector: '#descr'
    imdb:
      selector: 'input[name="url"][type="text"]'
    # douban link, leave empty if not support 
    douban:
      selector: 'input[name="douban_id"]'
    # anonymous upload
    anonymous: 
      selector: 'input[name="uplver"]'
    # tag checkbox
    tags: 
      chineseAudio: '#tag_gy'
      DIY: '#tag_diy'
      cantoneseAudio: '#tag_yy'
      chineseSubtitle: '#tag_zz'
      HDR: '#tag_hdr10'
      HDR10+: '#tag_hdrm'
      DolbyVision: '#tag_db'
     # like movie,tv,tvPack, etc. 
    category: 
      selector: '#browsecat'
      map:
        movie:
          - '411'
          - '412'
        tv:
          - '425'
          - '426'
        tvPack:
          - '432'
          - '433'
        documentary:
          - '417'
          - '418'
        concert: '441'
        sport:
          - '442'
          - '443'
        cartoon:
          - '444'
          - '445'
        variety: []  
    videoCodec:
      selector: 'select[name="codec_sel"]'
      map:
        h264: '1'
        hevc: '12'
        x264: '1'
        x265: '2'
        h265: '2'
        mpeg2: '4'
        mpeg4:
          - '5'
          - '412'
          - '418'
          - '426'
          - '433'
          - '445'
        vc1: '3'
        xvid: '5'
        dvd: '5'    
    source:
      selector: 'select[name="source_sel"]'
      map:
        uhdbluray: '9'
        bluray: '1'
        hdtv: '4'
        dvd: '3'
        web: '7'
        vhs: '8'
        hddvd: '8'    
    audioCodec:
      selector: 'select[name="audiocodec_sel"]'
      map:
        aac: '6'
        ac3: '15'
        dd: '15'
        dd+: '15'
        dts: '3'
        truehd: '13'
        lpcm: '14'
        dtshdma: '11'
        atmos: '12'
        dtsx: '17'
    videoType:
      selector: 'select[name="medium_sel"]'
      map:
        uhdbluray:
          - '10'
          - '499'
        bluray:
          - '1'
          - '450'
        remux:
          - '3'
          - '415'
        encode:
          - '7'
          - '411'
        web:
          - '11'
          - '411'
        hdtv:
          - '5'
          - '412'
          - '413'
        dvd:
          - ''
          - '411'
        dvdrip:
          - '7'
          - '411'
        other: ''  
    resolution:
      selector: 'select[name="standard_sel"]'
      map:
        2160p:
          - '1'
          - '499'
          - '416'
        1080p:
          - '2'
          - '414'
        1080i:
          - '3'
          - '424'
        720p:
          - '4'
          - '413'
        576p:
          - '5'
          - '411'
        480p:
          - '5'
          - '411'