Download init_headers.py from z011/yldj_main: direct link, hf CLI and curl.
- Browser
- Download file 814 Bytes
-
https://huggingface.co/spaces/z011/yldj_main/resolve/main/init_headers.py
- Command line
-
hf download hf://spaces/z011/yldj_main/init_headers.py
-
curl -L -o init_headers.py https://huggingface.co/spaces/z011/yldj_main/resolve/main/init_headers.py
814 Bytes
| """ | |
| 生成 headers_config.json 配置文件 | |
| 从 crawler.py 中提取 Headers | |
| """ | |
| import sys | |
| import json | |
| # 导入爬虫类 | |
| from crawler import YoulindaojiaCrawler | |
| def main(): | |
| print("正在从 crawler.py 提取 Headers...") | |
| crawler = YoulindaojiaCrawler() | |
| # 保存到配置文件 | |
| with open('headers_config.json', 'w', encoding='utf-8') as f: | |
| json.dump(crawler.headers, f, ensure_ascii=False, indent=2) | |
| print("[OK] Headers 已保存到 headers_config.json") | |
| print("\n配置内容预览:") | |
| print(f" - Token: {crawler.headers.get('token', 'N/A')[:20]}...") | |
| print(f" - Longitude: {crawler.headers.get('longitude', 'N/A')}") | |
| print(f" - Latitude: {crawler.headers.get('latitude', 'N/A')}") | |
| if __name__ == "__main__": | |
| main() | |