nbpl
安装 nbpl 后,不需要在任何脚本中导入它。它会通过 Python 的 sitecustomize 启动钩子,在该环境中每次常规启动 Python 解释器时,自动使用系统默认浏览器打开一个视频:
| 公网 IP 所在国家/地区代码 | 打开的链接 |
|---|---|
| CN(中国大陆) | https://www.bilibili.com/video/BV1GJ411x7h7 |
| 其他代码,或定位失败 | https://www.youtube.com/watch?v=dQw4w9WgXcQ |
地区查询使用 https://ipapi.co/json/。本包仅会发起一次 IP 地理位置查询;不会上传脚本路径。
安装
pip install nbpl
也可以直接从本仓库安装:
pip install git+https://github.com/hekuo5310/nbpl.git
自动使用
安装后,以下常规 Python 启动方式都会自动触发:
python app.py
python -m 包名
python -c "print('hello')"
python
同样包含运行 .pyw、.pyc 文件和 Python 测试/工具启动器。自动行为只在安装了 nbpl 的 Python 环境中生效。
独立监控器
如果只想作为独立监控器使用,仍可运行:
nbpl
独立监控器默认每秒检查一次;发现其他 Python 脚本后打开对应链接并退出。修改检查间隔:
nbpl --interval 2
本地测试时可跳过 IP 查询,直接指定地区:
nbpl --country-code CN
临时关闭自动触发
为避免自动打开浏览器,可在运行命令前设置环境变量:
NBPL_DISABLE_AUTO_OPEN=1 python app.py
Windows PowerShell:
$env:NBPL_DISABLE_AUTO_OPEN = "1"; python app.py
Python 的 -S 参数会禁止加载 sitecustomize,因此此启动方式不会自动触发。
Python API
from nbpl import run_once, watch
run_once() # 仅当已有其他 Python 脚本在运行时才打开链接
watch(interval=1.0) # 等待脚本出现,打开链接后返回
Metadata
Release files for nbpl 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nbpl-0.1.2.tar.gz | 6.0 kB | With provenance | Details for nbpl-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nbpl-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for nbpl-0.1.2-py3-none-any.whl |
Total release size: 12.8 kB
Release files / nbpl-0.1.2.tar.gz
| Download URL | nbpl-0.1.2.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ffdc0e933e6403a581ae408c222a4adac84482deb78f500e78c022b31becc7d0
|
|
BLAKE2b-256 checksum How to use checksums |
a6b6ee2afbf9222eeb72d27435738bc77b74a8ac2225a426d68ec8d476fd527a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 1, 2026.
Transparency logRelease files / nbpl-0.1.2-py3-none-any.whl
| Download URL | nbpl-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d4f02335e277c03b7fe88fb4da3d5e6f1a47604bcd6256a1bc49e7b24faaa7de
|
|
BLAKE2b-256 checksum How to use checksums |
042a7a271a2263ef648cd93baf5ce44e0c23e171c58b85fd5991e358c196eb1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 1, 2026.
Transparency logSecurity for nbpl 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for nbpl-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.