LoginSignup
9
8

More than 1 year has passed since last update.

スタジオジブリ作品の場面写真を楽に全部ダウンロードしたい【Python】

Last updated at Posted at 2020-12-01

はじめに

2020年の9月からスタジオジブリ全作品の場面写真が順次提供され始め,12月に最後の更新がありました。
常識の範囲でご自由にお使いくださいとのことでダウンロードしたい人もいるのではないでしょうか。
提供されている作品は以下のようになっています。

各作品50枚ずつ(On Your Markは28枚)なので,全部で1178枚!!
全部保存しようと思うと大変ですよね

そこで,提供されている場面写真全てを作品ごとにフォルダを分けて自動で保存できるようにPythonのプログラムを用意しました。


このプログラムとGoogleアカウントを使ってダウンロードする方法をまとめた記事はこちらから

[誰でも出来る!]スタジオジブリ作品の場面写真を全て保存する方法

動作環境

Python 3.8.6

コードについて

15行目で作品名を指定しているので,「好きな作品だけダウンロードしたい!」って人は好きな作品だけを指定して使ってください


names = ['marnie','kaguyahime','kazetachinu','kokurikozaka','karigurashi','ponyo','ged','chihiro','howl','baron','ghiblies','yamada','mononoke','mimi','tanuki','umi','porco','majo','totoro','nausicaa','laputa','omoide','redturtle','onyourmark']

例)
となりのトトロだけダウンロードしたいとき
name = ['totoro']

ghibli_download.py
ghibli_download.py

import os
import urllib.error
import urllib.request

def download_file(url, path):
    try:
        with urllib.request.urlopen(url) as web_file, open(path, 'wb') as local_file:
            local_file.write(web_file.read())
    except urllib.error.URLError as e:
        print(e)

if not os.path.exists('ghibli_data'):
    os.mkdir('ghibli_data')

names = ['marnie','kaguyahime','kazetachinu','kokurikozaka','karigurashi','ponyo','ged','chihiro','howl','baron','ghiblies','yamada','mononoke','mimi','tanuki','umi','porco','majo','totoro','nausicaa','laputa','omoide','redturtle','onyourmark']
for name in names:
    if not os.path.exists(f'ghibli_data/{name}'):
        os.mkdir(f'ghibli_data/{name}')
    for j in range(1,51):
        url = f'https://www.ghibli.jp/gallery/{name}{j:03d}.jpg'
        print(url)
        dir = f'ghibli_data/{name}/'
        download_file(url, os.path.join(dir, os.path.basename(url)))
        if name == 'onyourmark' and j == 28:
          break

ダウンロード用作品名一覧

作品名 name
思い出のマーニー 'marnie'
かぐや姫の物語 'kaguyahime'
風立ちぬ 'kazetachinu'
コクリコ坂から 'kokurikozaka'
借りぐらしのアリエッティ 'karigurashi'
崖の上のポニョ 'ponyo'
ゲド戦記 'ged'
千と千尋の神隠し 'chihiro'
ハウルの動く城 'howl'
猫の恩返し 'baron'
ギブリーズ episode2 'ghiblies'
ホーホケキョ となりの山田くん 'yamada'
もののけ姫 'mononoke'
耳をすませば 'mimi'
平成狸合戦ぽんぽこ 'tanuki'
海が聞こえる 'umi'
紅の豚 'porco'
魔女の宅急便 'majo'
となりのトトロ 'totoro'
風の谷のナウシカ 'nausicaa'
天空の城ラピュタ 'laputa'
おもひでぽろぽろ 'omoide'
レッドタートル 'redturtle'
On Your Mark 'onyourmark'
  • 9月提供作品
    ['marnie','kaguyahime','kazetachinu','kokurikozaka','karigurashi','ponyo','ged','chihiro']
  • 10月提供作品
    ['howl','baron','ghiblies','yamada','mononoke','mimi']
  • 11月提供作品
    ['tanuki','umi','porco','majo','totoro']
  • 12月提供作品
    ['nausicaa','laputa','omoide','redturtle','onyourmark']

おわりに

このプログラムが誰かの役に立つことを願って

9
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8