BGmi Script,追你想追的

2017-09-10 16:36:19 +08:00
 RIcter

BGmi 的介绍: https://www.v2ex.com/t/303853

BGmi 1.4.1 添加了一个叫做 BGmi Script 的功能。 BGmi Script 旨在自定义想订阅的内容。
比如想追 Rick and Morty S03,但是 BGmi 只能追番该怎么办?

将下面的脚本保存在 ~/.bgmi/scripts/rick_and_morty.py

# coding=utf-8
from __future__ import print_function, unicode_literals

import re
import requests
from bs4 import BeautifulSoup as bs

from bgmi.script import ScriptBase, parse_episode
from bgmi.utils import print_error
from bgmi.config import IS_PYTHON3


class Script(ScriptBase):

    class Model(ScriptBase.Model):
        bangumi_name = 'Rick and Morty Season 3'
        cover = 'http://img.itvfans.com/wp-content/uploads/31346.jpg'
        updated_time = 'Mon'

    def get_download_url(self):
        # fetch and return dict
        resp = requests.get('http://www.itvfans.com/fenji/313463.html').text
        html = bs(resp, 'lxml')

        data = html.find(attrs={'id': '31346-3-720p'})

        if not data:
            print_error('No data found, maybe the script is out-of-date.', exit_=False)
            return {}

        ret = {}
        match_episode = re.compile('Rick\.and\.Morty\.S03E(\d+)\.720p')
        for row in data.find_all('a', attrs={'type': 'magnet'}):
            link = row.attrs['href']
            episode = match_episode.findall(link)
            if episode:
                ret[int(episode[0])] = link

        return ret


if __name__ == '__main__':
    s = Script()
    print(s.get_download_url())

依托与 BGmi 的自动更新,每当更新后即可在线观看( mkv 其实还需要转码,转完发现没声音,想哭)
同时 BGmi 也很好的整合了 BGmi Script:

欢迎使用 BGmi ~
地址: https://github.com/RicterZ/BGmi
Docker:docker pull ricterz/bgmi
编写很简单的,大家肯定看看例子就会了(逃

3896 次点击
所在节点    分享创造
10 条回复
songjiaxin2008
2017-09-10 16:50:06 +08:00
终于提供接口辣敲碗
DesignerSkyline
2017-09-10 17:33:12 +08:00
前来支持 RR
loopio
2017-09-10 18:34:48 +08:00
不错,好用心。前来支持。
flaneurse
2017-09-10 18:55:49 +08:00
学习一个
xratzh
2017-09-10 21:32:21 +08:00
支持 Pocky
monburan
2017-09-10 22:43:36 +08:00
前来支持大佬
Trim21
2017-09-10 22:57:44 +08:00
前来支持大佬(
RqPS6rhmP3Nyn3Tm
2017-09-11 07:27:13 +08:00
现在在 nas 上用 rss 订阅自动下载,apple tv 流媒体播放,表示很满意。还有一个自己写的第三方 b 站客户端备用
powerbobo
2017-09-11 17:17:17 +08:00
@BXIA 大神,三方 b 站客户端咋拿到 apikey~
RqPS6rhmP3Nyn3Tm
2017-09-11 22:50:13 +08:00
@powerbobo 网上有嫖

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/389570

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX