xhboke/douban
Composer 安装命令:
composer create-project xhboke/douban
包简介
the api of douban movie
README 文档
README
安装说明
- Python
pip install doubanlib
from doubanlib.movies import DouBan
from doubanlib.movies import MovieInfo
# Set the headers
headers = {'User-Agent': 'Hello'}
DouBan.set_headers(headers=headers)
# You can also set the optional proxy
# DouBan.set_proxy(proxy={'http': '203.89.126.250:80'})
# Doctor Strange in the Multiverse of Madness which id is 30304994(https://movie.douban.com/subject/30304994)
obj = MovieInfo(30304994)
# Print the description of the movie
print('Description:{}'.format(obj.description))
# Print all the information of the movie.
print(
'ID:{}\nName:{}\nChinese_Name:{}\nYear:{}\nGenre:{}\nRegions:{}\nLanguage:{}\nRating:{}\nVotes:{}\nLength_Movie:{}\nDirectors:{}\nAlias:{}\nImage:{}\nDate_Published:{}\nActors:{}\nDescription:{}'
.format(obj.m_id, obj.name, obj.chineseName, obj.year, obj.genre,
obj.regions, obj.languages, obj.rating, obj.votes, obj.length_movie,
obj.directors, obj.alias, obj.image, obj.pubDate, obj.actors,
obj.actors, obj.description))
- PHP 本地测试
下载代码
git clone https://github.com/xhboke/douban.git
启动服务
php think run
然后就可以在浏览器中访问
http://localhost:8000
- PHP 服务器
上传代码,设置 public 为运行目录,设置伪静态
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
同时关闭调试模式 /config/app.php : 'app_debug' => true ==> 'app_debug' => false
注意
频繁使用会导致封禁IP,目前可通过更换IP或者使用代理或者是登录获取Cookie的方式避免。
使用方法
上方为豆瓣的链接,下方是API的链接,大致相同,涉及页数的有变化,最后请不要加上‘/’
一、电影信息
电影基本信息
https://movie.douban.com/subject/25845392/
http://127.0.0.1:8000/subject/25845392
电影短评
https://movie.douban.com/subject/25845392/comments?status=P
http://127.0.0.1:8000/subject/25845392/comments?page=0&sort=new_score
电影短评
https://movie.douban.com/subject/25845392/reviews?&start=0&sort=hotest
http://127.0.0.1:8000/subject/25845392/reviews?page=0&sort=hotest
电影参演人员
https://movie.douban.com/subject/25845392/celebrities
http://127.0.0.1:8000/subject/25845392/celebrities
影片图片
https://movie.douban.com/subject/25845392/all_photos
http://127.0.0.1:8000/subject/25845392/all_photos
影片图片
https://movie.douban.com/subject/25845392/photos?type=S
http://127.0.0.1:8000/subject/25845392/photos?type=S
二、影片搜索
关键词
http://127.0.0.1:8000/search/key/长津湖
搜索影片
https://search.douban.com/movie/subject_search?search_text=长&cat=1002&start=0
http://127.0.0.1:8000/search/长/0
三、分类影片
分类影片
http://127.0.0.1:8000/tag?tags=电影,剧情,中国大陆,2021&page=0&sort=U
四、人物信息
人物基本信息
https://movie.douban.com/celebrity/1023040
http://127.0.0.1:8000/celebrity/1023040
人物图片
https://movie.douban.com/celebrity/1023040/photos/?type=C&start=0&sortby=like&size=a&subtype=a
http://127.0.0.1:8000/celebrity/1023040/photos?page=0&sort=like
单张图片
https://movie.douban.com/celebrity/1023040/photo/1247932516
http://127.0.0.1:8000/celebrity/1023040/photo/1247932516
人物获奖
https://movie.douban.com/celebrity/1023040/awards
http://127.0.0.1:8000/celebrity/1023040/awards
人物参演
https://movie.douban.com/celebrity/1023040/movies?start=0&format=pic&sortby=time
http://127.0.0.1:8000/celebrity/1023040/movies?page=0&sort=time
人物合作
https://movie.douban.com/celebrity/1023040/movies?start=0&format=pic&sortby=time
http://127.0.0.1:8000/celebrity/1023040/partners?page=0
五、图片信息
图片基本信息及评论
https://movie.douban.com/photos/photo/2673813691/
http://127.0.0.1:8000/photos/photo/2673813691
六、豆瓣250
https://movie.douban.com/top250?start=25&filter=
http://127.0.0.1:8000/top250?page=0
声明
本项目仅供学习交流,禁止用于非法用途。
xhboke/douban 适用场景与选型建议
xhboke/douban 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 112, 最近一次更新时间为 2021 年 10 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「douban」 「movie」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 xhboke/douban 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 xhboke/douban 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 xhboke/douban 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
IMDB API that can fetch film data and search results
A PSR-7 compatible library for making CRUD API endpoints
An example project using a multi layer feed forward neural network for text sentiment classification trained with 25,000 movie reviews from IMDB.
Library for parsing metadata information about movies and TV shows from Douban Movie
PHP wrapper for TMDB (TheMovieDatabase) API v3. Supports two types of approaches, one modelled with repositories, models and factories. And the other by simple array access to RAW data from The Movie Database.
This is a fork of the package php-tmdb/laravel. Instead of waiting for the maintainer to update the php-tmdb/api package to reflect the latest changes from the API, I've decided to fix these. These packages are actively used for http://flixi.com, which means these we will be most likely maintaining
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 112
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-16