Repository: hect0x7/JMComic-APK Branch: master Commit: 9103088e7230 Files: 6 Total size: 8.8 KB Directory structure: gitextract_izt0_4ul/ ├── .github/ │ └── workflows/ │ └── auto_release.yml ├── APK_VERSION.txt ├── README.md ├── main.py ├── op.yml └── requirements.txt ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/auto_release.yml ================================================ # This is a basic workflow to help you get started with Actions name: Check JMComic Android APK # Controls when the workflow will run on: push: workflow_dispatch: schedule: - cron: '0 */2 * * *' permissions: contents: write # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Python 3.11 uses: actions/setup-python@v4 with: python-version: "3.11" - name: Install Dependency run: | python -m pip install --upgrade pip pip install jmcomic - name: Run Script id: script run: | python main.py - name: Release if: ${{ steps.script.outputs.found_new == 'true'}} uses: softprops/action-gh-release@v1 with: name: v${{ steps.script.outputs.new_ver }} tag_name: ${{ steps.script.outputs.new_ver }} draft: false files: | ${{ steps.script.outputs.new_ver }}.apk body: | 禁漫APP v${{ steps.script.outputs.new_ver }} 你可以直接下载Assets的`${{ steps.script.outputs.new_ver }}.apk`使用,或者从禁漫官网下载: 禁漫官网的`${{ steps.script.outputs.new_ver }}.apk`下载链接: 1. [${{ steps.script.outputs.download_path1 }}](${{ steps.script.outputs.download_path1 }}) 2. [${{ steps.script.outputs.download_path2 }}](${{ steps.script.outputs.download_path2 }}) 3. [https://18comic.vip/stray](https://18comic.vip/stray/)(发布页) `${{ steps.script.outputs.new_ver }}.apk`的更新信息: > ${{ steps.script.outputs.desc }} - name: Commit if: ${{ steps.script.outputs.found_new == 'true'}} run: | # Extract the version number from the previous step version=${{ steps.script.outputs.new_ver }} git config --global user.email "93357912+hect0x7@users.noreply.github.com" git config --global user.name "hect0x7" git tag -a "v$version" -m "Version $version" git add ./APK_VERSION.txt git commit -m "update APK_VERSION.txt" git push echo "finished" ================================================ FILE: APK_VERSION.txt ================================================ 2.0.18 ================================================ FILE: README.md ================================================

JMComic-APK

基于jmcomic库自动检查禁漫APK更新

