投流数据文章相关服务开发

luojunhui 03a850644b 离线推荐优化 5 дней назад
app 03a850644b 离线推荐优化 5 дней назад
dev d67cbbae31 新增抓公众号粉丝 1 месяц назад
.gitignore acdbcc9923 修改 gitee 3 месяцев назад
Dockerfile 2c8cb2c7f7 配置-Dockerfile-for-jenkins 1 месяц назад
LICENSE d3cfb36cda Initial commit 1 год назад
README.md 9e4d035fe4 架构优化 1 месяц назад
app_config.toml ab544aa882 修改优雅退出时间 1 месяц назад
docker-compose.yaml 2c8cb2c7f7 配置-Dockerfile-for-jenkins 1 месяц назад
jenkins_bash.sh 3e28486cb9 更新 jenkins_bash.sh 1 месяц назад
requirements.txt ea8535f880 新增相同图片 oss_key合并 1 неделя назад
task_app.py 56d616c6fc 架构优化 1 месяц назад

README.md

LongArticleTaskServer

description: a server for long_articles project experiments and tasks

启动服务

use hypercorn

hypercorn task_app:app --config app_config.toml

use docker

docker compose up -d

项目结构

.
├── Dockerfile
├── LICENSE
├── README.md
├── app
│   ├── ab_test
│   │   ├── __init__.py
│   │   ├── ab_accounts.py
│   │   └── get_cover.py
│   ├── api
│   │   ├── middleware
│   │   │   ├── auth.py
│   │   │   ├── error_handler.py
│   │   │   └── rate_limiter.py
│   │   ├── service
│   │   │   ├── __init__.py
│   │   │   ├── gzh_cookie_manager.py
│   │   │   ├── task_manager_service.py
│   │   │   └── task_scheduler.py
│   │   └── v1
│   │       ├── __init__.py
│   │       └── routes.py
│   ├── core
│   │   ├── bootstrap
│   │   │   ├── __init__.py
│   │   │   └── resource_manager.py
│   │   ├── config
│   │   │   ├── __init__.py
│   │   │   ├── cert
│   │   │   │   └── es_certs.crt
│   │   │   ├── global_settings.py
│   │   │   └── settings
│   │   │       ├── __init__.py
│   │   │       ├── aliyun.py
│   │   │       ├── apollo.py
│   │   │       ├── category.py
│   │   │       ├── cold_start.py
│   │   │       ├── deepseek.py
│   │   │       ├── elasticsearch.py
│   │   │       ├── mysql.py
│   │   │       └── task_chinese_name.py
│   │   ├── database
│   │   │   ├── __init__.py
│   │   │   └── mysql_pools.py
│   │   ├── dependency
│   │   │   ├── __init__.py
│   │   │   └── dependencies.py
│   │   ├── observability
│   │   │   ├── __init__.py
│   │   │   ├── logging
│   │   │   │   ├── __init__.py
│   │   │   │   └── log_service.py
│   │   │   └── tracing
│   │   └── pipeline
│   │       ├── __init__.py
│   │       ├── crawler_pipeline.py
│   │       ├── data_recycle_pipeline.py
│   │       └── schemas.py
│   ├── domains
│   │   ├── algorithm_tasks
│   │   │   ├── __init__.py
│   │   │   ├── account_category_analysis.py
│   │   │   └── models.py
│   │   ├── analysis_task
│   │   │   ├── __init__.py
│   │   │   ├── account_position_info.py
│   │   │   └── crawler_detail.py
│   │   ├── cold_start_tasks
│   │   │   ├── __init__.py
│   │   │   ├── article_pool
│   │   │   │   ├── __init__.py
│   │   │   │   ├── article_pool_cold_start_const.py
│   │   │   │   ├── article_pool_cold_start_strategy.py
│   │   │   │   └── article_pool_filter_strategy.py
│   │   │   ├── article_pool_cold_start.py
│   │   │   ├── video_pool
│   │   │   │   ├── __init__.py
│   │   │   │   ├── video_pool_audit_strategy.py
│   │   │   │   └── video_pool_const.py
│   │   │   └── video_pool_cold_start.py
│   │   ├── crawler_tasks
│   │   │   ├── __init__.py
│   │   │   ├── crawler_account_manager.py
│   │   │   ├── crawler_gzh.py
│   │   │   ├── crawler_gzh_fans.py
│   │   │   └── crawler_toutiao.py
│   │   ├── data_recycle_tasks
│   │   │   ├── __init__.py
│   │   │   ├── article_detail_stat.py
│   │   │   ├── recycle_daily_publish_articles.py
│   │   │   ├── recycle_mini_program_detail.py
│   │   │   └── recycle_outside_account_articles.py
│   │   ├── llm_tasks
│   │   │   ├── __init__.py
│   │   │   ├── candidate_account_process.py
│   │   │   ├── process_title.py
│   │   │   └── prompts.py
│   │   └── monitor_tasks
│   │       ├── __init__.py
│   │       ├── auto_reply_cards_monitor.py
│   │       ├── cooperate_accounts_monitor.py
│   │       ├── get_off_videos.py
│   │       ├── gzh_article_monitor.py
│   │       ├── kimi_balance.py
│   │       ├── limited_account_analysis.py
│   │       └── task_processing_monitor.py
│   ├── infra
│   │   ├── crawler
│   │   │   ├── __init__.py
│   │   │   ├── tophub
│   │   │   ├── toutiao
│   │   │   │   ├── __init__.py
│   │   │   │   ├── blogger.py
│   │   │   │   ├── detail_recommend.py
│   │   │   │   ├── main_page_recomend.py
│   │   │   │   ├── search.py
│   │   │   │   ├── toutiao.js
│   │   │   │   └── use_js.py
│   │   │   └── wechat
│   │   │       ├── __init__.py
│   │   │       ├── gzh_article_stat.py
│   │   │       ├── gzh_fans.py
│   │   │       └── gzh_spider.py
│   │   ├── external
│   │   │   ├── __init__.py
│   │   │   ├── aliyun.py
│   │   │   ├── apollo.py
│   │   │   ├── deepseek_official.py
│   │   │   ├── elastic_search.py
│   │   │   └── feishu.py
│   │   ├── internal
│   │   │   ├── __init__.py
│   │   │   ├── aigc_system.py
│   │   │   ├── long_articles.py
│   │   │   └── piaoquan.py
│   │   ├── shared
│   │   │   ├── __init__.py
│   │   │   ├── async_tasks.py
│   │   │   ├── http_client.py
│   │   │   └── tools.py
│   │   └── utils
│   │       ├── __init__.py
│   │       ├── get_cover.py
│   │       └── response.py
│   └── jobs
│       ├── task_config.py
│       ├── task_handler.py
│       ├── task_mapper.py
│       └── task_utils.py
├── app_config.toml
├── docker-compose.yaml
├── jenkins_bash.sh
├── requirements.txt
└── task_app.py

