pic2ch 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ AUTHOR = "maiha"
6
6
  EMAIL = "maiha@wota.jp"
7
7
  HOMEPAGE = "http://github.com/maiha/pic2ch"
8
8
  SUMMARY = "A gem that provides api to pic2ch"
9
- GEM_VERSION = "0.0.1"
9
+ GEM_VERSION = "0.0.2"
10
10
 
11
11
  spec = Gem::Specification.new do |s|
12
12
  s.rubyforge_project = 'asakusarb'
data/lib/pic2ch.rb CHANGED
@@ -17,6 +17,7 @@ end
17
17
  dir = File.dirname(__FILE__) + '/' + File.basename(__FILE__, '.rb') + '/'
18
18
 
19
19
  require dir + 'thread'
20
+ require dir + 'thread/static'
20
21
  require dir + 'pages'
21
22
  require dir + 'parsers'
22
23
  require dir + 'downloaders'
@@ -1,4 +1,5 @@
1
1
  dir = File.dirname(__FILE__) + '/' + File.basename(__FILE__, '.rb') + '/'
2
2
 
3
+ require dir + 'errors'
3
4
  require dir + 'index'
4
5
  require dir + 'thread'
@@ -0,0 +1,15 @@
1
+ module Pic2ch
2
+ module Parsers
3
+ ParseError = Class.new(RuntimeError)
4
+ DeletedPage = Class.new(ParseError)
5
+ class NotFound < ParseError
6
+ def initialize(attr)
7
+ @attr = attr
8
+ end
9
+
10
+ def message
11
+ "#{@attr} is not found"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -16,13 +16,35 @@ module Pic2ch
16
16
  @doc ||= Nokogiri::HTML(html)
17
17
  end
18
18
 
19
- # {id:'1243648801',urls:'54b14715c000a6334ad2e8771cbf70e8.jpg:1e611e8710dd60d616e345aa69334c2d.jpg:...'}
19
+ def deleted?
20
+ check_deleted
21
+ return false
22
+ rescue DeletedPage
23
+ return true
24
+ end
25
+
26
+ def count
27
+ unless @count
28
+ check_deleted
29
+ count = doc.css('h2').text.scan(/\((\d+)\)$/).flatten.first.to_s
30
+ raise NotFound, "count" if count.empty?
31
+ @count = count.to_i
32
+ end
33
+ return @count
34
+ end
35
+
20
36
  def jpgs
