ポケモンシャツなるものが発売されまして、これがなかなかオシャレなんですよ。
https://www.pokemon.co.jp/ex/shirts/
・・・仕事に着ていけるかどうかは別にして。
なんでTシャツとかハンカチとかにしなかったんだろう。
ともあれ、サンプルとして公開されている20個のデザインが洒落ていて良いので壁紙として使いたい。※1個人利用なら怒られないので
Pythonで一括取得
右クリックからの画像を保存を20回やっても良いのだけど、せっかくなので。※2後に151柄公開されたときに備えてでもある。
1 2 3 4 5 6 7 8 9 10 11 |
import urllib base_url = "https://www.pokemon.co.jp/ex/shirts/img/pattern/"; for i in range(1,20): url = base_url + str(i) + ".jpg"; img = urllib.request.urlopen(url); fimg = open("pokemon/pokemon"+str(i)+".jpg","wb"); fimg.write(img.read()); fimg.close(); |
画像のURLが連番なので、urllibでガーして終わり。
できた。
Androidには壁紙をランダムで切り替える機能があるので、それで回そうかと画策中。
追記
気がつけば151匹全員公開されていた。のでコードを変更
1 2 3 4 5 6 7 8 9 10 11 |
import urllib; base_url = "https://www.pokemon.co.jp/ex/shirts/img/pattern_all/"; for i in range(1,152): url = base_url + str(i) + ".jpg"; img = urllib.request.urlopen(base_url); fimg = open("pokemon/pokemon"+str(i)+".jpg","wb"); fimg.write(img.read()); fimg.close(); |
注釈
1. | ↑ | 個人利用なら怒られないので |
2. | ↑ | 後に151柄公開されたときに備えてでもある。 |