greasemonkeyで大量に社内の画像をDLするスクリプトを書いてみた

| コメント(305) | トラックバック(0)
一応SEの端くれのつもりですし!たまにはこういう話も。

■やりたいこと
会社に内線番号のデータベースがあって、そこに各人の顔写真が掲載されてるんですけど。
これを全社員分DLしたい!!!!11
と言う人がいた場合、どうしたらよかろうか。

■普通に思い付く事
普通はまぁ、右クリックしてぽちぽち保存していくとか
URL探ってダウンロード支援ツール使ってまとめて落とすとか、思い付きますな。
画像のIDはシーケンシャルだし。(でした)
あれ、余裕じゃね?そう思っていた時期が僕にもありました・・・

■ポイント1 右クリックで保存出来ない
顔写真をdivタグの背景画像として流してあって
フロントにはカバーの透明画像を上乗せして表示してるみたいなのね。だから右クリは無理。
簡単な悪戯防止ですね。

■ポイント2 画像ファイルに直接アクセス出来ない
これを解くのに時間がかかった・・・
直接URLを叩いてもエラーになるのです。401の認証エラーかな。
で、firebugでリクエストヘッダ見てたらわかったんだけど
keepaliveで維持されたセッションからのアクセスじゃないと、どうやら受け付けないらしい。
システムにログインする時にbasic認証してから入るんですが、
そのセッションでアクセスする必要があるようです。

■結果
ご想像通りでしょうが、正規のアクセスのセッション上で、
greasemonkeyでURLを大量に生成したページを作って
(=ループでidを回して10000人分くらいの画像を画面に表示するページを作る)
firefoxのキャッシュから画像のみ抽出したら全員分取れそうでした。

ほんとはこういうの使ってDLまで自動でやりたかったんだけど、うまくインストール出来ず。。
firefox3系だと入んないのかな。残念。

■課題点
ネックは画像の同時DL数と画面の描画っていう・・・
10000個も普通のブラウザでDLして描画したらそりゃ遅いだろ。
社内システムで画像サーバが分散してるわけは無いので
完全にブラウザの同時接続制限にかかって、10000個を線形にDLするわけですな。
で、片っ端から画面に描くと。。あほか!
firebugで見ると接続情報のブロッキングの時間だけ増えているのが分かります。

ただ、javascriptの実行待ち時間を無限にして
描画サイズも5pt×5ptとかにしたら、一応動くようにはなった。

でも1000個くらい表示してDLした時点で結局飽きてやめました。。
多分ID的には20000くらいまでありそうな予感。
どうでもいいけどIDの採番ルールとか見えてきてしまった。

■問題点
これ、バレたら怒られそう。。
と言うか社内の人間からすれば、DLして何すんの?まじキモくね?
と言う感じだと思います。

すみません、明日はちゃんと仕事します><


■結論
ぐりもんおもしろい。
みんなも入れてみましょう!!!

トラックバック(0)

トラックバックURL: http://blog.mantol.net/mt/mt-tb.cgi/4071

コメント(305)

ぐりもん知りたい!
勉強会やろう!
あと、まじキモいと思いますw

次はかわいい子だけ表示するスクリプトをお願いします!
あとマジキモいと思います!

へーこういうのがあるんですか
知りませんでした
サイトのみやすさを閲覧者側で整備する感じですかね。

>えーりん
初めて使ったけど、意外とかんたん!
とりあえず入れてみてminibufferでも使ってみるのをオススメします。

>たっきゅう
ほんとはそれがやりたくてww
画像に投票する仕組みでも作るか!

>hidomeleph
>サイトのみやすさを閲覧者側で整備する感じですかね。
まさにそんなかんじです!
ブラウザで表示させる直前のHTMLを途中で"整備"して
表示させられるような仕組みです。色々ユーザスクリプトがあるみたいです!

This is a topic that I have quite a strong passion about. Theres no doubt that most people today ignore how important this theme is. I believe it is a foundation upon which various things are built and if we do this measure wrong, there are lots of dire consequences in the longer term. Thus, we should be careful and think about how precisely we want to technique this topic. I thank the author for giving a superb first try at approaching it.

Together with every little thing that appears to be building throughout this particular subject matter, all your points of view tend to be somewhat stimulating. Nonetheless, I appologize, but I can not subscribe to your whole strategy, all be it radical none the less. It would seem to us that your remarks are not completely rationalized and in fact you are yourself not thoroughly certain of your argument. In any case I did take pleasure in looking at it.

I wanted to say this blog is almost amazing. I always like to hear something new about this because I have the similar blog in my Country on this subject so this help´s me a lot. I did a search on the matter and found a good number of blogs but nothing like this.Thanks for writing so much in your blog.

