From cb80249baf93e2df83d505940f5f455effd4a513 Mon Sep 17 00:00:00 2001 From: alperenp Date: Mon, 23 Mar 2015 22:06:14 +0200 Subject: [PATCH] tumblr added --- lib/tumblr.js | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 lib/tumblr.js diff --git a/lib/tumblr.js b/lib/tumblr.js new file mode 100644 index 0000000..7b786c4 --- /dev/null +++ b/lib/tumblr.js @@ -0,0 +1,69 @@ +/* +* +* Date Created : 21.03.2015 +* Date Modified: 22.03.2015 +* Author : N. Alperen Pulur +* +*/ + +{ + search:[ + { + type:'contact', + query:'https://www.tumblr.com/search/{{term}}', + translate:'parseHTML(response)', + name:{ + selector:'.title', + expression:'element.textContent' + }, + // Eliminated description part because not all of query results have description + // therefore it may cause shifted description items within the array + /*description:{ + selector:'.description_inner', + expression:'element.textContent' + },*/ + link:{ + selector:'.full_url', + expression:'element.textContent' + } + , + image:{ + selector:'.search_blogs_row .square a img', + expression:'element.getAttribute("src")' + } + }, + + { + type:'post', + query:'https://www.tumblr.com/search/{{term}}', + translate:'parseHTML(response)', + + // name : author of the post + name:{ + selector:'.post_info_tumblelog', + expression:'element.textContent' + }, + // Again eliminated since there may or may not existing descriptions per post + // So it is better not to include them in query + /* + description:{ + selector:'.post_body', + expression:'element.textContent.substring(0, $(element).text().length - 14)' + }, + + // also added hashtag segment in case of requirement later + // returns list of hashtags + // at each index it is able to be reached hashtag by 'element.textContent' + hashtag:{ + selector:'.draggable .post_tags_inner a', + expression:'element' + },*/ + + // the link for the post + link:{ + selector:'.post_info_tumblelog', + expression:'element.getAttribute("href");' + } + } + ] +} \ No newline at end of file