All Projects → hezhizheng → go-movies

hezhizheng / go-movies

Licence: MIT license
golang spider Crawler 爬虫 电影

Programming Languages

go
31211 projects - #10 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to go-movies

gospider
⚡ Light weight Golang spider framework | 轻量的 Golang 爬虫框架
Stars: ✭ 183 (+8.93%)
Mutual labels:  spider, colly
Animesearcher
整合第三方网站的视频和弹幕资源, 为白嫖党提供最佳看番追剧体验
Stars: ✭ 101 (-39.88%)
Mutual labels:  movies, spider
scripter
一些脚本和工具
Stars: ✭ 20 (-88.1%)
Mutual labels:  spider
crawler
一个php爬虫
Stars: ✭ 13 (-92.26%)
Mutual labels:  spider
ICP-Checker
ICP备案查询,可查询企业或域名的ICP备案信息,自动完成滑动验证,保存结果到Excel表格,适用于2022年新版的工信部备案管理系统网站,告别频繁拖动验证,以及某站*工具要开通VIP才可查看备案信息的坑
Stars: ✭ 119 (-29.17%)
Mutual labels:  spider
yutto
🧊 一个可爱且任性的 B 站视频下载器(bilili V2)
Stars: ✭ 383 (+127.98%)
Mutual labels:  spider
NScrapy
NScrapy is a .net core corss platform Distributed Spider Framework which provide an easy way to write your own Spider
Stars: ✭ 88 (-47.62%)
Mutual labels:  spider
get LibSeat
利昂图书馆预约系统自动预约&签到程序。支持包括中国人民大学、北京师范大学、济南大学、哈尔滨工业大学等在内的38所高校的图书馆系统
Stars: ✭ 39 (-76.79%)
Mutual labels:  spider
Sina Spider
新浪爬虫,基于Python+Selenium。模拟登陆后保存cookie,实现登录状态的保存。可以通过输入关键词来爬取到关键词相关的热门微博。
Stars: ✭ 25 (-85.12%)
Mutual labels:  spider
goroutine-pool
A simple goroutine pool which can create and release goroutine dynamically, inspired by fasthttp.
Stars: ✭ 31 (-81.55%)
Mutual labels:  fasthttp
devsearch
A web search engine built with Python which uses TF-IDF and PageRank to sort search results.
Stars: ✭ 52 (-69.05%)
Mutual labels:  spider
robotstxt
robots.txt file parsing and checking for R
Stars: ✭ 65 (-61.31%)
Mutual labels:  spider
zhihu-crawler
徒手实现定时爬取知乎,从中发掘有价值的信息,并可视化爬取的数据作网页展示。
Stars: ✭ 56 (-66.67%)
Mutual labels:  spider
tmdb
A GraphQL Wrapper for The Movie Database
Stars: ✭ 16 (-90.48%)
Mutual labels:  movies
job-spider
多线程爬取互联网行业常用招聘网站
Stars: ✭ 28 (-83.33%)
Mutual labels:  spider
weibo topic
微博话题关键词,个人微博采集, 微博博文一键删除 selenium获取cookie,requests处理
Stars: ✭ 28 (-83.33%)
Mutual labels:  spider
fastglue
Fastglue is an opinionated, bare bones wrapper that glues together fasthttp and fasthttprouter to act as a micro HTTP framework.
Stars: ✭ 71 (-57.74%)
Mutual labels:  fasthttp
docker-spotweb
Dockerfile to set up Spotweb on ARM (like Raspberry Pi 2/3) and X86 based systems based on Alpine Linux
Stars: ✭ 22 (-86.9%)
Mutual labels:  movies
heartbeat
A service to keep a live heartbeat (ping) on multiple devices
Stars: ✭ 27 (-83.93%)
Mutual labels:  fasthttp
orgmdb.el
An Emacs/org-mode watchlist manager and OMDb API client
Stars: ✭ 17 (-89.88%)
Mutual labels:  movies

golang + redis 实现的影站(低级爬虫)。无管理后台,效果站:http://film.hzz.cool 支持手机端访问播放

Github地址

https://github.com/hezhizheng/go-movies

features

  • 使用 Golang 1.16 embed 内嵌静态资源(html、js、css等),运行只依赖编译后可执行的二进制文件与redis
  • 支持docker启动方式
  • 简单资源分类、搜索的支持
  • 内置自动爬虫、自动更新最新资源的定时任务,基本满足日常看片需求。
  • 钉钉机器人通知

Tip

  • 暂时只维护API请求版本 API接口说明.txt,后续可能追加其他资源支持
  • API版本首次启动会全量请求并存储到redis,之后每小时定时爬取最近更新的影视资源

目录结构

