fix some more XPaths

This commit is contained in:
Andrew Cantino 2014-07-30 14:05:40 -07:00
parent 47eee57a99
commit ebe302492d
3 changed files with 10 additions and 10 deletions

View file

@ -31,9 +31,9 @@ unless user.agents.where(:name => "XKCD Source").exists?
'mode' => "on_change",
'expected_update_period_in_days' => 5,
'extract' => {
'url' => { 'css' => "#comic img", 'attr' => "src" },
'title' => { 'css' => "#comic img", 'attr' => "alt" },
'hovertext' => { 'css' => "#comic img", 'attr' => "title" }
'url' => { 'css' => "#comic img", 'value' => "@src" },
'title' => { 'css' => "#comic img", 'value' => "@alt" },
'hovertext' => { 'css' => "#comic img", 'value' => "@title" }
}
}).save!
end
@ -47,8 +47,8 @@ unless user.agents.where(:name => "iTunes Trailer Source").exists?
'type' => "xml",
'expected_update_period_in_days' => 5,
'extract' => {
'title' => { 'css' => "item title", 'text' => true},
'url' => { 'css' => "item link", 'text' => true}
'title' => { 'css' => "item title", 'value' => ".//text()"},
'url' => { 'css' => "item link", 'value' => ".//text()"}
}
}).save!
end

View file

@ -22,8 +22,8 @@ describe Utils do
Utils.unindent("Hello\n I am indented").should == "Hello\n I am indented"
a = " Events will have the fields you specified. Your options look like:\n\n {\n \"url\": {\n \"css\": \"#comic img\",\n \"attr\": \"src\"\n },\n \"title\": {\n \"css\": \"#comic img\",\n \"attr\": \"title\"\n }\n }\"\n"
Utils.unindent(a).should == "Events will have the fields you specified. Your options look like:\n\n {\n \"url\": {\n\"css\": \"#comic img\",\n\"attr\": \"src\"\n },\n \"title\": {\n\"css\": \"#comic img\",\n\"attr\": \"title\"\n }\n }\""
a = " Events will have the fields you specified. Your options look like:\n\n {\n \"url\": {\n \"css\": \"#comic img\",\n \"value\": \"@src\"\n },\n \"title\": {\n \"css\": \"#comic img\",\n \"value\": \"@title\"\n }\n }\"\n"
Utils.unindent(a).should == "Events will have the fields you specified. Your options look like:\n\n {\n \"url\": {\n\"css\": \"#comic img\",\n\"value\": \"@src\"\n },\n \"title\": {\n\"css\": \"#comic img\",\n\"value\": \"@title\"\n }\n }\""
end
end
@ -114,4 +114,4 @@ describe Utils do
cleaned_json.should include("<\\/script>")
end
end
end
end

View file

@ -751,8 +751,8 @@ describe AgentDrop do
url: 'http://xkcd.com/',
mode: 'on_change',
extract: {
url: { css: '#comic img', attr: 'src' },
title: { css: '#comic img', attr: 'alt' },
url: { css: '#comic img', value: '@src' },
title: { css: '#comic img', value: '@alt' },
},
},
schedule: 'every_1h',