Thanks for making the sincere attempt to speak about this. I believe very robust about it and would like to learn more. If it’s OK, as you achieve extra intensive wisdom, may you thoughts adding more articles very similar to this one with additional information? It might be extremely useful and useful for me and my friends.

Let me just say that this is certainly a good impacting take on this specific issue. Thanks, I’m happy you shared your opinions in addition to smart ideas and I discovered I concur. I definitely recognize your clear writing as well as the energy you have invested with this post. Loads of thanks for the strong work also great luck with your site, I most certainly will be awaiting new topics in the future.

Well, I don’t know if that is going to work for me, however definitely worked for you! :) Excellent post!

Music started playing as soon as I opened this web page, so frustrating!

Presently it is good time to produce some plans for the long run and it is the moment to take a break. I have learn this post and if I may I wish to suggest you few interesting things or suggestions. Perhaps you can post subsequent articles relating to this article. I hope to study more things related to it!

It is rare for me to discover something on the net that’s as entertaining and intriguing as what you have got here. Your page is sweet, your graphics are great, and what’s more, you use source that are relevant to what you are talking about. You’re definitely one in a million, keep up the good work!

Thank you very much for another helpful post. I have been a big fan for a few months, and I have been enjoying ever second of it With so many autogenerated blogs out there, its refreshing to find a real one. I run a blog that is very similar, is there any way you would write a guest post on it? Shoot me an email if you are interested!

It is rare for me to discover something on the net that’s as entertaining and intriguing as what you have got here. Your page is sweet, your graphics are great, and what’s more, you use source that are relevant to what you are talking about. You’re definitely one in a million, keep up the good work!

I want to thanks for the efforts you have contributed in writing this blogpost. I am hoping the same top-quality article from you in the future as well. In fact your creative writing abilities has inspired me to start my own blog now. Truly the blogging is spreading its wings rapidly. Your write up is a good model of it.

I'm curious to find out what blog system you're working with? I'm experiencing some small security problems with my latest blog and I'd like to find something more safeguarded. Do you have any recommendations?

A lot of what you state happens to be supprisingly precise and that makes me ponder why I hadn’t looked at this with this light before. Your piece truly did switch the light on for me as far as this issue goes. Nevertheless there is actually one particular point I am not necessarily too cozy with and whilst I try to reconcile that with the main theme of your issue, allow me see exactly what all the rest of the readers have to point out.Well done.

I have been looking for this info for quite a while. Nearly 9 hours of continuous surfing, at last I found that in your article. I don’t understand why Bing don’t display this kind of useful websites in the first few lines. Normally the top web sites are rubbish. Perhaps it is time to change to other search engine.

Thank you very much for another helpful post. I have been a big fan for a few months, and I have been enjoying ever second of it With so many autogenerated blogs out there, its refreshing to find a real one. I run a blog that is very similar, is there any way you would write a guest post on it? Shoot me an email if you are interested!

Appreciate you for sharing these wonderful articles. In addition, the ideal travel along with medical insurance program can often relieve those fears that come with traveling abroad. A new medical crisis can soon become too expensive and that’s likely to quickly set a financial impediment on the family’s finances. Setting up in place the excellent travel insurance deal prior to leaving is definitely worth the time and effort. Thank you

I would like to express my affection for your kindness in support of visitors who really need guidance on this important situation. Your personal commitment to getting the message across appears to be certainly productive and has usually permitted men and women much like me to arrive at their pursuits. Your new useful guideline implies this much to me and additionally to my office workers. Thank you; from everyone of us.

Good points…I would note that as someone who really doesn’t comment to blogs much (in fact, this may be my first post), I don’t think the term “lurker” is very flattering to a non-posting reader. It’s not your fault in the least , but perhaps the blogosphere could come up with a better, non-creepy name for the 90% of us that enjoy reading the content .

Excellent goods from you, man. I’ve understand your stuff previous to and you’re just too wonderful. I actually like what you have acquired here, certainly like what you are saying and the way in which you say it. You make it enjoyable and you still take care of to keep it wise. I can’t wait to read far more from you. This is actually a terrific site.

Hello just wanted to give you a quick heads up. The text in your article seem to be running off the screen in Safari. I’m not sure if this is a format issue or something to do with internet browser compatibility but I figured I’d post to let you know. The style and design look great though! Hope you get the issue solved soon. Many thanks

Thank you for your blog post. Johnson and I have been saving to get a new e-book on this theme and your blog post has made us all to save all of our money. Your ideas really answered all our problems. In fact, above what we had thought of before we ran into your excellent blog. We no longer nurture doubts along with a troubled mind because you have attended to all of our needs above. Thanks

