Pinterest Question

kegnum

Senior Member
Joined
May 13, 2009
Messages
1,156
Reaction score
580
Ok I have a list of image urls that I scraped from Google. Looking for a bot or an imacros script to grab the link from a list add it to pinterest, post a description and change the original image link to my site. Any ideas?
 
Well i've quickly coded simple Python script for some pinning, didn't used it for a while but you get the basic idea.

Code:
import cookielib
import re
import urllib
import urllib2

URL_LOGIN = 'https://pinterest.com/login/?next=/'
URL_LOGIN2 = 'https://pinterest.com/login/?next=%2Flogin%2F'
URL_PIN_CREATE = 'http://pinterest.com/pin/create/button/'

email = ''
password = ''

board_id = ''
url = ''
img_url = ''
desc = ''

# LOGIN
cj = cookielib.MozillaCookieJar('cookies.txt')
opener = urllib2.build_opener(
** *urllib2.HTTPRedirectHandler(),
** *urllib2.HTTPHandler(debuglevel=0),
** *urllib2.HTTPSHandler(debuglevel=0),
** *urllib2.HTTPCookieProcessor(cj)
)
opener.addheaders = [('User-agent', ('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)'))]
response = opener.open(URL_LOGIN)
matches = re.search("name='csrfmiddlewaretoken' value='(.*?)'", html)
token = matches.group(1)
form_data = urllib.urlencode({
** *'email':email,
** *'password':password,
** *'next':'/',
** *'csrfmiddlewaretoken':token
})
response = opener.open(URL_LOGIN2, form_data)

# PIN CREATE
form_data = urllib.urlencode({
** *'board':board_id,
** *'media_url':img_url,
** *'url':url,
** *'caption':desc,
** *'csrfmiddlewaretoken':token,
** *'form_url':'/pin/create/button/?'
})
response = opener.open(URL_PIN_CREATE, form_data)
 
Add me on skype, I might be able to help you out.
 
Back
Top