|-- Dockerfile
|-- LICENSE.txt
|-- config
|   |-- app.go
|   `-- app.go.backup                        #程序配置文件
|-- controller                               #controller层,基本的页面渲染
|   |-- DebugController.go
|   |-- IndexController.go
|   `-- SpiderController.go
|-- docker-compose.yml
|-- go.mod
|-- go.sum
|-- main.go
|-- models                                   # 定义一些redis查询的方法
|   |-- Category.go
|   |-- Movies.go
|   `-- readme.md
|-- readme.md
|-- routes
|   `-- route.go
|-- runner.conf                              # fresh 配置文件
|-- services                                 # 普通业务处理类
|   |-- CategoryService.go
|   |-- MoviesService.go
|   `-- readme.md
|-- static2                                  # js、css、image等静态资源文件夹
|-- utils                                    # 一些工具类
|   |-- Cron.go
|   |-- Dingrobot.go
|   |-- Helper.go
|   |-- JsonUtil.go
|   |-- Pagination.go
|   |-- RedisUtil.go
|   |-- Spider.go
|   |-- SpiderTask.go
|   `-- spider                               # 爬虫api版主要功能代码
|       |-- SpiderTaskPolicy.go
|       `-- tian_kong
|           |-- CategoriesStr.go
|           `-- SpiderApi.go
`-- views                                    # html模板目录
    `-- tmpl
        `-- temp_global_var.go               # 定义 embed 的全局变量跟一些模板调用的函数

首页效果

使用安装 (go version >= 1.18)

# 下载
git clone https://github.com/hezhizheng/go-movies

# 进入目录
cd go-movies

# 配置文件(默认使用redis db10的库,可自行修改app.go中的配置)
cp ./config/app.go.backup ./config/app.go

# 配置说明
app.spider_path: 爬虫路由
app.spider_path_name: 爬虫路由名称
app.debug_path: debug的路由
app.debug_path_name: debug的路由名称
cron.timing_spider: 定时爬虫的CRON表达式
ding.access_token: 钉钉机器人token
app.spider_mod: 固定参数为 TianKongApi
app.spider_mod: 开发模式建议设置为`true` 避免修改静态资源需要重启服务

# 启动 (首次启动会自动开启爬虫任务)
go run main.go 
or
# 安装 fresh 工具
fresh

# 如安装依赖包失败,请使用代理
export GOPROXY=https://goproxy.io,direct
or
export GOPROXY=https://goproxy.cn,direct

访问
http://127.0.0.1:8899

开启爬虫

  • 已内置定时爬虫,首次全量请求之后,每小时定时爬取最近更新的影视资源(可自行修改配置文件cron.timing_spider表达式来控制间隔)
  • 主动运行:直接访问链接 http://127.0.0.1:8899/movies-spider
  • 耗时:具体时间受目标网站/接口的响应速度影响

Tools

编译可执行文件(跨平台)

# 用法参考 https://github.com/mitchellh/gox
# 生成文件可直接执行 
gox -osarch="windows/amd64" -ldflags "-s -w" -gcflags="all=-trimpath=${PWD}" -asmflags="all=-trimpath=${PWD}"
gox -osarch="darwin/amd64" -ldflags "-s -w" -gcflags="all=-trimpath=${PWD}" -asmflags="all=-trimpath=${PWD}"
gox -osarch="linux/amd64" -ldflags "-s -w" -gcflags="all=-trimpath=${PWD}" -asmflags="all=-trimpath=${PWD}"
  • 提供win64的已编译的文件下载 release

使用请确保redis为开启状态,默认使用 DB10,启动成功之后会自动执行爬虫,可自行访问 http://127.0.0.1:8899/movies-spider 进行爬虫

img

Docker 部署(使用docker-compose可直接忽略该步骤)

# 安装 redis 镜像(已有可以忽略) 
sudo docker pull redis:latest

# 启动redis容器
# 根据实际情况分配端口 -p 宿主机端口:容器端口
sudo docker run -itd --name redis-test -p 6379:6379 redis

# 修改 app.go 的redis 连接地址为容器名称
"addr":"redis-test"

# 编译go-movies
gox -osarch="linux/amd64" -ldflags "-s -w" -gcflags="all=-trimpath=${PWD}" -asmflags="all=-trimpath=${PWD}"

# 构造镜像
sudo docker build -t go-movies-docker-scratch .

# 启动容器
sudo docker run --link redis-test:redis -p 8899:8899 -d go-movies-docker-scratch

docker-compose 一键启动

# 修改 app.go 的redis 连接地址为容器名称,这里需要跟docker-compose.yml中保持一致
"addr":"redis-test"

# 编译go-movies
gox -osarch="linux/amd64" -ldflags "-s -w"

# 运行
sudo docker-compose up -d

打开游览器访问 http://127.0.0.1:8899 即可看见网站效果

TODO

Other

许多Go的原理还没弄懂,有精力会慢慢深究下。写得很潦草,多多包涵。

🔋 JetBrains 开源证书支持

go-movies 项目一直以来都是在 JetBrains 公司旗下的 GoLand 集成开发环境中进行开发,基于 free JetBrains Open Source license(s) 正版免费授权,在此表达我的谢意。

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].