itunes_link_maker 1.0 → 1.0.1
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/lib/itunes_link_maker.rb +12 -16
- data/lib/result.rb +3 -9
- data/spec/fixtures/has_results.html +15 -485
- data/spec/fixtures/no_results.html +3 -263
- data/spec/itunes_link_maker_spec.rb +7 -7
- data/spec/result_spec.rb +2 -17
- metadata +31 -11
- data/spec/fixtures/result.html +0 -206
@@ -1,268 +1,8 @@
|
|
1
|
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
2
|
-
<HTML>
|
3
|
-
<HEAD>
|
4
|
-
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
5
|
-
<STYLE TYPE="text/css">
|
6
1
|
|
7
|
-
A {
|
8
|
-
text-decoration: none;
|
9
|
-
}
|
10
|
-
|
11
|
-
A:link {
|
12
|
-
color: #3366cc;
|
13
|
-
text-decoration: none;
|
14
|
-
}
|
15
|
-
|
16
|
-
A:visited {
|
17
|
-
color: #663399;
|
18
|
-
text-decoration: none;
|
19
|
-
}
|
20
|
-
|
21
|
-
A:active {
|
22
|
-
color: #cccccc;
|
23
|
-
text-decoration: none;
|
24
|
-
}
|
25
2
|
|
26
|
-
A:Hover {
|
27
|
-
text-decoration: underline;
|
28
|
-
}
|
29
3
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
color: #333333;
|
4
|
+
{
|
5
|
+
"resultCount":0,
|
6
|
+
"results": []
|
34
7
|
}
|
35
8
|
|
36
|
-
.body {
|
37
|
-
font-family: Geneva, Verdana, Arial, Helvetica;
|
38
|
-
font-size: 10px;
|
39
|
-
color: #333333;
|
40
|
-
}
|
41
|
-
|
42
|
-
.content {
|
43
|
-
font-family: Arial, Helvetica, sans-serif;
|
44
|
-
font-size: 11px;
|
45
|
-
font-weight: normal;
|
46
|
-
color: #000000;
|
47
|
-
}
|
48
|
-
|
49
|
-
.title {
|
50
|
-
font-family: Helvetica, Arial, sans-serif;
|
51
|
-
font-size: 10px;
|
52
|
-
font-weight: normal;
|
53
|
-
color: #000000;
|
54
|
-
}
|
55
|
-
|
56
|
-
td.searchResults {
|
57
|
-
border-style: solid;
|
58
|
-
border-right-width: 1px;
|
59
|
-
border-color: #cccccc;
|
60
|
-
}
|
61
|
-
|
62
|
-
div.searchResults {
|
63
|
-
margin: 0px 5px 0px 5px;
|
64
|
-
color: black;
|
65
|
-
}
|
66
|
-
|
67
|
-
.searchResults a {
|
68
|
-
color: black;
|
69
|
-
text-decoration: none;
|
70
|
-
}
|
71
|
-
|
72
|
-
.sr_goButton img {
|
73
|
-
vertical-align: middle;
|
74
|
-
}
|
75
|
-
|
76
|
-
.sr_goButton {
|
77
|
-
float: right;
|
78
|
-
vertical-align: middle;
|
79
|
-
}
|
80
|
-
|
81
|
-
</style>
|
82
|
-
|
83
|
-
<META NAME="ITMS Link Maker" CONTENT="WebObjects 5.2">
|
84
|
-
<TITLE>ITMS Link Maker</TITLE>
|
85
|
-
</HEAD>
|
86
|
-
|
87
|
-
<BODY BGCOLOR="#FFFFFF">
|
88
|
-
<TABLE HEIGHT="100%" WIDTH="100%">
|
89
|
-
<TR><TD ALIGN=CENTER VALIGN=TOP>
|
90
|
-
<br/><br/>
|
91
|
-
<form name="itmsLinkForm" method="get" action="/WebObjects/MZStoreServices.woa/wa/itmsSearch">
|
92
|
-
|
93
|
-
|
94
|
-
<input type=hidden value="ISO8859_1" name="WOURLEncoding">
|
95
|
-
<input type=hidden value="1" name="lang">
|
96
|
-
<input type="hidden" value="lm" name="output"/>
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
<TABLE WIDTH="448" BORDER="0" BORDERCOLOR="#CCCCCC" CELLSPACING="0" CELLPADDING="0">
|
102
|
-
|
103
|
-
<TR HEIGHT="36">
|
104
|
-
<TD ALIGN="center" WIDTH="721" HEIGHT="36"><img width="721" height="60" alt="" border="0" src="/images/linkmaker/linkmaker.gif"></TD>
|
105
|
-
</TR>
|
106
|
-
<TR HEIGHT="50">
|
107
|
-
<TD ALIGN="center" VALIGN="middle" WIDTH="721" HEIGHT="50" BACKGROUND="/images/linkmaker/bg_gray.gif">
|
108
|
-
<TABLE CELLSPACING=2 BORDER=0 CELLPADDING=2>
|
109
|
-
|
110
|
-
<TR><TD width="5%"/><TD width="90%"><BR>Welcome to iTunes Link Maker. This simple web interface will automatically generate html you can copy-and-paste into your own code to create deep links to any music on the iTunes Store. Simply enter a song name, album name, artist name, or any combination of the three to get started:</TD><TD width="5%"/></TR>
|
111
|
-
|
112
|
-
</TABLE><BR>
|
113
|
-
|
114
|
-
<TABLE WIDTH="608" BORDER="0" CELLSPACING="0" CELLPADDING="2">
|
115
|
-
<TR>
|
116
|
-
<TD VALIGN="bottom">
|
117
|
-
<FONT SIZE="2" FACE="Helvetica,Arial,Geneva,Swiss,SunSans-Regular"><B>
|
118
|
-
Country
|
119
|
-
</B></FONT>
|
120
|
-
</TD>
|
121
|
-
<TD VALIGN="bottom">
|
122
|
-
<FONT SIZE="2" FACE="Helvetica,Arial,Geneva,Swiss,SunSans-Regular"><B>
|
123
|
-
|
124
|
-
Search
|
125
|
-
</B></FONT>
|
126
|
-
</TD>
|
127
|
-
<TD VALIGN="bottom">
|
128
|
-
<FONT SIZE="2" FACE="Helvetica,Arial,Geneva,Swiss,SunSans-Regular"><B>
|
129
|
-
Media Type
|
130
|
-
</B></FONT>
|
131
|
-
</TD>
|
132
|
-
<TD></TD>
|
133
|
-
</TR>
|
134
|
-
|
135
|
-
<TR>
|
136
|
-
<TD VALIGN="top"><select name="country">
|
137
|
-
<option value="AU">Australia</option>
|
138
|
-
<option value="AT">Austria</option>
|
139
|
-
<option value="BE">Belgium</option>
|
140
|
-
<option value="CA">Canada</option>
|
141
|
-
<option value="DK">Denmark</option>
|
142
|
-
<option value="FI">Finland</option>
|
143
|
-
<option value="FR">France</option>
|
144
|
-
|
145
|
-
<option value="DE">Germany</option>
|
146
|
-
<option value="GR">Greece</option>
|
147
|
-
<option value="IE">Ireland</option>
|
148
|
-
<option value="IT">Italy</option>
|
149
|
-
<option value="JP">Japan</option>
|
150
|
-
<option value="LU">Luxembourg</option>
|
151
|
-
<option value="NL">Netherlands</option>
|
152
|
-
<option value="NZ">New Zealand</option>
|
153
|
-
<option value="NO">Norway</option>
|
154
|
-
|
155
|
-
<option value="PT">Portugal</option>
|
156
|
-
<option value="ES">Spain</option>
|
157
|
-
<option value="SE">Sweden</option>
|
158
|
-
<option value="CH">Switzerland</option>
|
159
|
-
<option value="GB">UK</option>
|
160
|
-
<option selected value="US">USA</option></select> </TD>
|
161
|
-
<TD VALIGN="top"><input size="22" type=text value="kafoozl" name="term"> </TD>
|
162
|
-
<TD VALIGN="top"><select name="media">
|
163
|
-
<option value="all">All Results</option>
|
164
|
-
|
165
|
-
<option selected value="music">Music</option>
|
166
|
-
<option value="movie">Movies</option>
|
167
|
-
<option value="shortFilm">Short Films</option>
|
168
|
-
<option value="tvShow">TV Shows</option>
|
169
|
-
<option value="musicVideo">Music Videos</option>
|
170
|
-
<option value="audiobook">Audiobooks</option>
|
171
|
-
<option value="podcast">Podcasts</option>
|
172
|
-
<option value="iTunesU">iTunes U</option></select> </TD>
|
173
|
-
<TD VALIGN="top"><span onClick="itmsLinkForm.submit();"><img src="/images/linkmaker/btn_search.gif"><span></TD>
|
174
|
-
|
175
|
-
</TR>
|
176
|
-
|
177
|
-
<TR height="90"><TD> </TD></TR>
|
178
|
-
|
179
|
-
</TABLE>
|
180
|
-
|
181
|
-
|
182
|
-
<TABLE CELLSPACING=2 BORDER=0 CELLPADDING=2>
|
183
|
-
<TR>
|
184
|
-
<TD>
|
185
|
-
<font color="#bbbbbb">Step 1: Enter the song, album, and/or artist to which you wish to link. Click "Search".</font><BR>
|
186
|
-
|
187
|
-
<font color="#bbbbbb">
|
188
|
-
Step 2: Click the drill down arrow
|
189
|
-
<IMG SRC="/images/linkmaker/arrow_999999_r.gif" BORDER=0 WIDTH=12 ALT="" HEIGHT=12/>
|
190
|
-
associated with a specific link on the page.
|
191
|
-
</font><BR>
|
192
|
-
<font color="#bbbbbb">Step 3: Copy and paste the HTML link into your web page.</font>
|
193
|
-
</TD>
|
194
|
-
</TR>
|
195
|
-
</TABLE>
|
196
|
-
|
197
|
-
<br/><br/>
|
198
|
-
</TD>
|
199
|
-
</TR>
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
<TR HEIGHT="13">
|
204
|
-
<TD ALIGN="center" VALIGN="top" WIDTH="721" HEIGHT="13">
|
205
|
-
<TABLE WIDTH="721" BORDER="0" CELLSPACING="0" CELLPADDING="0" HEIGHT="13">
|
206
|
-
<TR>
|
207
|
-
<TD><img width="247" height="13" alt="" border="0" src="/images/linkmaker/name.gif"></TD>
|
208
|
-
|
209
|
-
<TD><img width="246" height="13" alt="" border="0" src="/images/linkmaker/album.gif"></TD>
|
210
|
-
<TD><img width="228" height="13" alt="" border="0" src="/images/linkmaker/artist.gif"></TD>
|
211
|
-
</TR>
|
212
|
-
</TABLE>
|
213
|
-
</TD>
|
214
|
-
</TR>
|
215
|
-
<TR>
|
216
|
-
<TD ALIGN="center" VALIGN="top" WIDTH="721">
|
217
|
-
<TABLE CELLSPACING=1 CELLPADDING=0 BORDER=0 WIDTH=721 BACKGROUND="/images/linkmaker/bg_gray.gif"><tr><td>
|
218
|
-
|
219
|
-
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH="100%">
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
<TR HEIGHT="20"/>
|
224
|
-
|
225
|
-
</TABLE></td></tr></table>
|
226
|
-
</TD>
|
227
|
-
</TR>
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
<TR HEIGHT="28">
|
232
|
-
<TD ALIGN="center" VALIGN="middle" WIDTH="721" HEIGHT="28" BACKGROUND="/images/linkmaker/box_bottom.gif">
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
<TABLE WIDTH="180" BORDER="0" CELLSPACING="0" CELLPADDING="2"><TR>
|
237
|
-
<TD></TD>
|
238
|
-
<TD ALIGN="center"><FONT SIZE="1" FACE="Helvetica,Arial,Geneva,Swiss,SunSans-Regular"><B>
|
239
|
-
0 Hits
|
240
|
-
</B></FONT></TD>
|
241
|
-
<TD></TD>
|
242
|
-
</TR></TABLE>
|
243
|
-
|
244
|
-
|
245
|
-
</TD>
|
246
|
-
</TR>
|
247
|
-
|
248
|
-
</TABLE>
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
</form>
|
254
|
-
<P></P>
|
255
|
-
</TD></TR>
|
256
|
-
<TR><TD ALIGN=CENTER>
|
257
|
-
The iTunes Link Maker is provided by Apple as an accommodation only.<br>Apple assumes no responsibility for your use of any links, and makes no representation regarding their accuracy or performance. <br>Nothing shall be construed as permission or a grant by Apple in relation to the use of any artist, track or album name,<br> and you agree that any use by you, or result from your use, shall be solely your responsibility.<br>Apple reserves the right to de-activate links at its sole discretion.
|
258
|
-
<br/><br/>
|
259
|
-
|
260
|
-
|
261
|
-
<!-- <a href="MHITMSLinkGeneratorWrapper.FaqUrl">FAQ</a> | -->
|
262
|
-
<a href="mailto:musicstore@apple.com">Contact Us</a>
|
263
|
-
<BR>Copyright © 2008 Apple Inc. All rights reserved.</td></tr>
|
264
|
-
<img width="1" height="1" src="http://metrics.apple.com/b/ss/applesuperglobal/1/G.6--NS?pageName=Generator-US-term%3Akafoozl&pccr=true&h5=appleitmsna%2Cappleitmsus&g=http%3A%2F%2Fax.phobos.apple.com.edgesuite.net%2FWebObjects%2FMZStoreServices.woa%2Fwa%2FitmsSearch%3FWOURLEncoding%3DISO8859_1%26lang%3D1%26output%3Dlm%26country%3DUS%26term%3Dkafoozl%26media%3Dmusic">
|
265
|
-
|
266
|
-
</BODY>
|
267
|
-
</HTML>
|
268
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
2
|
|
3
3
|
describe ItunesLinkMaker do
|
4
|
-
|
4
|
+
before(:each) do
|
5
5
|
@open_result = mock('open result', :read => '')
|
6
6
|
ItunesLinkMaker.stub!(:open).and_return(@open_result)
|
7
7
|
end
|
@@ -20,7 +20,7 @@ describe ItunesLinkMaker do
|
|
20
20
|
|
21
21
|
it "should send a GET request to the iTunes search URL" do
|
22
22
|
ItunesLinkMaker.should_receive(:open).with(
|
23
|
-
"http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/itmsSearch?WOURLEncoding=ISO8859_1&lang=1&output=
|
23
|
+
"http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/itmsSearch?WOURLEncoding=ISO8859_1&lang=1&output=json&country=US&term=search+query&media=music"
|
24
24
|
).and_return(@open_result)
|
25
25
|
search
|
26
26
|
end
|
@@ -28,7 +28,7 @@ end
|
|
28
28
|
|
29
29
|
|
30
30
|
describe "Itunes link search with no hits" do
|
31
|
-
|
31
|
+
before(:each) do
|
32
32
|
@open_result = mock('open result', :read => read_fixture('no_results.html'))
|
33
33
|
ItunesLinkMaker.stub!(:open).and_return(@open_result)
|
34
34
|
end
|
@@ -44,7 +44,7 @@ end
|
|
44
44
|
|
45
45
|
|
46
46
|
describe "Itunes quick search with no hits" do
|
47
|
-
|
47
|
+
before(:each) do
|
48
48
|
@open_result = mock('open result', :read => read_fixture('no_results.html'))
|
49
49
|
ItunesLinkMaker.stub!(:open).and_return(@open_result)
|
50
50
|
end
|
@@ -60,7 +60,7 @@ end
|
|
60
60
|
|
61
61
|
|
62
62
|
describe "Itunes link search with multiple hits" do
|
63
|
-
|
63
|
+
before(:each) do
|
64
64
|
@open_result = mock('open result', :read => read_fixture('has_results.html'))
|
65
65
|
ItunesLinkMaker.stub!(:open).and_return(@open_result)
|
66
66
|
end
|
@@ -76,7 +76,7 @@ end
|
|
76
76
|
|
77
77
|
|
78
78
|
describe "Itunes quick search with multiple hits" do
|
79
|
-
|
79
|
+
before(:each) do
|
80
80
|
@open_result = mock('open result', :read => read_fixture('has_results.html'))
|
81
81
|
ItunesLinkMaker.stub!(:open).and_return(@open_result)
|
82
82
|
end
|
@@ -86,7 +86,7 @@ describe "Itunes quick search with multiple hits" do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should return the result object" do
|
89
|
-
expected = ItunesLinkMaker::Result.new('Such Great Heights', :name, '/
|
89
|
+
expected = ItunesLinkMaker::Result.new('Such Great Heights', :name, 'http://itunes.apple.com/us/album/such-great-heights/id2522333?i=2522315&uo=4')
|
90
90
|
quick_search.should == expected
|
91
91
|
end
|
92
92
|
end
|
data/spec/result_spec.rb
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
2
|
|
3
3
|
describe ItunesLinkMaker::Result do
|
4
|
-
setup do
|
5
|
-
@open_result = mock('open result', :read => read_fixture('result.html'))
|
6
|
-
end
|
7
4
|
|
8
5
|
def create_result(options={})
|
9
6
|
options = {
|
10
7
|
:name => 'Such Great Heights',
|
11
8
|
:type => :name,
|
12
|
-
:display_url => '/WebObjects/
|
9
|
+
:display_url => 'http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=2522315&id=2522333&s=143441'
|
13
10
|
}.merge(options)
|
14
11
|
|
15
12
|
ItunesLinkMaker::Result.new(options[:name], options[:type], options[:display_url])
|
@@ -48,12 +45,6 @@ describe ItunesLinkMaker::Result do
|
|
48
45
|
r1.should_not eql(r2)
|
49
46
|
end
|
50
47
|
|
51
|
-
it "should GET the display page when accessing the url" do
|
52
|
-
r = create_result
|
53
|
-
r.should_receive(:open).with("http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/itmsSearchDisplayUrl?desc=The+Postal+Service+-+Give+Up+-+Such+Great+Heights&WOURLEncoding=ISO8859_1&lang=1&url=http%3A%2F%2Fphobos.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewAlbum%3Fi%3D2522315%26id%3D2522333%26s%3D143441").and_return(@open_result)
|
54
|
-
r.url
|
55
|
-
end
|
56
|
-
|
57
48
|
it "should return the correct url" do
|
58
49
|
r = create_result
|
59
50
|
r.stub!(:open).and_return(@open_result)
|
@@ -66,11 +57,5 @@ describe ItunesLinkMaker::Result do
|
|
66
57
|
r3 = create_result(:name => 'Different')
|
67
58
|
[r1, r2, r3].uniq.should == [r1, r3]
|
68
59
|
end
|
69
|
-
|
70
|
-
it "should cache the url" do
|
71
|
-
r = create_result
|
72
|
-
r.should_receive(:open).once.and_return(@open_result)
|
73
|
-
r.url
|
74
|
-
r.url
|
75
|
-
end
|
60
|
+
|
76
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itunes_link_maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 1.0.1
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Sam Pohlenz
|
@@ -9,10 +14,23 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-05-06 00:00:00 +09:30
|
13
18
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: json
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 0
|
30
|
+
- 0
|
31
|
+
version: 1.0.0
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
16
34
|
description:
|
17
35
|
email: sam@sampohlenz.com
|
18
36
|
executables: []
|
@@ -24,8 +42,10 @@ extra_rdoc_files: []
|
|
24
42
|
files:
|
25
43
|
- lib/itunes_link_maker.rb
|
26
44
|
- lib/result.rb
|
27
|
-
has_rdoc:
|
45
|
+
has_rdoc: true
|
28
46
|
homepage: http://itms-link-maker.rubyforge.org/
|
47
|
+
licenses: []
|
48
|
+
|
29
49
|
post_install_message:
|
30
50
|
rdoc_options: []
|
31
51
|
|
@@ -35,26 +55,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
35
55
|
requirements:
|
36
56
|
- - ">="
|
37
57
|
- !ruby/object:Gem::Version
|
58
|
+
segments:
|
59
|
+
- 0
|
38
60
|
version: "0"
|
39
|
-
version:
|
40
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
62
|
requirements:
|
42
63
|
- - ">="
|
43
64
|
- !ruby/object:Gem::Version
|
65
|
+
segments:
|
66
|
+
- 0
|
44
67
|
version: "0"
|
45
|
-
version:
|
46
68
|
requirements: []
|
47
69
|
|
48
70
|
rubyforge_project: itms-link-maker
|
49
|
-
rubygems_version: 1.
|
71
|
+
rubygems_version: 1.3.6
|
50
72
|
signing_key:
|
51
|
-
specification_version:
|
73
|
+
specification_version: 3
|
52
74
|
summary: Create iTunes links
|
53
75
|
test_files:
|
54
|
-
- spec/fixtures
|
55
76
|
- spec/fixtures/has_results.html
|
56
77
|
- spec/fixtures/no_results.html
|
57
|
-
- spec/fixtures/result.html
|
58
78
|
- spec/itunes_link_maker_spec.rb
|
59
79
|
- spec/result_spec.rb
|
60
80
|
- spec/spec_helper.rb
|