21
- @jpgs ||= html.scan(/',urls:'(.*?)'/).first.first.split(/:/)
37
+ unless @jpgs
38
+ check_deleted
39
+ urls = extract(:urls).split(/:/)
40
+ raise ParseError, "expected #{count} urls exist, but got #{urls.size}" unless urls.size == count
41
+ @jpgs = urls
42
+ end
43
+ return @jpgs
22
44
  end
23
45
 
24
46
  def time
25
- @time ||= html.scan(/\{id:'(\d+)',urls:'/).first.first.to_i
47
+ @time ||= extract(:id).to_i
26
48
  end
27
49
 
28
50
  def title
@@ -40,6 +62,20 @@ module Pic2ch
40
62
  def images_with_thumbs
41
63
  @images_with_thumbs ||= [images, thumbs].transpose
42
64
  end
65
+
66
+ private
67
+ def check_deleted
68
+ raise DeletedPage if html =~ /このスレッドは削除されました/
69
+ end
70
+
71
+ def extract(key)
72
+ # {id:'1243648801',urls:'54b14715c000a6334ad2e8771cbf70e8.jpg:1e611e8710dd60d616e345aa69334c2d.jpg:...'}
73
+ if html =~ /(\{|'\s*,)\s*#{key}:'(.*?)'/
74
+ return $2.to_s
75
+ else
76
+ raise NotFound, key.to_s
77
+ end
78
+ end
43
79
  end
44
80
  end
45
81
  end
data/lib/pic2ch/thread.rb CHANGED
@@ -22,7 +22,7 @@ module Pic2ch
22
22
  @parser ||= Parsers::Thread.new(self)
23
23
  end
24
24
 
25
- delegate :jpgs, :thumbs, :images, :title, :to=>"parser"
25
+ delegate :deleted?, :jpgs, :thumbs, :images, :title, :to=>"parser"
26
26
 
27
27
  ######################################################################
28
28
  ### Downloader
@@ -1,9 +1,12 @@
1
1
  module Pic2ch
2
2
  class Thread
3
3
  class Static < Thread
4
+ attr_reader :code
5
+ attr_reader :url
6
+
4
7
  def initialize(code)
5
8
  @code = code.to_i
6
- @url = self.class.url + "/thread/#{@code}"
9
+ @url = Pic2ch.url + "/thread/#{@code}"
7
10
  end
8
11
  end
9
12
  end
@@ -0,0 +1,69 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" >
4
+ <head>
5
+ <meta name="keywords" content="2ch,画像,まとめ,ポニーテールの女の子の画像 11本目"/>
6
+ <meta name="description" content="ポニーテールの女の子の画像 11本目 - 2ch画像まとめ。2chに書き込まれた面白画像やエロ画像が全て見れます!。常に最新の情報に更新されています。"/>
7
+ <meta name="verify-v1" content="ePPL3qVW/7DeTPnasbxeygRQZ2pcSSeKm/y5ixvw7dE=" />
8
+ <meta name="y_key" content="eb7d4d3b35906d30" />
9
+ <link rel="alternate" type="application/atom+xml" title="Atom" href="/feed" />
10
+ <link rel="stylesheet" type="text/css" href="http://strage.giox.info/stylesheets/pic2ch-min.css?9" />
11
+ <title>ポニーテールの女の子の画像 11本目 - 2ch画像まとめ</title>
12
+ </head>
13
+ <body>
14
+ <div id="header">
15
+ <h1>
16
+ <a href="/" style="color:#000">2ch画像まとめ</a>
17
+
18
+ <a href="http://b.hatena.ne.jp/append?http://pic2ch.giox.org/"><img src="http://strage.giox.info/images/b_hatena.gif" alt="Hatenaブックマークに追加" title="Hatenaブックマークに追加" /></a>
19
+ <a href="http://b.hatena.ne.jp/entry/http://pic2ch.giox.org/"><img src="http://b.hatena.ne.jp/entry/image/normal/http://pic2ch.giox.org/" alt="Hatenaブックマーク" title="Hatenaブックマーク" /></a>
20
+ <a href="http://clip.livedoor.com/clip/add?link=http://pic2ch.giox.org/"><img src="http://strage.giox.info/images/b_clip.gif" alt="livedoorクリップに追加" title="livedoorクリップに追加" /></a>
21
+ <a href="/feed"><img src="http://strage.giox.info/images/feed.png" alt="Rss/Atom" title="Rss/Atom" /></a>
22
+
23
+ </h1>
24
+ </div>
25
+ <div id="content">
26
+
27
+
28
+
29
+ <h2>ポニーテールの女の子の画像 11本目 (150)<span id="star"><img id="add" src="http://strage.giox.info/images/add.gif" /></span></h2>
30
+
31
+ <div class="ads_container">
32
+ <div class="adb">
33
+ <a href="http://track.bannerbridge.net/click.php?APID=30615&affID=49172&siteID=98547" target="_blank"><img src="http://track.bannerbridge.net/adgserv.php?APID=30615&affID=49172&siteID=98547" width="125" height="125" border="0" alt="" title="" /></a>
34
+ </div>
35
+ </div>
36
+
37
+ <div id="container"></div>
38
+ <!--[if lt IE 8]>
39
+ <script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
40
+ <![endif]-->
41
+ <script type="text/javascript" src="http://strage.giox.info/javascripts/pic2ch-min.js?1"></script>
42
+ <script type="text/javascript">
43
+ window.onload=function(){
44
+ pic2ch.slideshow.init(
45
+ {id:'1259455593',urls:'73f8e3cbd73869672865c6d56e6096de.jpg:4185344f6fcea5862dbd43d24255db66.jpg:bff45b17e372f199d7f4de824130a395.jpg:a161746c84da806a3ca10acbb96bf664.jpg:55a30ab6a7331a17de1f502504f172d7.jpg:075802043a30950ce37d0c50f788d41c.jpg:cb23abeda94490d7ff5b5bcdcf4b4d81.jpg:b7898a8d4911b1e2968189c74ba12c5e.jpg:e98fd5dfd1a432b51d74ca1fb71a3515.jpg:60cbd7b6501d9c1224ffc5fd6b36fd81.jpg:483b7ea72741176b055c4b4420a2d7ce.jpg:5ff009c3f0161fbc646dbbe93b4d7d22.jpg:7c438c8e254f45624a07076e69d59d8b.jpg:3fe1b5fe4fe79c8f7eaac3d0f0fa46bc.jpg:06c711445d4a994ea8350453040585a8.jpg:1f54b0dd1f385da66b01527891360a81.jpg:a64c35c54ac3b1bf1f8c80de0ff8c44a.jpg:62eab58fce3a246b2f67e0ec2bdb4bcd.jpg:4067541962c8cc9340bb0248506887b1.jpg:a040d3c6fafefca35ee14d4621c0c209.jpg:3812264ace5f24cc51cb0e49cbfb6364.jpg:88c2a36d7d2f5594bd9dbeb89f5af640.jpg:e59dbec6ae67e424af62c0931d267814.jpg:9ba203ae3d9d8167584a99a1d1e544cf.jpg:0edafc2a6344f689651258c77f2c3679.jpg:ae8cbcd364852ae24271104e9cafbc80.jpg:1e674071c403f41734427296bc96049d.jpg:2f5e6bc2376116079de36ac1167ddacc.jpg:6729cdb9fbab768664901c72acd6adbd.jpg:c60adb604765412744389e7e7ec328a6.jpg:85bf3bea5e01d24145b30bc3f716de92.jpg:93d6ba71a3a2505d898aaa817af86252.jpg:973021f3eac7a9fb3e7274d5234792cf.jpg:ae8ec1ecc74eb975774c4ce299a90ce2.jpg:a279c58ebab2e38010706eaa0c69ed53.jpg:861be973e4f7566638952ad5d4ef7b39.jpg:704f96e70739d7976641149e28a272b7.jpg:53bd6701b80e7abd037af0193d43bd29.jpg:bbcca2012031117afd99bda5e3c721fb.jpg:c55570570e0eda08e18c53eabd38357a.jpg:101882982e5dafd890d9b32b3a3dacd3.jpg:dd0fdc1e68a6e6e753e377df89455c8f.jpg:bc1d7732b46f7e4ff297d59fab1695fb.jpg:b1650577b3e80b6ce869f605d786d72c.jpg:d1bb60837be415a6f94c8aca443a2826.jpg:9af9266caffa94846891bd84c2bab4b0.jpg:3297f7201de89cf73afb35d69b86bfad.jpg:47a172dfe9c929914f282e92d4726ffe.jpg:0b5b86f998fab67f97c7fadab983a946.jpg:ac8e49206e4c8c781a6c12ab94b4ad80.jpg:a9bc0551bb9be49b79a3cae6a68511ec.jpg:4237bbd3d19909bfabd086880802a38c.jpg:3faccd9e6caee220afaee9fb99e782ca.jpg:b34f5429ab6c99342742b93c1f92a9ae.jpg:dfd60190014b730d5597db7c2b493ada.jpg:99a1a8331d7da4cbb7c645dc954dd714.jpg:313bb680b5f4803bfe0374aa8bc249e3.jpg:7c620593474f6202662ca10f2462e317.jpg:95751fea704198cfcc5311480ffce309.jpg:3dfbf1c78f91cc043475ec2e1e296e2d.jpg:235a941b4f17f4646a1faa659a720d2f.jpg:4986bcb1e5b60a12be0874d1b83f59cd.jpg:7c9997ea7d4ef83afb86a9198fe528d8.jpg:fe7c4c666186c911ec5e3ea3fa42c53e.jpg:49768a240392ea75a28b19e54e20d243.jpg:ecc0386e13a9e39847b6ebd1e0785963.jpg:a27c8563ef34f4a61ad7f4af7c4c632f.jpg:26f1cd8fe8ef3d0bd6946f45ec924b18.jpg:0398f7dc822bfe560a528604aa019029.jpg:bb9d1f3da22746ba26d8da4fba791941.jpg:371a12cfa5cd7f880d31326b724f8851.jpg:53a08358e10e5aa0bfcc7f9b307425bf.jpg:e24afe174c86b7164b1d06d1b85f14d0.jpg:5aeacd3a4245c309c018f8f59345f989.jpg:4a3693bf51e1ecc43b0e94a2f62c56f0.jpg:1e63c31c24cf31a9033d957c4635db8e.jpg:07da772c44b435600a15c41f971c8928.jpg:f2ddb340234c31244efcfa11169b20eb.jpg:8a99697b96d0e1c03353b8abe270c30d.jpg:b551987676f8fd2353e5d2c88f505c4c.jpg:8625bf4b92f03680667797ba2b4cf264.jpg:6b3c503645cbb8700349bb3a35afefba.jpg:5659d3ba80d629fe0f5abe1683c9dfb0.jpg:1b8704381b7b018de0e39d36368156dd.jpg:16141a900f3b73c9a051aef2d85c2208.jpg:41e868ec48d3852b629a33efb8e6a2fb.jpg:61932b346baaad9c82c4f83601d8cd41.jpg:134b1369b7cabb8a94f6f1c178c75779.jpg:744b91d71e933e6c4d5a0c85f1bf2abf.jpg:fbdc410b2c88bbf4ad814c747674a391.jpg:0d9f04bf2f31b85d329cabf6d638fec9.jpg:494da4e63a8b9ca33ff0e45e2c1155af.jpg:f713e997fc7ce44fb37b8b9c1ace403c.jpg:eab9da347841e0bd11e7c9cf0ed16736.jpg:1bbaa481be82d18a46967aab3d6f2d12.jpg:c64680a9eb8158f428602010a4978dd8.jpg:3ed8d0ff3dbbcf792d6a8c6eb3c71225.jpg:7aefc3e8dded1199d776a5ccdb61fa30.jpg:9357b5d970eaef24158c3a8fa19e1681.jpg:c34f44483c5d0dfe0854ad340a59270c.jpg:2e56e3190731799a074923ec4506fc48.jpg:4d5bfbd69a688fd33cd14f4d0d856684.jpg:967cc2f1645ec3f5e72ea374607abeba.jpg:05b380c0abd5ba28a5f4d64e9d8109d5.jpg:6a5c3e9e0d42f831bacc0f37f0135143.jpg:f6f8c5ee311072a70e91b3bad208c498.jpg:0e4e79d213d0d1474e736470ece1f3a0.jpg:174573312cd2f4aca5a273a2489568b1.jpg:3b564fd335c472a5a15d218e5e265e57.jpg:bd90337f08b3961c4b5a278ae1919136.jpg:392819c9fe6fa1df14f16c05d85d854a.jpg:5934668094bb76524e56269522882659.jpg:ca86aea1a8b930978d74d3af862143fa.jpg:90420247fd75db63c9130d4d89f9e4b4.jpg:a73fa2c10a71db4d6f9454137e37e34c.jpg:e67b4bdec1af23da9cd378be1c0d2795.jpg:93b962813fcecf200aabe934412d1094.jpg:1cd477a85ca5b3d1e85ad19e53a9ea11.jpg:bc7d4d3281daad32f3e060abef6d0ae5.jpg:65344303c9fbf380313ad4bbbbc5a5b9.jpg:ed9dd59af4a6dcea74341df53225b578.jpg:42e44110cebd0bd30cfc85d524070075.jpg:6f9d9a9a6e7dafd66a6eba12436a58dd.jpg:d34c988fc6833d74fb3869a2f960f917.jpg:205bfd164117da54d6ae4dd1e66c259e.jpg:ffb2f327880afb2d56da2ee2dca686b8.jpg:7a32aceeead4e8615c66a54492f24a89.jpg:de8343dd9c48f321db10dc125c06fa2f.jpg:cd08ed8f3eae166dfe524d87af62c437.jpg:cdab4dee76166dca77a74c1196aa84bd.jpg:035ca226085f44531c1af83c424f6cb2.jpg:3c84e80b984028c0d5d92ff94b7fe2bb.jpg:2de45ebabca6c4dfac538bbe469fbb39.jpg:5619e99179ea611f88b4abf1576b6f9d.jpg:782c29dd29c6c749961bfaf0a5ff6a71.jpg:231a9dc995017be9c9adc2ac295c0734.jpg:dc4c1aec723e1add23471b5b65898233.jpg:64c47505a8199f3455edeb98b503b553.jpg:779a57d637247b8edd4ae63604d36ec1.jpg:bb6975b5f76c26f65218dddae8e38f4c.jpg:a01f4c8c224f5bf642128430bc6aba35.jpg:ee8865be627d32d3c44e01b7844e9c4d.jpg:936262fc6dbafc9b86d49343e84f61e5.jpg:80d4625e9100e6cbf471606c44b954ad.jpg:20911086b01ceee49d84392eda744d8e.jpg:e91c93ca0d5959007fbbfc393866f318.jpg:1d6a334c605f80be2e48132d037d80a0.jpg:adbd3fd26dfa81fe382f8c1992ef7685.jpg:c33b3e09a23a702a39c9c3f0500214cf.jpg:0e0b2f034e09f7319fd95e6c363434e0.jpg'.split(':'),path:'http://strage.giox.info',container:'container'});
46
+ pic2ch.addStar('add', 'star', '36603', 4, 'http://strage.giox.info');
47
+ };
48
+ </script>
49
+
50
+ </div>
51
+ <div id="footer">
52
+ <a href="http://p2m.giox.org/">2ch画像まとめモバイル</a>&nbsp;|
53
+ <a href="http://d.hatena.ne.jp/gioext/">Blog</a>&nbsp;|
54
+ <a href="https://ssl.kodama.com/securemail.aspx?id=qn70rje68t3n8w56">Mail</a>&nbsp;|
55
+ <span class="copyright">&copy; 2008-2009 Giox.org</span>
56
+ </div>
57
+
58
+ <script type="text/javascript">
59
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
60
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
61
+ </script>
62
+ <script type="text/javascript">
63
+ try {
64
+ var pageTracker = _gat._getTracker("UA-6512399-3");
65
+ pageTracker._trackPageview();
66
+ } catch(err) {}</script>
67
+
68
+ </body>
69
+ </html>
@@ -0,0 +1,73 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" >
4
+ <head>
5
+ <meta name="keywords" content="2ch,画像,まとめ,この世のすべての女子高生画像を集めたい。"/>
6
+ <meta name="description" content="この世のすべての女子高生画像を集めたい。 - 2ch画像まとめ。2chに書き込まれた面白画像やエロ画像が全て見れます!。常に最新の情報に更新されています。"/>
7
+ <meta name="verify-v1" content="ePPL3qVW/7DeTPnasbxeygRQZ2pcSSeKm/y5ixvw7dE=" />
8
+ <meta name="y_key" content="eb7d4d3b35906d30" />
9
+ <link rel="alternate" type="application/atom+xml" title="Atom" href="/feed" />
10
+ <link rel="stylesheet" type="text/css" href="http://strage.giox.info/stylesheets/pic2ch-min.css?9" />
11
+ <title>この世のすべての女子高生画像を集めたい。 - 2ch画像まとめ</title>
12
+ </head>
13
+ <body>
14
+ <div id="header">
15
+ <h1>
16
+ <a href="/" style="color:#000">2ch画像まとめ</a>
17
+
18
+ <a href="http://b.hatena.ne.jp/append?http://pic2ch.giox.org/"><img src="http://strage.giox.info/images/b_hatena.gif" alt="Hatenaブックマークに追加" title="Hatenaブックマークに追加" /></a>
19
+ <a href="http://b.hatena.ne.jp/entry/http://pic2ch.giox.org/"><img src="http://b.hatena.ne.jp/entry/image/normal/http://pic2ch.giox.org/" alt="Hatenaブックマーク" title="Hatenaブックマーク" /></a>
20
+ <a href="http://clip.livedoor.com/clip/add?link=http://pic2ch.giox.org/"><img src="http://strage.giox.info/images/b_clip.gif" alt="livedoorクリップに追加" title="livedoorクリップに追加" /></a>
21
+ <a href="/feed"><img src="http://strage.giox.info/images/feed.png" alt="Rss/Atom" title="Rss/Atom" /></a>
22
+
23
+ </h1>
24
+ </div>
25
+ <div id="content">
26
+
27
+
28
+
29
+ <h2>この世のすべての女子高生画像を集めたい。 </h2>
30
+ <div>このスレッドは削除されました。別スレッドをお楽しみください。<a href="/">2ch画像まとめTOP</a></div>
31
+ <div><div><a href="http://track.bannerbridge.net/click.php?APID=8975&amp;affID=49172&amp;siteID=98547"><img src="http://track.bannerbridge.net/adgserv.php?APID=8975&amp;affID=49172&amp;siteID=98547" width="468" height="60" alt="" title="" /><br />30分以内に可愛い女性を虜にしませんか?</a></div>
32
+ <div><a href="http://track.bannerbridge.net/click.php?APID=29932&amp;affID=49172&amp;siteID=98547"><span class="new">もう出会い系にはだまされない!</span></a><img src="http://track.bannerbridge.net/adtserv.php?APID=29932&amp;affID=49172&amp;siteID=98547" width="1" height="1" alt="" title="" /></div>
33
+ <div><a href="http://track.bannerbridge.net/click.php?APID=8985&amp;affID=49172&amp;siteID=98547"><span class="new">☆どんな女でも虜にする究極のセックス講座パーフェクトセックス☆</span></a><img src="http://track.bannerbridge.net/adtserv.php?APID=8985&amp;affID=49172&amp;siteID=98547" width="1" height="1" alt="" title="" /></div>
34
+ <div><a href="http://track.bannerbridge.net/click.php?APID=16628&amp;affID=49172&amp;siteID=98547"><span class="new">[18禁]出会いコミュニティー デジカフェ</span></a><img src="http://track.bannerbridge.net/adtserv.php?APID=16628&amp;affID=49172&amp;siteID=98547" width="1" height="1" alt="" title=""></div>
35
+ </div>
36
+ <h2>最新の画像 - 【男一人】ハーレムな画像【女複数】第7夫人</h2>
37
+
38
+ <img src="http://strage.giox.info/thumbs/1219284933/d1fef5e72deb06112620d96bc08f3216.jpg" alt="【男一人】ハーレムな画像【女複数】第7夫人 " />
39
+
40
+ <img src="http://strage.giox.info/thumbs/1219284933/702b9778179ec7e8bca66349c09a90d8.jpg" alt="【男一人】ハーレムな画像【女複数】第7夫人 " />
41
+
42
+ <img src="http://strage.giox.info/thumbs/1219284933/f6a0755ccc58d3d1ee58242347dddb24.jpg" alt="【男一人】ハーレムな画像【女複数】第7夫人 " />
43
+
44
+ <img src="http://strage.giox.info/thumbs/1219284933/d82665da5548c2a0c99b4eaa69f538d5.jpg" alt="【男一人】ハーレムな画像【女複数】第7夫人 " />
45
+
46
+ <img src="http://strage.giox.info/thumbs/1219284933/f98ed6918a912f97d1a24b0e443f801b.jpg" alt="【男一人】ハーレムな画像【女複数】第7夫人 " />
47
+
48
+ <br />
49
+ <a href="http://track.bannerbridge.net/click.php?APID=30615&affID=49172&siteID=98547" target="_blank"><img src="http://track.bannerbridge.net/adgserv.php?APID=30615&affID=49172&siteID=98547" width="125" height="125" border="0" alt="" title=""></a>
50
+ <h2>2ch画像まとめモバイル</h2>
51
+ <div><a href="http://p2m.giox.org/">2ch画像まとめモバイル</a>も宜しくお願いいたします</div>
52
+ <img src="http://strage.giox.info/images/qrcode.jpg" alt="モバイル版QRコード" title="モバイル版QRコード" />
53
+
54
+ </div>
55
+ <div id="footer">
56
+ <a href="http://p2m.giox.org/">2ch画像まとめモバイル</a>&nbsp;|
57
+ <a href="http://d.hatena.ne.jp/gioext/">Blog</a>&nbsp;|
58
+ <a href="https://ssl.kodama.com/securemail.aspx?id=qn70rje68t3n8w56">Mail</a>&nbsp;|
59
+ <span class="copyright">&copy; 2008-2009 Giox.org</span>
60
+ </div>
61
+
62
+ <script type="text/javascript">
63
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
64
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
65
+ </script>
66
+ <script type="text/javascript">
67
+ try {
68
+ var pageTracker = _gat._getTracker("UA-6512399-3");
69
+ pageTracker._trackPageview();
70
+ } catch(err) {}</script>
71
+
72
+ </body>
73
+ </html>
@@ -0,0 +1,15 @@
1
+ module Spec
2
+ module Example
3
+ module Subject
4
+ module ExampleGroupMethods
5
+ def its(*args, &block)
6
+ describe(args.first) do
7
+ define_method(:subject) { super().send(*args) }
8
+ it(&block)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+
@@ -0,0 +1,36 @@
1
+ ######################################################################
2
+ ### provide matcher
3
+ Spec::Matchers.define :provide do |expected|
4
+ match do |obj|
5
+ (obj.public_methods + obj.protected_methods + obj.private_methods).include?(expected.to_s)
6
+ end
7
+ end
8
+
9
+ module Spec
10
+ module Example
11
+ module Subject
12
+ module ExampleGroupMethods
13
+ # == Examples
14
+ #
15
+ # describe User do
16
+ # subject { User.new }
17
+ # provide :name
18
+ #
19
+ # [intead of]
20
+ #
21
+ # it "should provide #name" do
22
+ # methods = subject.public_methods + subject.protected_methods + subject.private_methods
23
+ # methods.should include("name")
24
+ # end
25
+ # end
26
+ #
27
+ def provide(name)
28
+ it "should provide ##{name}" do
29
+ subject.should provide(name)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+
@@ -0,0 +1,16 @@
1
+
2
+ require 'spec'
3
+ require 'rr'
4
+
5
+ Dir.glob(File.join(File.dirname(__FILE__), '/../lib/*.rb')).each{|lib| require lib}
6
+ require File.join(File.dirname(__FILE__), '/its_helper')
7
+ require File.join(File.dirname(__FILE__), '/provide_helper')
8
+
9
+
10
+ def path(key)
11
+ Pathname(File.join(File.dirname(__FILE__) + "/fixtures/#{key}"))
12
+ end
13
+
14
+ def data(key)
15
+ (@__fixture_data_cache__ ||= {})[key] ||= path(key).read{}
16
+ end
@@ -0,0 +1,33 @@
1
+ require File.join(File.dirname(__FILE__), '/spec_helper')
2
+
3
+ describe Pic2ch::Parsers::Thread do
4
+ describe "for normal page" do
5
+ subject {
6
+ t = Pic2ch::Parsers::Thread.new(nil)
7
+ def t.html() data('36603.html'); end
8
+ t
9
+ }
10
+
11
+ its(:title) { should == "ポニーテールの女の子の画像 11本目 - 2ch画像まとめ" }
12
+ its(:time ) { should == 1259455593 }
13
+ its(:count) { should == 150 }
14
+ end
15
+
16
+ describe "for deleted page" do
17
+ subject {
18
+ t = Pic2ch::Parsers::Thread.new(nil)
19
+ def t.html() data('deleted.html'); end
20
+ t
21
+ }
22
+
23
+ its(:title) { should == "この世のすべての女子高生画像を集めたい。 - 2ch画像まとめ" }
24
+
25
+ it "should raise NotFound when time is called" do
26
+ lambda { subject.time }.should raise_error(Pic2ch::Parsers::NotFound)
27
+ end
28
+
29
+ it "should raise DeletedPage when count is called" do
30
+ lambda { subject.count }.should raise_error(Pic2ch::Parsers::DeletedPage)
31
+ end
32
+ end
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pic2ch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - maiha
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-02 00:00:00 +09:00
12
+ date: 2010-02-09 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -49,6 +49,7 @@ files:
49
49
  - lib/pic2ch/pages/index.rb
50
50
  - lib/pic2ch/parsers/thread.rb
51
51
  - lib/pic2ch/parsers/index.rb
52
+ - lib/pic2ch/parsers/errors.rb
52
53
  - lib/pic2ch/downloaders.rb
53
54
  - lib/pic2ch/thread.rb
54
55
  - lib/pic2ch/downloaders/thread.rb
@@ -57,6 +58,12 @@ files:
57
58
  - lib/pic2ch/parsers.rb
58
59
  - lib/pic2ch/cached_accessor.rb
59
60
  - lib/pic2ch/pages.rb
61
+ - spec/provide_helper.rb
62
+ - spec/fixtures/deleted.html
63
+ - spec/fixtures/36603.html
64
+ - spec/its_helper.rb
65
+ - spec/spec_helper.rb
66
+ - spec/thread_parser_spec.rb
60
67
  has_rdoc: true
61
68
  homepage: http://github.com/maiha/pic2ch
62
69
  licenses: []