diff --git a/.gitattributes b/.gitattributes index fd8df4a..958b534 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,10 +1,10 @@ -tools/worker/public/css/** linguist-vendored -tools/worker/public/fonts/* linguist-vendored -tools/worker/public/img/* linguist-vendored -tools/worker/public/js/* linguist-vendored -tools/worker/public/js/search.js -linguist-vendored -tools/worker/public/404.html linguist-vendored -tools/worker/public/resource.html linguist-vendored +yyets/worker/public/css/** linguist-vendored +yyets/worker/public/fonts/* linguist-vendored +yyets/worker/public/img/* linguist-vendored +yyets/worker/public/js/* linguist-vendored +yyets/worker/public/js/search.js -linguist-vendored +yyets/worker/public/404.html linguist-vendored +yyets/worker/public/resource.html linguist-vendored yyetsweb/templates/css/** linguist-vendored yyetsweb/templates/fonts/* linguist-vendored diff --git a/README.md b/README.md index dff7b3f..a5ca3f6 100644 --- a/README.md +++ b/README.md @@ -98,8 +98,40 @@ yyets_offline - 人人影视离线数据 # 开发 +## 网站开发 + 如何部署、参与开发、具体API接口,可以 [参考这个文档](DEVELOPMENT.md) +## Python Library + +也可以作为Python Library去调用 + +`pip3 install yyets` + +``` +>>> from yyets import YYeTs +>>> yy=YYeTs("逃避") +[2021-09-21 19:22:32 __init__.py:54 I] Fetching 逃避可耻却有用...https://yyets.dmesg.app/api/resource?id=34812 +[2021-09-21 19:22:33 __init__.py:54 I] Fetching 无法逃避...https://yyets.dmesg.app/api/resource?id=29540 +[2021-09-21 19:22:35 __init__.py:54 I] Fetching 逃避者...https://yyets.dmesg.app/api/resource?id=37089 + +>>> yy.result +[, , ] + +>>> for y in yy.result: + print(y) + +逃避可耻却有用 - NIGERUHA HAJIDAGA YAKUNITATSU +无法逃避 - Inescapable +逃避者 - Shirkers + +>>> yy.result[0].cnname +'逃避可耻却有用' + +>>> yy.result[0].list +[{'season_num': '101', 'season_cn': '单剧', 'items': {'APP': [{'ite +``` + # Credits * [人人影视](http://www.zmz2019.com/) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..94a82df --- /dev/null +++ b/setup.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Note: To use the 'upload' functionality of this file, you must: +# $ pipenv install twine --dev + +import io +import os +import sys +from shutil import rmtree + +from setuptools import find_packages, setup, Command + +# Package meta-data. +NAME = 'yyets' +DESCRIPTION = 'https://yyets.dmesg.app/ wrapper' +URL = 'https://github.com/tgbot-collection/YYeTsBot' +EMAIL = 'benny.think@gmail.com' +AUTHOR = 'BennyThink' +REQUIRES_PYTHON = '>=3.6.0' +VERSION = '1.0.0' + +# What packages are required for this module to be executed? +REQUIRED = [ + "requests" +] + +# What packages are optional? +EXTRAS = { + # 'fancy feature': ['django'], +} + +# The rest you shouldn't have to touch too much :) +# ------------------------------------------------ +# Except, perhaps the License and Trove Classifiers! +# If you do change the License, remember to change the Trove Classifier for that! + +here = os.path.abspath(os.path.dirname(__file__)) + +# Import the README and use it as the long-description. +# Note: this will only work if 'README.md' is present in your MANIFEST.in file! +try: + with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f: + long_description = '\n' + f.read() +except FileNotFoundError: + long_description = DESCRIPTION + +# Load the package's __version__.py module as a dictionary. +about = {} +if not VERSION: + project_slug = NAME.lower().replace("-", "_").replace(" ", "_") + with open(os.path.join(here, project_slug, '__version__.py')) as f: + exec(f.read(), about) +else: + about['__version__'] = VERSION + + +class UploadCommand(Command): + """Support setup.py upload.""" + + description = 'Build and publish the package.' + user_options = [] + + @staticmethod + def status(s): + """Prints things in bold.""" + print('\033[1m{0}\033[0m'.format(s)) + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + try: + self.status('Removing previous builds…') + rmtree(os.path.join(here, 'dist')) + except OSError: + pass + + self.status('Building Source and Wheel (universal) distribution…') + os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable)) + + self.status('Uploading the package to PyPI via Twine…') + os.system('twine upload dist/*') + + self.status('Pushing git tags…') + os.system('git tag v{0}'.format(about['__version__'])) + os.system('git push --tags') + + sys.exit() + + +# Where the magic happens: +setup( + name=NAME, + version=about['__version__'], + description=DESCRIPTION, + long_description=long_description, + long_description_content_type='text/markdown', + author=AUTHOR, + author_email=EMAIL, + python_requires=REQUIRES_PYTHON, + url=URL, + # packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]), + # If your package is a single module, use this instead of 'packages': + packages=['yyets'], + + # entry_points={ + # 'console_scripts': ['mycli=mymodule:cli'], + # }, + install_requires=REQUIRED, + extras_require=EXTRAS, + include_package_data=True, + license='MIT', + classifiers=[ + # Trove classifiers + # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers + 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy' + ], + # $ setup.py publish support. + cmdclass={ + 'upload': UploadCommand, + }, +) \ No newline at end of file diff --git a/tools/BagAndDrag/README.md b/yyets/BagAndDrag/README.md similarity index 100% rename from tools/BagAndDrag/README.md rename to yyets/BagAndDrag/README.md diff --git a/tools/BagAndDrag/bag.py b/yyets/BagAndDrag/bag.py similarity index 100% rename from tools/BagAndDrag/bag.py rename to yyets/BagAndDrag/bag.py diff --git a/tools/BagAndDrag/cfkv.py b/yyets/BagAndDrag/cfkv.py similarity index 100% rename from tools/BagAndDrag/cfkv.py rename to yyets/BagAndDrag/cfkv.py diff --git a/tools/BagAndDrag/convert_db.py b/yyets/BagAndDrag/convert_db.py similarity index 100% rename from tools/BagAndDrag/convert_db.py rename to yyets/BagAndDrag/convert_db.py diff --git a/tools/BagAndDrag/create_db.py b/yyets/BagAndDrag/create_db.py similarity index 100% rename from tools/BagAndDrag/create_db.py rename to yyets/BagAndDrag/create_db.py diff --git a/tools/BagAndDrag/drag.py b/yyets/BagAndDrag/drag.py similarity index 100% rename from tools/BagAndDrag/drag.py rename to yyets/BagAndDrag/drag.py diff --git a/tools/BagAndDrag/sample.json b/yyets/BagAndDrag/sample.json similarity index 100% rename from tools/BagAndDrag/sample.json rename to yyets/BagAndDrag/sample.json diff --git a/tools/BagAndDrag/zimuxia/convert_db.py b/yyets/BagAndDrag/zimuxia/convert_db.py similarity index 100% rename from tools/BagAndDrag/zimuxia/convert_db.py rename to yyets/BagAndDrag/zimuxia/convert_db.py diff --git a/tools/BagAndDrag/zimuxia/zimuxia.py b/yyets/BagAndDrag/zimuxia/zimuxia.py similarity index 100% rename from tools/BagAndDrag/zimuxia/zimuxia.py rename to yyets/BagAndDrag/zimuxia/zimuxia.py diff --git a/yyets/__init__.py b/yyets/__init__.py new file mode 100644 index 0000000..bd5257b --- /dev/null +++ b/yyets/__init__.py @@ -0,0 +1,64 @@ +#!/usr/local/bin/python3 +# coding: utf-8 + +# YYeTsBot - __init__.py +# 9/21/21 18:09 +# + +__author__ = "Benny " + +import requests +import logging + +API = "https://yyets.dmesg.app/api/resource?" + +logging.basicConfig( + level=logging.INFO, + format='[%(asctime)s %(filename)s:%(lineno)d %(levelname).1s] %(message)s', + datefmt="%Y-%m-%d %H:%M:%S" +) + + +class Resource: + + def __init__(self): + self.enname = None + self.cnname = None + + def __str__(self): + return f"{self.cnname} - {self.enname}" + + +class YYeTs: + def __init__(self, keyword: "str"): + self.result = [] + self.keyword = keyword + self.search_api = f"{API}keyword={self.keyword}" + self.resource_api = f"{API}id=%s" + self.search() + + def search(self): + data = requests.get(self.search_api).json() + for item in data["data"]: + r = Resource() + info = item["data"]["info"] + setattr(r, "list", self.fetch(info)) + for k, v in info.items(): + setattr(r, k, v) + self.result.append(r) + + def fetch(self, info): + rid = info["id"] + url = self.resource_api % rid + headers = {"Referer": url} + logging.info("Fetching %s...%s", info["cnname"], url) + return requests.get(url, headers=headers).json()["data"]["list"] + + def __str__(self): + return f"{self.keyword} - {self.search_api}" + + +if __name__ == '__main__': + ins = YYeTs("逃避") + for i in ins.result: + print(i) diff --git a/tools/healthcheck/check.py b/yyets/healthcheck/check.py similarity index 100% rename from tools/healthcheck/check.py rename to yyets/healthcheck/check.py diff --git a/tools/healthcheck/restart_service.py b/yyets/healthcheck/restart_service.py similarity index 100% rename from tools/healthcheck/restart_service.py rename to yyets/healthcheck/restart_service.py diff --git a/tools/management/format.json b/yyets/management/format.json similarity index 100% rename from tools/management/format.json rename to yyets/management/format.json diff --git a/tools/management/ui.py b/yyets/management/ui.py similarity index 100% rename from tools/management/ui.py rename to yyets/management/ui.py diff --git a/tools/worker/.cargo-ok b/yyets/worker/.cargo-ok similarity index 100% rename from tools/worker/.cargo-ok rename to yyets/worker/.cargo-ok diff --git a/tools/worker/README.md b/yyets/worker/README.md similarity index 100% rename from tools/worker/README.md rename to yyets/worker/README.md diff --git a/tools/worker/public/404.html b/yyets/worker/public/404.html similarity index 100% rename from tools/worker/public/404.html rename to yyets/worker/public/404.html diff --git a/tools/worker/public/css/3rd/animate.css b/yyets/worker/public/css/3rd/animate.css similarity index 100% rename from tools/worker/public/css/3rd/animate.css rename to yyets/worker/public/css/3rd/animate.css diff --git a/tools/worker/public/css/3rd/icons.css b/yyets/worker/public/css/3rd/icons.css similarity index 100% rename from tools/worker/public/css/3rd/icons.css rename to yyets/worker/public/css/3rd/icons.css diff --git a/tools/worker/public/css/3rd/widgets.css b/yyets/worker/public/css/3rd/widgets.css similarity index 100% rename from tools/worker/public/css/3rd/widgets.css rename to yyets/worker/public/css/3rd/widgets.css diff --git a/tools/worker/public/css/aYin.css b/yyets/worker/public/css/aYin.css similarity index 100% rename from tools/worker/public/css/aYin.css rename to yyets/worker/public/css/aYin.css diff --git a/tools/worker/public/css/bootstrap.min.css b/yyets/worker/public/css/bootstrap.min.css similarity index 100% rename from tools/worker/public/css/bootstrap.min.css rename to yyets/worker/public/css/bootstrap.min.css diff --git a/tools/worker/public/css/data.json b/yyets/worker/public/css/data.json similarity index 100% rename from tools/worker/public/css/data.json rename to yyets/worker/public/css/data.json diff --git a/tools/worker/public/css/down-list-20180530.css b/yyets/worker/public/css/down-list-20180530.css similarity index 100% rename from tools/worker/public/css/down-list-20180530.css rename to yyets/worker/public/css/down-list-20180530.css diff --git a/tools/worker/public/css/font-awesome.min.css b/yyets/worker/public/css/font-awesome.min.css similarity index 100% rename from tools/worker/public/css/font-awesome.min.css rename to yyets/worker/public/css/font-awesome.min.css diff --git a/tools/worker/public/css/index.json b/yyets/worker/public/css/index.json similarity index 100% rename from tools/worker/public/css/index.json rename to yyets/worker/public/css/index.json diff --git a/tools/worker/public/css/jquery.mCustomScrollbar.css b/yyets/worker/public/css/jquery.mCustomScrollbar.css similarity index 100% rename from tools/worker/public/css/jquery.mCustomScrollbar.css rename to yyets/worker/public/css/jquery.mCustomScrollbar.css diff --git a/tools/worker/public/favicon.ico b/yyets/worker/public/favicon.ico similarity index 100% rename from tools/worker/public/favicon.ico rename to yyets/worker/public/favicon.ico diff --git a/tools/worker/public/fonts/fontawesome-webfont.woff2 b/yyets/worker/public/fonts/fontawesome-webfont.woff2 similarity index 100% rename from tools/worker/public/fonts/fontawesome-webfont.woff2 rename to yyets/worker/public/fonts/fontawesome-webfont.woff2 diff --git a/tools/worker/public/fonts/test.txt b/yyets/worker/public/fonts/test.txt similarity index 100% rename from tools/worker/public/fonts/test.txt rename to yyets/worker/public/fonts/test.txt diff --git a/tools/worker/public/img/11bcd4d0f2daf8b02fecc72bc8ca38ab.png b/yyets/worker/public/img/11bcd4d0f2daf8b02fecc72bc8ca38ab.png similarity index 100% rename from tools/worker/public/img/11bcd4d0f2daf8b02fecc72bc8ca38ab.png rename to yyets/worker/public/img/11bcd4d0f2daf8b02fecc72bc8ca38ab.png diff --git a/tools/worker/public/img/200-wrangler-ferris.gif b/yyets/worker/public/img/200-wrangler-ferris.gif similarity index 100% rename from tools/worker/public/img/200-wrangler-ferris.gif rename to yyets/worker/public/img/200-wrangler-ferris.gif diff --git a/tools/worker/public/img/404-wrangler-ferris.gif b/yyets/worker/public/img/404-wrangler-ferris.gif similarity index 100% rename from tools/worker/public/img/404-wrangler-ferris.gif rename to yyets/worker/public/img/404-wrangler-ferris.gif diff --git a/tools/worker/public/img/grid16.png b/yyets/worker/public/img/grid16.png similarity index 100% rename from tools/worker/public/img/grid16.png rename to yyets/worker/public/img/grid16.png diff --git a/tools/worker/public/img/yyetsTrans.png b/yyets/worker/public/img/yyetsTrans.png similarity index 100% rename from tools/worker/public/img/yyetsTrans.png rename to yyets/worker/public/img/yyetsTrans.png diff --git a/tools/worker/public/index.html b/yyets/worker/public/index.html similarity index 100% rename from tools/worker/public/index.html rename to yyets/worker/public/index.html diff --git a/tools/worker/public/js/aYin.js b/yyets/worker/public/js/aYin.js similarity index 100% rename from tools/worker/public/js/aYin.js rename to yyets/worker/public/js/aYin.js diff --git a/tools/worker/public/js/bootstrap.min.js b/yyets/worker/public/js/bootstrap.min.js similarity index 100% rename from tools/worker/public/js/bootstrap.min.js rename to yyets/worker/public/js/bootstrap.min.js diff --git a/tools/worker/public/js/jquery.mCustomScrollbar.min.js b/yyets/worker/public/js/jquery.mCustomScrollbar.min.js similarity index 100% rename from tools/worker/public/js/jquery.mCustomScrollbar.min.js rename to yyets/worker/public/js/jquery.mCustomScrollbar.min.js diff --git a/tools/worker/public/js/jquery.min.js b/yyets/worker/public/js/jquery.min.js similarity index 100% rename from tools/worker/public/js/jquery.min.js rename to yyets/worker/public/js/jquery.min.js diff --git a/tools/worker/public/js/jquery.mousewheel.min.js b/yyets/worker/public/js/jquery.mousewheel.min.js similarity index 100% rename from tools/worker/public/js/jquery.mousewheel.min.js rename to yyets/worker/public/js/jquery.mousewheel.min.js diff --git a/tools/worker/public/js/rshare.js b/yyets/worker/public/js/rshare.js similarity index 100% rename from tools/worker/public/js/rshare.js rename to yyets/worker/public/js/rshare.js diff --git a/tools/worker/public/js/search.js b/yyets/worker/public/js/search.js similarity index 100% rename from tools/worker/public/js/search.js rename to yyets/worker/public/js/search.js diff --git a/tools/worker/public/js/vue.js b/yyets/worker/public/js/vue.js similarity index 100% rename from tools/worker/public/js/vue.js rename to yyets/worker/public/js/vue.js diff --git a/tools/worker/public/resource.html b/yyets/worker/public/resource.html similarity index 100% rename from tools/worker/public/resource.html rename to yyets/worker/public/resource.html diff --git a/tools/worker/public/search.html b/yyets/worker/public/search.html similarity index 100% rename from tools/worker/public/search.html rename to yyets/worker/public/search.html diff --git a/tools/worker/workers-site/index.js b/yyets/worker/workers-site/index.js similarity index 100% rename from tools/worker/workers-site/index.js rename to yyets/worker/workers-site/index.js diff --git a/tools/worker/workers-site/package-lock.json b/yyets/worker/workers-site/package-lock.json similarity index 100% rename from tools/worker/workers-site/package-lock.json rename to yyets/worker/workers-site/package-lock.json diff --git a/tools/worker/workers-site/package.json b/yyets/worker/workers-site/package.json similarity index 100% rename from tools/worker/workers-site/package.json rename to yyets/worker/workers-site/package.json diff --git a/tools/worker/wrangler.toml b/yyets/worker/wrangler.toml similarity index 100% rename from tools/worker/wrangler.toml rename to yyets/worker/wrangler.toml