如何在Pinterest上按照Repin数量筛选Pins

电商经验 Alan 8年前 (2016-02-29) 7945次浏览 0个评论 扫描二维码

在使用Pinterest时我们常常希望通过Repin数量来对当前Board或搜索页面进行筛选,以便查找到最受欢迎的图片。但是Pinterest自带的Smart Feed算法并不提供这种功能,那么如何实现这一功能呢?

Alan在github上找到了一段有效的代码,使用便捷,在这里分享给大家。

//Go to any page with pins (a board, your pins, search results, etc) and open JavaScript Console (Ctrl+Shift+J on windows OR option+command+J on mac) and paste in this code:

//sort by repins, adjust amount of pins/pages you want to collect first
var pages = 5;
var count = 0;
var mylist = [];
var timeout;
load();

function load(){ 

  $('.Pin').each(function(){ 
    mylist.push( $(this)[0] ) 
  });

  $(window).scrollTop( $(document).height() );

  timeout = window.setTimeout(load, 4000);

  count++;
  if(count==pages){
  	finish();
  }
}

function finish(){ 
	window.clearTimeout(timeout)
	console.log(mylist.length);

	var list = mylist.filter(function(f){ 
	  if( $(f).find('.repinCountSmall').length>0 ){
	    return f;
	  } 
	});

	console.log(list);

	list.sort(function(a, b) {
	   var compA = Number( $(a).find('.repinCountSmall').text().trim() );
	   var compB = Number( $(b).find('.repinCountSmall').text().trim() );
	   return (compA == compB) ? 0 : (compA > compB) ? -1 : 1;
	});

	$(".Grid").before('
<div id="organized"/>').remove();

	$.each(list, function(idx, itm) { 
	  $("#organized").append($(itm)); 
	});

	$('.Pin').css({'clear': 'both', 'position': 'static'});
}

代码链接:https://gist.github.com/techslides/dc74848ea7bd5b2a46e9

使用方法很简单,以Chrome为例,首先在Pinterest中打开想要筛选的页面或Board,然后按下Ctrl+Shift+J或option+command+J快捷键打开Console界面,拷贝上述代码按下Enter执行即可。代码中的pages变量可用于自定义想要筛选的总页面数。

以下是对Pets搜索结果进行筛选后的效果:

如何在Pinterest上按照Repin数量筛选Pins

举一反三

以上代码解决了按照Repin排序的问题,那如果我想要按照Like的数量排序又该如何实现呢?其实很简单,只需将原代码中的repinCountSmall替换为likeCountSmall就可以了,同理按评论数排序替换成commentCountSmall,是不是很简单呢?

如何在Pinterest上按照Repin数量筛选Pins

 

Update on Apr 22, 2017

在Google Chrome上通过Pinontop插件可以轻松地实现这一功能

如何在Pinterest上按照Repin数量筛选Pins

安装后可通过点击工具栏中的图标来选择查看页数以及排序方式:

如何在Pinterest上按照Repin数量筛选Pins

 

喜欢 (2)
[]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址