get code strategy

tree -I "__pycache__|*.pyc"

1. 数据任务

daily发文数据回收

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "daily_publish_articles_recycle"}'

daily发文更新root_source_id

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "update_root_source_id"}'

账号质量处理

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "candidate_account_quality_analysis"}'

2. 抓取任务

今日头条账号内文章抓取

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "crawler_toutiao"}'

今日头条推荐抓取文章

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "crawler_toutiao", "method": "recommend"}'

今日头条搜索抓取账号

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "crawler_toutiao", "method": "search"}'

抓取账号管理(微信)

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "crawler_account_manager", "platform": "weixin"}'

抓取微信文章(抓账号模式)

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "crawler_gzh_articles", "account_method": "account_association", "crawl_mode": "account"}'

抓取微信文章(搜索模式)

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "crawler_gzh_articles", "account_method": "search", "crawl_mode": "search"}'

3. 冷启动发布任务

发布头条文章

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "article_pool_cold_start", "platform": "toutiao", "crawler_methods": ["toutiao_account_association"]}'

发布公众号文章

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "article_pool_cold_start"}'

4. 其他

校验kimi余额

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "check_kimi_balance"}'

自动下架视频

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "get_off_videos"}'

校验视频可见状态

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "check_publish_video_audit_status"}'

外部服务号监测

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "outside_article_monitor"}'

站内服务号发文监测

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "inner_article_monitor"}'

标题重写

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "title_rewrite"}'

为标题增加品类(文章池)

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "article_pool_category_generation", "limit": "1000"}'

候选账号质量分析

curl -X POST http://192.168.142.66:6060/api/run_task -H "Content-Type: application/json" -d '{"task_name": "candidate_account_quality_analysis"}'