Instagram-Reels-Scraper-Auto-Poster 项目教程
1. 项目的目录结构及介绍
Instagram-Reels-Scraper-Auto-Poster/
├── database/
├── downloads/
├── images/
├── src/
│ ├── app.py
│ ├── start.py
│ ├── config.py
│ ├── dashboard.py
│ └── ...
├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
└── requirements.txt
目录结构介绍
- database/: 存储项目的数据库文件。
- downloads/: 存储从Instagram和YouTube抓取的Reels和Shorts视频。
- images/: 存储项目相关的图片文件。
- src/: 项目的主要源代码目录,包含主要的Python脚本和配置文件。
- app.py: 项目的核心脚本,负责抓取和发布Reels和Shorts。
- start.py: 启动脚本,用于初始化配置。
- config.py: 配置文件,存储项目的配置参数。
- dashboard.py: 实时监控仪表板的脚本。
- .gitignore: Git忽略文件,指定哪些文件和目录不需要被Git管理。
- CODE_OF_CONDUCT.md: 项目的行为准则。
- CONTRIBUTING.md: 贡献指南,指导开发者如何为项目贡献代码。
- LICENSE: 项目的开源许可证文件。
- README.md: 项目的介绍和使用说明。
- SECURITY.md: 项目的安全指南。
- requirements.txt: 项目依赖的Python库列表。
2. 项目的启动文件介绍
start.py
start.py
是项目的启动脚本,用于初始化配置。运行该脚本后,会启动一个配置向导,引导用户设置Instagram账号、YouTube API密钥等配置参数。
python start.py
app.py
app.py
是项目的核心脚本,负责抓取Instagram Reels和YouTube Shorts,并将它们自动发布到用户的Instagram账号上。
python app.py
dashboard.py
dashboard.py
是实时监控仪表板的脚本,用于查看项目的运行状态和发布日志。
python dashboard.py
3. 项目的配置文件介绍
config.py
config.py
是项目的配置文件,存储了项目的所有配置参数。以下是一些关键配置项的介绍:
- INSTAGRAM_USERNAME: Instagram账号的用户名。
- INSTAGRAM_PASSWORD: Instagram账号的密码。
- YOUTUBE_API_KEY: YouTube Data API的API密钥。
- SCRAPER_INTERVAL_IN_MIN: 抓取Reels和Shorts的时间间隔(分钟)。
- POSTING_INTERVAL_IN_MIN: 发布Reels和Shorts的时间间隔(分钟)。
配置文件示例:
INSTAGRAM_USERNAME = "your_instagram_username"
INSTAGRAM_PASSWORD = "your_instagram_password"
YOUTUBE_API_KEY = "your_youtube_api_key"
SCRAPER_INTERVAL_IN_MIN = 60
POSTING_INTERVAL_IN_MIN = 120
通过修改 config.py
文件中的配置项,可以自定义项目的运行参数。