bgmi3.protocol.source

Base for Data source see 添加数据源

class bgmi3.protocol.source.Base[源代码]

Base class for all data source

name = <bgmi3.helper.abstract.AbstractAttribute object>[源代码]

user readable source name, should be defined as class attribute

id = <bgmi3.helper.abstract.AbstractAttribute object>[源代码]

source id, should be defined as class attribute

abstract fetch_series_and_subtitle_group()Tuple[List[bgmi3.protocol.source.Series], List[bgmi3.protocol.source.Subtitle]][源代码]

return a list of all bangumi and a list of all subtitle group

list of bangumi dict: update time should be one of ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] (bgmi3.model.UpdateTime)

警告

cover should start with http:// or https://

[
    ...,
    bgmi3.protocol.source.Series(
        **{
            "id": "1234",
            "status": model.SeriesStatus.UPDATING,
            "subtitle_group": ["123", "456"],  # list of id of subtitle group
            "name": "名侦探柯南",
            "update_time": "mon",
            "cover": "https://www.example.com/data/images/cover1.jpg",
        }
    ),
    ...,
]

list of subtitle group dict:

[
    ...,
    bgmi3.protocol.source.Subtitle(id="233", name="bgmi字幕组"),
    ...,
]
返回

list of series, list of subtitile group

返回类型

(list[dict], list[dict])

abstract fetch_episode_of_series(series_id: str, max_page: int, subtitle_list: Optional[List[str]] = None)Iterable[bgmi3.protocol.source.Episode][源代码]

get all episode by series id

参数
  • series_id -- series_id

  • subtitle_list (list) -- list of subtitle group

  • max_page (int) -- how many page user want to crawl

返回

list of episode

abstract search_by_keyword(keyword: str, max_page: Optional[int] = None)Iterable[bgmi3.protocol.source.Episode][源代码]

search torrent by arguments. return a list of dict with at least 4 key: download, name, title, episode. Other keys are omitted.

参数
  • keyword (str) -- search key word

  • max_page (int) -- how many page to fetch from website

返回

list of episode search result

返回类型

List[dict]