For an API you also need a proxy oAuth is just an authentication protocol for using a service without sharing credentials. It is easier for developers to monitor data coming in and out from an endpoint.The issue is that with regular bots you need proxy, but with API you can use oauth, which means you have much-much less risk. What do you think?
Screw apis. I hate them! There are always too many hoops to jump.
I prefer botting without using api. The benefit you get from working with an api I find negligible with the added hoops they put in place for you to jump.
For an API you also need a proxy oAuth is just an authentication protocol for using a service without sharing credentials. It is easier for developers to monitor data coming in and out from an endpoint.
When you use computer vision you are blending in with everyone else.
Is it more difficult to do? Yes.
Is it more effective than an API in terms of speed and resources? No
Will it last longer than an API? Yes
Is the scalability good?No
If you are looking for stability computer vision should be the route for any bot maker. Thing is lots of bot makers just make it using API because they plan on selling it to users and therefore make money from that instead of the bot it self. Using an API would make it more easier to scale.
But if you want to use the bot yourself and use it for the service you want to bot then computer vision is the safest.
# -*- coding: utf-8 -*-
import requests
import json
import re
import time
import urllib
import random
import sys
import base64
reload(sys)
sys.setdefaultencoding('utf8')
def get_file_contents(filePath):
with open(filePath, 'r') as fp:
return fp.read()
def put_file_contents(filePath,str):
with open(filePath, 'w') as fp:
return fp.write(str)
def Pin(cookies,header,advertiser,news,board_id='xxx'):
data = '{"options":{"board_id":"xxx","field_set_key":"create_success_with_upsell","skip_pin_create_log":true,"description":"xxxx","link":"xx.html","title":"xxx","image_url":"xxx72713.jpg","method":"scraped","scrape_metric":{"source":"www_url_scrape"}},"context":{"advertiser":{"id":"1111","owner_user_id":"111","name":"xxx","country":1,"currency":1,"currency_code":"USD","billing_type":null,"created_time":1557227067,"accepted_tos":[8],"inactive_advertisers":[],"actions":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"is_sterling_prod":false,"ad_groups_enabled":true,"bulk_v2_shopping_enabled":true,"ocpm_conversion_window_enabled":false,"landing_page_view_enabled":false,"enable_shopping_reporting":true,"enable_sterling_gdpr_modal":true,"enable_loi_sapin_modal":false}}}'
#data = urllib.urlencode()
data = json.loads(data)
data['options']['board_id'] = board_id
data['options']['description'] = news['description']
data['options']['title'] = news['title']
data['options']['image_url'] = news['imgurl']
data['options']['link'] = news['jumpurl']
del(data['context']['advertiser'])
data['context']['id'] = advertiser['id']
data['context']['name'] = advertiser['name']
data['context']['owner_user_id'] = advertiser['owner_user_id']
data['context']['created_time'] = advertiser['created_time']
# print urllib.quote(json.dumps(data),safe='')
# exit()
post_data = "source_url=%2Fpin-builder%2F&data=" + urllib.quote(json.dumps(data),safe='')
#print post_data
a = requests.post("https://www.pinterest.com/_ngjs/resource/PinResource/create/",headers=header,data=post_data,cookies=cookies).text
#a = requests.post(baseUrl,data=post_data,headers=header,cookies=cookie).content
#print a
#print
data = json.loads(a)
print data
try:
if data['resource_response']['error']:
return data['resource_response']['error']['message_detail']
except Exception as e:
pass
return 'success'
test =requests.session()
header = {
'Origin': 'https://www.pinterest.com',
'X-APP-VERSION': '50accad',
'X-Pinterest-AppState': 'active',
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3029.110 Safari/687.36'",
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': "application/json, text/javascript, */*, q=0.01",
'Referer': 'https://www.pinterest.com/',
'Accept-Encoding': 'gzip, deflate',
'X-Requested-With': 'XMLHttpRequest',
'X-CSRFToken': '123456',
'DNT': '1',
}
Homeheader = {
'Origin': 'https://www.pinterest.com',
'X-APP-VERSION': '50accad',
'X-Pinterest-AppState': 'active',
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3029.110 Safari/687.36'",
'Content-Type': 'application/x-www-form-urlencoded',
'Referer': 'https://www.pinterest.com/',
'Accept-Encoding': 'gzip, deflate',
'X-CSRFToken': '',
'DNT': '1',
}
header['X-APP-VERSION'] = '799b80b'
cookies = json.loads(get_file_contents("pin_cookies2.txt")) #Write user cookies to pin_cookies2.txt
advertiser = {}
Homeheader['X-CSRFToken'] = cookies['csrftoken']
c = test.get("https://www.pinterest.com/settings/",headers=Homeheader,cookies=cookies).content
advert = re.compile(r"<script type=\"application/json\" id='jsInit1'>([\s\S]*?)</script>")
c = json.loads(advert.findall(c)[0])
advertiser['id'] = c['context']['advertiser']['id']
advertiser['owner_user_id'] = c['context']['advertiser']['owner_user_id']
advertiser['name'] = c['context']['advertiser']['name']
advertiser['created_time'] = c['context']['advertiser']['created_time']
header['X-CSRFToken'] = cookies['csrftoken']
news = {}
news['description'] = "xxxxxxxx"
news['title'] = "XXXXXXX"
news['imgurl'] = 'http://xxx.com/xxx.jpg'
news['jumpurl'] = 'http://xxx.com/xxx.html'
print Pin(cookies,header,advertiser,news)
Thank you! Do you also use it with API key?Code:# -*- coding: utf-8 -*- import requests
Hi,
I am thinking to build a bot for Pinterest posting. I have heard from different sources that it is the best to do it via API. I have some questions regarding to this.
1. How difficult it is to get API key? Are there any specific reasons why they reject the application?
2. Should there be a website / sales page built for the application for the API to show that it is a real service (not mentioning the bot)?
3. Can I buy such API key somewhere?
4. Does Pinterest regurarly check the service what you used to get the API key?
5. Are there any easy tricks to get the API key?
6. Any special rules to follow after receiving the API key (not to get banned from the API service)?
Thank you for any help!
wooster82
Thank you for your answer KevinRB! What did you see as a challange during the application? Did you just request access for a scheduler or built an own website for it?I am using the Pinterest api OAuth access for my custom scheduler, it works seamlessly, but if you try spamming it to death you still get your accounts banned just the same as any other access method....
Thank you for your answer KevinRB! What did you see as a challange during the application? Did you just request access for a scheduler or built an own website for it?
I know that good developers can do it and I'm also not a developer.I am not a coder....I knew exactly what I wanted my scheduler to do so I found an applications integration company similar to Zapier that already had an OAuth verified licence, then paid one of their developers to create and integrate my scheduler for me....I currently have 500+ accounts on my scheduler and it works absolutely perfectly.
I know that good developers can do it and I'm also not a developer.So you see that it's just matter of integration question or do I need to have some kind of official app?
I also agree that I don't need to pin 1000s of pins to spam, just do quality. Your answer is very interesting, please let me know your thoughts what I need to be careful about when creating my scheduler. Thank you!!!
IF you want to go down the OAuth verification route then you either need to create and get approved your own application....or do as I did and find a company that already has the OAuth licence. Personally, I went the company route, as when I had tested personal applications previously they take months to get approved, if they get approval at all....also, I believe it is far safer to be a "small fish in a big pool" than a "big fish in a small pool"....far more likely that Pinterest could revoke your personal application licence.
In terms of my scheduler, it is based around Google Drive....ALL the ingredients are there, but it is the skills set you need to join the scheduler and the Pinterest application together....I knew what I wanted from it....just didn't have a bloody clue as to how to do it.
Thank you for your reply! Very interesting!So if I understand well then your integration is more likely like Google Drive to a "Tool" which already has OAUTH access and the "Tool" is already integrated to Pinterest? Is my understanding correct? This way you are covered as many other users doing regular pinterest tasks with the given OAUTH...? Right?
a "tool" that links Google Drive to Pinterest OAuth = yes
rationale of "hiding" inamongst other Pinterest accounts using the same verified OAuth account = yes
Thank you KevinRB! One more thing, if you don't mind sharing.... How do you manage to add description to the pins... Is it somehow on google drive as well, or it's generated by the tool? Thanks!
Thank you KevinRB! One more thing, if you don't mind sharing.... How do you manage to add description to the pins... Is it somehow on google drive as well, or it's generated by the tool? Thanks!
Hi Kevin. I've got one more thing. Do you use google drive as a source of the images or you use your redirect domain for these? Thank you!Image url, descriptions + hashtags and source url are all inputted onto a Google Sheet, each account has it's own sheet, all the individual columns are then randomized each month so that the same descriptions/hashtags never appear on the same Pin more than once.
Hi Kevin. I've got one more thing. Do you use google drive as a source of the images or you use your redirect domain for these? Thank you!
One more thing if you don't mind sharing. If you create such integration then you can officially have 1 account at whatever "Zappier" for the 500 accounts OR you need to have 500 accounts at "Zappier" OR there is a trick somewhere in the code like including a special Pinterest key or something? Thanks!
Thank you Kevin. But in this case when you add the users 1 by 1 then your IP is not hidden so Pinterest probably can see that you are using the same ip 500 times via the integration supplier. Isn't it a problem?I have a single USER account with my integration supplier, every account has it's own "token" generated by OAuth verification....so as far as Pinterest is concerned there are 500+ individual accounts without any visible links between them.