Code Monkey home page Code Monkey logo

bangumi_yearly_report's Introduction

根据Bangumi的时光机数据生成年鉴。

用法

usage: bangumi_report.py [-h] -u USER_ID [-m MAX_CONN] [-y YEAR] [-t TYPE] [-d] [--version] [-s] [-md]

-u/--user_id:指定要抓取的用户ID
-m/--max_conn:最大下载线程数
-y/--year:要生成的年份,默认为2017年。设为all将会生成所有年份
-t/--type:要抓取的的数据类型,默认为anime
-s/--saveimg: 下载图片至本地
-q/--quiet:不产生任何日志
-o/--stdout:生成的HTML将不会写入文件而是输出到stdout
-md/--markdown:生成Markdown文件,不包含图片

输出文件为HTML或MD文件不会写前端,太丑不用在意。文件名:[user_id]-[year]-[type]-report.[html|md]

Demo (HTML)

2017年

All

Sample (Markdown)

2017年

All

依赖

  • Requests
  • Jinja2 (只生成Markdown自动忽略此依赖)

Go Server

用刚学了两天的Go写了一个简单的HTTP server,这个脚本终于有在线版本了。但是实际上还是运行了Python脚本来生成的。

本来是想用BGM新增加的官方API来用Go把这个脚本重写一遍,结果发现官方API没有获取全部列表的功能,只能继续用原来的脚本了。我在Go server里面都实现好了OAuth Callback和简单的数据库了发现没有卵用,以备后用还是留着吧😂。

地址:http://bgm.xiadong.info/report/[username]

bangumi_yearly_report's People

Contributors

crazyokd avatar fireattack avatar kakinumacn avatar mtc2000 avatar shell32-natsu avatar timrockefeller avatar yinr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bangumi_yearly_report's Issues

评分显示更新

<span class="sstars(.*?) starsinfo"></span> => <span class="starlight stars(\d+?)"></span>

18x条目缺失cover img

如果用户的记录为非登录可见的18x条目时,img会被替换为 no_icon_subject.png。但实际对应bgm条目实际存在封面图

image

我看了代码,之前是走API 来获取,但是目前现在api同样不再返回对应图片信息

# The image is not shown to guest. Use API to get it
if large_image_url.startswith('/img/'):
item_id = item[1].split('/')[-1]
large_image_url = self.get_missed_image(item_id)

def get_missed_image (self, item_id):
bgm_api_prefix = 'http://api.bgm.tv'
item_url = bgm_api_prefix + '/subject/' + item_id
default_ret = '//bgm.tv/img/no_icon_subject.png'
response = self.session.get(item_url)
if response.status_code != 200:
logging.error('\nURL: %s\nStatus code: %s\nContent: %s\n', \
item_url, response.status_code, response.text)
return default_ret
res_json = json.loads(response.text)
if 'images' not in res_json or 'large' not in res_json['images']:
return default_ret
return res_json['images']['large'][5:]

image

能否考虑补充走 https://github.com/czy0729/Bangumi-Subject 项目获取?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.