前言
在使用moviepilot的的时候会遇到某些站点MP并不支持的情况。
虽然在插件中有一个“自定义索引站点 v1.0”的插件,可以增加站点支持,但是自定义添加的站点会出现“站点用户数据”无法获取的情况。
分析
通过查看日志,可以发现,其实是因为MP无法匹配schema模型,从而无法分析站点。通过查看MP的schema可以发现,其实MP覆盖的schema模型还是挺多的,只要我们添加的站点是符合MP自带的schema就可以正确识别的。
以以下站点配置为例,主要是在其中加入了 "schema": "NexusPhp",告诉MP要用什么schema来分析站点。
下面记录一下“自定义索引站点 v1.0”添加站点的流程。
编写好站点配置,主要是修改“example”或者根据自己实际情况修改,包括“schema”的值:
{
"id": "example",
"name": "example",
"domain": "https://pt.example.com/",
"ext_domains": [
"https://pt.example.com/"
],
"encoding": "UTF-8",
"public": false,
"schema": "NexusPhp",
"search": {
"paths": [
{
"path": "torrents.php",
"method": "get"
}
],
"params": {
"search": "{keyword}",
"search_area": 4
},
"batch": {
"delimiter": " ",
"space_replace": "_"
}
},
"category": {
"movie": [
{
"id": 401,
"cat": "Movies",
"desc": "Movies电影"
},
{
"id": 405,
"cat": "Anime",
"desc": "Animations动漫"
},
{
"id": 404,
"cat": "Documentary",
"desc": "Documentaries纪录片"
}
],
"tv": [
{
"id": 402,
"cat": "TV",
"desc": "TV Series电视剧"
},
{
"id": 403,
"cat": "TV",
"desc": "TV Shows综艺"
},
{
"id": 404,
"cat": "Documentary",
"desc": "Documentaries纪录片"
},
{
"id": 405,
"cat": "Anime",
"desc": "Animations动漫"
}
]
},
"torrents": {
"list": {
"selector": "table.torrents > tr:has(\"table.torrentname\")"
},
"fields": {
"id": {
"selector": "a[href*=\"details.php?id=\"]",
"attribute": "href",
"filters": [
{
"name": "re_search",
"args": [
"\\d+",
0
]
}
]
},
"title_default": {
"selector": "a[href*=\"details.php?id=\"]"
},
"title_optional": {
"optional": true,
"selector": "a[title][href*=\"details.php?id=\"]",
"attribute": "title"
},
"title": {
"text": "{% if fields['title_optional'] %}{{ fields['title_optional'] }}{% else %}{{ fields['title_default'] }}{% endif %}"
},
"details": {
"selector": "a[href*=\"details.php?id=\"]",
"attribute": "href"
},
"download": {
"selector": "a[href*=\"download.php?id=\"]",
"attribute": "href"
},
"imdbid": {
"selector": "div.imdb_100 > a",
"attribute": "href",
"filters": [
{
"name": "re_search",
"args": [
"tt\\d+",
0
]
}
]
},
"date_elapsed": {
"selector": "td:nth-child(4) > span",
"optional": true
},
"date_added": {
"selector": "td:nth-child(4) > span",
"attribute": "title",
"optional": true
},
"size": {
"selector": "td:nth-child(5)"
},
"seeders": {
"selector": "td:nth-child(6)"
},
"leechers": {
"selector": "td:nth-child(7)"
},
"grabs": {
"selector": "td:nth-child(8)"
},
"downloadvolumefactor": {
"case": {
"img.pro_free": 0,
"img.pro_free2up": 0,
"img.pro_50pctdown": 0.5,
"img.pro_50pctdown2up": 0.5,
"img.pro_30pctdown": 0.3,
"*": 1
}
},
"uploadvolumefactor": {
"case": {
"img.pro_50pctdown2up": 2,
"img.pro_free2up": 2,
"img.pro_2up": 2,
"*": 1
}
},
"description": {
"selector": "td:nth-child(2) > table > tr > td.embedded > span[style]",
"contents": -1
},
"labels": {
"selector": "td:nth-child(2) > table > tr > td.embedded > span.tags"
}
}
}
}使用Base64转码工具,将上面的配置转换成Base64编码
可以在网上找到一些在线的网站:Base64 在线编码解码、Base64 编码/解码。(仅供参考)
将转换后的编码配合网站网址添加到插件中,一行一个站点
以下仅为参考:example.com|+Base64编码
example.com|ewogICAgIm……如果有多个站点,记得回车换行,再添加。
结尾
按照上面配置保存后,就可以在“站点管理”处正常添加我们自定义的站点了。
刷新“站点用户数据”,数据也可以正确识别了。
该教程仅对使用“NexusPhp”系统的站点有用,其他站点需要另做分析。
如果遇到无法识别的站点或其他问题,可以在评论区留言。如果条件允许,我可以帮忙处理一下。