What would most of us do devoid of the wonderful concepts you talk about on this blog? Who else has the tolerance to deal with crucial topics in the interest of common visitors like me? My spouse and i and my guys are very happy to have your blog among the ones we usually visit. Hopefully you know how considerably we love your hard work! Best wishes from us all.

Can I just say what a reduction to find someone who actually is aware of what theyre talking about on the internet. You undoubtedly know methods to bring an issue to light and make it important. More folks need to read this and understand this side of the story. I cant believe youre no more common since you undoubtedly have the gift.

I am impressed, I must say. Very seldom do I come across a blog that’s both educational and entertaining, and let me tell you, you’ve hit the nail on the head. Your opinion is outstanding; the issue is something that not a lot of people are speaking intelligently about. I am really happy that I stumbled across this in my search for something relating to it.

The recommendations you have given here are rather priceless. It had been such an entertaining surprise to have that waiting for me after i woke up now. They are often to the point and simple to grasp. Thanks a lot for the valuable ideas you've shared above.

I wish to express some thanks to this writer just for bailing me out of this particular issue. Right after researching throughout the internet and getting tricks that were not pleasant, I assumed my life was done. Living without the approaches to the problems you have resolved by way of this guide is a critical case, as well as the kind that could have negatively damaged my career if I hadn’t encountered the website. Your good expertise and kindness in controlling every part was valuable. I am not sure what I would have done if I had not discovered such a step like this. I am able to now look forward to my future. Thanks for your time very much for your impressive and amazing help. I will not hesitate to suggest your site to any person who needs and wants guide about this problem.

Sacramento is the capital city of the U.S. state of California, and the county seat of Sacramento County. It is located at the confluence of the Sacramento River and the American River in the northern portion of California's expansive Central Valley. With a 2009 estimated population of 489,676, it is the sixth-largest city in California.[1] Sacramento is the core cultural and economic center of the Sacramento metropolitan area which includes seven counties; with an estimated population of 2,927,123.[2] Its metropolitan area is the fourth largest in California after the Greater Los Angeles Area, San Francisco Bay Area, and the San Diego metropolitan area as well as the 25th largest in the United States. A city attaining global status, Sacramento was cited by Time magazine as America's most ethnically and racially integrated city in 2002

It’s hard to find knowledgeable people on this topic, but you sound like you know what you’re talking about! Thanks

Hello there! Superb piece of writing! I'm a daily visitor to your site (much like addict :P) of the website sadly I had a concern. I am only never totally sure if its the right place to question, but you have no spam comments. I receive comments daily. Are you going to you assist me? Thanks for the tips!

One thing I enjoy about reading through sites such as this, is that there isn't any spelling or grammatical errors! Makes it tough about the reader sometimes. Very good work upon might also the topic of this website. Thanks!

I like your website! Better than others I have lately read covering this. Design is actually nice, mind basically copy this particular? Simply kidding?-Thanks!

Fantastic blog post it is without doubt. My boss has been seeking for this advice.

Absence makes the heart grow fonder

Wonderful info once again! I am looking forward for more updates!

Fantastic article. Thanks.

Do you folks have the facebook fan internet web page? I sought out 1 upon twitter but could not uncover one, I would like to turn into a fan!

I'm typically in order to running a blog and i actually admire your content. The actual article offers really highs my interest. I am going to bookmark your website and maintain looking at for brand new details.

This is just a few things i was looking for. I used to be not necessarily anticipating that I'd get a lot away from reading your write up! You've merely gained your hair a coming back customer

You are a very vibrant person!

Exceptional post. I just stumbled upon your website and wanted to say that I have for sure loved analyzing the blog. I have became a subscriber to your RSS feed and I expect that you will write a new post again soon. I am curious if I should subscribe to comments feed as well. Any helpful conversations happening in posts comments?

Fantastic info over again! Thanks a million=)

This is the finest weblog for anyone who desires to find out about this topic. You understand so a lot its virtually difficult to argue with you (not that I truly would need?HaHa). You definitely place a brand new spin on the topic thats been written about for a long time. Nice things, just superb!

I am really inspired along with your writing abilities well with the format on your weblog. Is that this a paid subject matter or did you modify it yourself? Either way keep up the excellent high quality writing, it’s uncommon to peer a nice weblog like this one these days..

Gutscheincode Coupon Gutscheine Aktionscode Einkaufsgutscheine"

I absolutely appreciate this excellent posting which are provided for us. I ensure this is advantageous for most people.

コメントする

ウェブページ

Powered by Movable Type 5.02

このブログ記事について

このページは、まんとるが2010年5月 7日 01:11に書いたブログ記事です。

ひとつ前のブログ記事は「GW終了のお知らせ」です。

次のブログ記事は「散歩&読書ブームが到来している!」です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。