[![GitHub](https://img.shields.io/badge/-GitHub-181717?logo=github)](https://github.com/hect0x7) [![GitHub all download](https://img.shields.io/github/downloads/hect0x7/JMComic-APK/total?color=orange&label=github%20downloads)](https://github.com/hect0x7/JMComic-APK/releases/latest) [![GitHub latest releases](https://img.shields.io/github/v/release/hect0x7/JMComic-APK?color=blue&label=release)](https://github.com/hect0x7/JMComic-APK/releases/latest)
![一图流](images/introduction.jpg) ## 项目介绍 使用GitHub Actions定时检查禁漫APK是否有更新,如果有,就下载一份保存到Release中。 [✨✨✨点我去APK下载界面✨✨✨](https://github.com/hect0x7/JMComic-APK/releases/latest) ## Star历史图 Star History Chart ## 相关项目推荐 本项目的代码基于[`jmcomic`](https://github.com/hect0x7/JMComic-Crawler-Python)库,这是我写的一个pip库,支持用python代码访问禁漫天堂。 > 引流:[jmcomic](https://github.com/hect0x7/JMComic-Crawler-Python) 还可以帮你一键批量下载禁漫本子 Repo Card --- 此外,如果你需要**离线浏览已下载的本子**,可以使用 [`plugin-jm-server`](https://github.com/hect0x7/plugin-jm-server)。 > [**plugin-jm-server**](https://github.com/hect0x7/plugin-jm-server) 是一个“离线版”禁漫天堂文件服务器,支持在浏览器中查看本地文件夹内的图片。该项目界面模仿禁漫章节的下拉式观看页面,并适配了手机端。 Repo Card --- 如果你希望**通过自然语言与 AI 交互来找本、看本**,那么 [`jmcomic-ai`](https://github.com/hect0x7/jmcomic-ai) 是你的不二之选。 > [jmcomic-ai](https://github.com/hect0x7/jmcomic-ai) 通过 MCP 和 Skills 将 `jmcomic` 的搜索、下载、排行榜等核心能力注入到你的 AI Agent(如 Cursor, Claude Desktop 等)中。现在你只需对 AI 说出“帮我找找主角是电锯人的漫画”或“下载搜索结果中浏览量前三的作品”,AI 就会自动为你执行复杂的爬虫任务。 Repo Card ================================================ FILE: main.py ================================================ import json import os import re from jmcomic import create_option, JmHtmlClient, JmApiClient, \ PatternTool, file_exists, write_text, read_text, \ save_resp_content, JmModuleConfig, JmcomicText, jm_log apk_version_txt = './APK_VERSION.txt' is_dev: bool = file_exists('.idea') cur_ver: str = read_text(apk_version_txt).strip() JmModuleConfig.FLAG_API_CLIENT_REQUIRE_COOKIES = False op = create_option('op.yml') html_cl: JmHtmlClient = op.new_jm_client(impl='html') api_cl: JmApiClient = op.new_jm_client(impl='api') def compare_versions(v1: str, v2: str) -> int: parts1 = list(map(int, v1.split("."))) parts2 = list(map(int, v2.split("."))) # 补齐长度 length = max(len(parts1), len(parts2)) parts1 += [0] * (length - len(parts1)) parts2 += [0] * (length - len(parts2)) if parts1 > parts2: return 1 # v1 大 elif parts1 < parts2: return -1 # v2 大 else: return 0 # 相等 def add_output(k, v): cmd = f'echo "{k}={v}" >> $GITHUB_OUTPUT' if is_dev: print(cmd) return print(f'{cmd}: {os.system(cmd)}') def download_new_ver(new_ver, download_path): resp = html_cl.get(download_path) save_resp_content(resp, f'./{new_ver}.apk') write_text(apk_version_txt, new_ver) def check_apk(): # new_ver, download_path = fetch_apk_ver_and_download_path() new_ver, download_path, desc = fetch_apk_info_via_api() add_output('new_ver', new_ver) if compare_versions(new_ver, cur_ver) < 1: add_output('found_new', 'false') return add_output('found_new', 'true') add_output('download_path1', f'{JmModuleConfig.PROT}18comic.vip{download_path}') add_output('download_path2', f'{JmModuleConfig.PROT}jmcomic.me{download_path}') add_output('desc', desc.replace('\r\n', '\n').replace('\n', '

')) download_new_ver(new_ver, download_path) def fetch_apk_info_via_html(): resp = html_cl.get_jm_html('/stray/?utm_source=18comic') apk_version_pattern = re.compile(r'a href="(/static/apk/(.*?).apk)"') match = PatternTool.require_match(resp.text, apk_version_pattern, '未匹配上apk下载路径', None) download_path, new_ver = match[1], match[2] return new_ver, download_path def get_download_path(url): try: domain = JmcomicText.parse_to_jm_domain(url) return url.replace(JmModuleConfig.PROT, '').replace(domain, '') except Exception as e: jm_log('get_download_path', f'{e}: [{url}]') return url.replace(JmModuleConfig.PROT, '') def fetch_apk_info_via_api(): resp = api_cl.setting() jm_log('apk.setting', json.dumps(resp.res_data, indent=2, ensure_ascii=False)) data = resp.model_data version = data.jm3_version return version, get_download_path(data.jm3_download_url), data.jm3_version_info if __name__ == '__main__': check_apk() ================================================ FILE: op.yml ================================================ client: domain: html: [ jmcomic1.me, jmcomic.me ] ================================================ FILE: requirements.txt ================================================ jmcomic