def __create_obj(self):
     self.__pinterest = Pinterest(email=self.__cfg['email'],
                                  password=self.__cfg['password'],
                                  username=self.__cfg['username'],
                                  cred_root=self.__cfg['cred_root'],
                                  user_agent=self.__cfg['user_agent'])
     self.__pinterest.login()
     self.__logger.info(f"{self.__cfg['username']} login")
     self.__boards = self.__pinterest.boards()
示例#2
0
def lox():
    pinterest = Pinterest(email='*****@*****.**',
                          password='******',
                          username='******',
                          cred_root='logs/')

    search_batch = pinterest.search(query='neko chan', scope='pins')
    print(search_batch)

    neko = nekos.img(target='neko')
    print(neko)
示例#3
0
api.update_with_media(temp, status=msg)
os.remove(temp)

# # Instagram

bot = instabot.Bot()
bot.login(username="******", password="******")
temp = 'temp.jpg'
request = requests.get(thumb, stream=True)

with open(temp, 'wb') as image:
    for chunk in request:
        image.write(chunk)
bot.upload_photo(temp, caption=msg)
os.remove(temp + ".REMOVE_ME")

# # Pinterest

pinterest = Pinterest(email='*****@*****.**',
                      password='******',
                      username='******',
                      cred_root='cred_dir')

pinterest.login()
pinterest.pin(board_id="802203821065010593",
              image_url=thumb,
              description=msg,
              title=title,
              link=current_post_url)
示例#4
0
from py3pin.Pinterest import Pinterest

username = '******'
password = '******'
email = 'email'
cred_root = 'some directory'
# cred_root is the place the user sessions and cookies will be stored, you should specify this to avoid permission issues
pinterest = Pinterest(email=email,
                      password=password,
                      username=username,
                      cred_root='/home/kashon/py3pin')


def login():
    # don't spam this, or they will lock the account
    return pinterest.login()


def get_user_profile():
    return pinterest.get_user_overview()


def get_user_boards():
    # load specific user boards
    # board_batch = pinterest.boards(username='******')

    # load current user boards
    boards = []
    board_batch = pinterest.boards()
    while len(board_batch) > 0:
        boards += board_batch
示例#5
0
from py3pin.Pinterest import Pinterest

username = '******'
password = '******'
email = 'email'
# cred_root is the place the user sessions and cookies will be stored you should specify this to avoid permission issues
cred_root = 'cred_root'

pinterest = Pinterest(email=email,
                      password=password,
                      username=username,
                      cred_root=cred_root)


# get the user id by username
def get_user_id(username):
    return pinterest.get_user_overview(username=username)['id']


# Pinterest conversations are stored in a list of conversation object on their side.
# Each converastion has id and last message they use to display on the initial drop down once you click the message button
def get_all_conversations():
    return pinterest.get_conversations()


# Once you obtain a conversation id, only then you can see all the messages and participants in it.
def load_conversation(conversation_id):
    return pinterest.load_conversation(conversation_id=conversation_id)


# in order to have conversation with some one, it needs to be initialized once with some initial message
示例#6
0
    '2020-04-07', '2020-04-08', '2020-04-09', '2020-04-10', '2020-04-11',
    '2020-04-12', '2020-04-13', '2020-04-14', '2020-04-15', '2020-04-16',
    '2020-04-17', '2020-04-18', '2020-04-19', '2020-04-20', '2020-04-21',
    '2020-04-22', '2020-04-23', '2020-04-24', '2020-04-27', '2020-04-28',
    '2020-04-29', '2020-04-30', '2020-05-01', '2020-05-02', ''
]

import requests
import datetime
import sys
from time import sleep
from py3pin.Pinterest import Pinterest
from PIL import Image, ImageDraw, ImageFont

pinterest = Pinterest(email='*****@*****.**',
                      password='******',
                      username='******')
try:
    pinterest.login()
except:
    print("Pas besoin de connection.")

journaldespace_url = 'https://imobinfo.com/Actualites.html'

nasa = 'https://api.nasa.gov/planetary/apod'
nasa_params = {
    'api_key': 'IqWPpNh7NbhokTuyrrkaJqjXXXHkShByHQ5uta7h',
}
yandex = 'https://translate.yandex.net/api/v1.5/tr.json/translate'
yandex_params = {
    'key':
示例#7
0
def getPinterestUserPinnedSubmissions(email, username, password,
                                      cacheFileName):

    submissions = []

    lastIds = {} if not cacheFileName else loadPinterestCache(cacheFileName)
    updatedLastIds = lastIds

    pinterest = Pinterest(email=email,
                          password=password,
                          username=username,
                          cred_root='pinterest_creds')

    logger.log("Logging in to Pinterest...")
    pinterest.login()

    boards = pinterest.boards(username=username)

    for board in boards:
        # Get all pins for the board
        board_pins = []
        pin_batch = pinterest.board_feed(board_id=board['id'])

        while len(pin_batch) > 0:
            for pin in pin_batch:
                if pin['id'] not in lastIds:
                    # Only using the dict for its key lookup
                    updatedLastIds[pin['id']] = 1
                    board_pins.append(pin)

            pin_batch = pinterest.board_feed(board_id=board['id'])

        for pin in board_pins:

            # I'm not sure how important it is to support these
            if pin['type'] == 'story':
                continue

            newSubmission = Submission()
            newSubmission.source = u'Pinterest'
            # While pins do have titles, 90% of the time they seem useless
            newSubmission.title = pin['id']
            # There is probably a way to figure out who the original pinner is, but oh well
            newSubmission.author = 'N/A'
            newSubmission.subreddit = board['url']
            newSubmission.subredditTitle = board['name'] + '_Pinterest'
            if 'rich_summary' in pin and pin['rich_summary']:
                if 'display_description' in pin['rich_summary']:
                    newSubmission.body = pin['rich_summary'][
                        'display_description']
                else:
                    newSubmission.body = 'N/A'
                newSubmission.postUrl = pin['rich_summary']['url']

            # What is actually downloaded
            newSubmission.bodyUrl = pin['images']['orig']['url']
            submissions.append(newSubmission)

    if cacheFileName:
        savePinterestCache(cacheFileName, updatedLastIds)

    logger.log("Found {} new Pinterest submissions".format(len(submissions)))
    return submissions
示例#8
0
from py3pin.Pinterest import Pinterest

pinterest = Pinterest(email='email',
                      password='******',
                      username='******',
                      cred_root='cred_root')

# proxies example:
# proxies = {"http":"http://*****:*****@proxy_ip:proxy_port"}
# Pinterest(email='emai', password='******', username='******', cred_root='cred_root', proxies=proxies)

# login will obtain and store cookies for further use, they last around 15 days.
# NOTE: Since login will store the cookies in local file you don't need to call it more then 3-4 times a month.
# pinterest.login()


def get_user_profile():
    return pinterest.get_user_overview(username='******')


def get_user_boards_batched(username=None):
    boards = []
    board_batch = pinterest.boards(username=username)
    while len(board_batch) > 0:
        boards += board_batch
        board_batch = pinterest.boards(username=username)

    return boards


def get_boards(username=None):
示例#9
0
def autoload(ch):
    global config
    global pinterest
    ch.add_command({
        "trigger": ["!debug_prt"],
        "function":
        lambda message, client, args: get_boards(args[0]),
        "async":
        False,
        "admin":
        False,
        "hidden":
        True,
        "args_num":
        1,
        "args_name": ["username"],
        "description":
        "Return a random image from the board specified",
    })
    ch.add_command({
        "trigger": ["!prt"],
        "function":
        pinterest_randomize_function,
        "async":
        True,
        "admin":
        False,
        "hidden":
        True,
        "args_num":
        2,
        "args_name": ["username", "board"],
        "description":
        "Return a random image from the board specified",
    })
    ch.add_command({
        "trigger": ["!possum"],
        "function":
        lambda message, client, args: pinterest_randomize_function(
            message, client, ["jerryob1", "Opossums"]),
        "async":
        True,
        "admin":
        False,
        "hidden":
        False,
        "args_num":
        0,
        "args_name": ["username", "board"],
        "description":
        "Return a random image from the board specified",
    })
    # for guild in ch.guilds:
    #     for ch.config.get(guild=guild, section="pinterest"):
    pinterest = Pinterest(
        email=ch.config.get(section="pinterest", key="email"),
        password=ch.config.get(section="pinterest", key="password"),
        username=ch.config.get(section="pinterest", key="username"),
        cred_root=ch.config.get(section="pinterest", key="tmpdir"),
    )
    if datetime.datetime.now() == 8:
        pinterest.login()
示例#10
0
import requests
import datetime
import sys
from time import sleep
from py3pin.Pinterest import Pinterest
from PIL import Image, ImageDraw, ImageFont

pinterest = Pinterest(email='*****@*****.**',
                      password='',
                      username='******')
try:
    pinterest.login()
except:
    print("Pas besoin de connection.")

journaldespace_url = 'https://imobinfo.com/Actualites.html'

nasa = 'https://api.nasa.gov/planetary/apod'
nasa_params = {
    'api_key': 'IqWPpNh7NbhokTuyrrkaJqjXXXHkShByHQ5uta7h',
}
yandex = 'https://translate.yandex.net/api/v1.5/tr.json/translate'
yandex_params = {
    'key': 'trnsl.1.1.20200425T200440Z.7d571882c8635b32.294ccd14fcf7788229ebe858e87a212d4f8541ff',
    'lang': 'en-fr'
}

# test tienthinht
# board_id = '672303119313037233'
# test
# board_id = '637400222200883386'
示例#11
0
from py3pin.Pinterest import Pinterest
import requests

download_dir = './img/'

img_id = 1

pinterest = Pinterest(email='@gmail.com',
                      password='',
                      username='',
                      cred_root='./img')

# your boards, pick one
boards = pinterest.boards()

# for example the first one
target_board = boards[0]

# get all pins for the board
board_pins = []
pin_batch = pinterest.board_feed(board_id=target_board['id'])


while len(pin_batch) > 0:
    board_pins += pin_batch
    pin_batch = pinterest.board_feed(board_id=target_board['id'])


# this can download images by url
def download_image(url, path):
    r = requests.get(url=url, stream=True)
示例#12
0
from py3pin.Pinterest import Pinterest

pinterest = Pinterest(email='email',
                      password='******',
                      username='******',
                      cred_root='cred_root')

# to release
# python3 setup.py sdist & twine upload --skip-existing dist/*
# proxies example:
# proxies = {"http":"http://*****:*****@proxy_ip:proxy_port"}
# Pinterest(email='emai', password='******', username='******', cred_root='cred_root', proxies=proxies)


# login will obtain and store cookies for further use, they last around 15 days.
# NOTE: Since login will store the cookies in local file you don't need to call it more then 3-4 times a month.
# pinterest.login()

def get_user_profile():
    return pinterest.get_user_overview(username='******')


def get_user_boards_batched(username=None):
    boards = []
    board_batch = pinterest.boards(username=username)
    while len(board_batch) > 0:
        boards += board_batch
        board_batch = pinterest.boards(username=username)

    return boards
示例#13
0
from py3pin.Pinterest import Pinterest

pinterest = Pinterest(email='*****@*****.**',
                      password='******',
                      username='******')

pinterest = Pinterest(email='*****@*****.**',
                      password='******',
                      username='******')

print(pinterest.login())


def get_user_profile():
    return pinterest.get_user_overview(username='******')


def get_user_boards(username=None):
    boards = []
    board_batch = pinterest.boards(username=username)
    while len(board_batch) > 0:
        boards += board_batch
        board_batch = pinterest.boards(username=username)

    return boards


def get_board_pins(board_id=''):
    board_feed = []
    feed_batch = pinterest.board_feed(board_id=board_id)
    while len(feed_batch) > 0:
from py3pin.Pinterest import Pinterest
import time
import requests
from requests.exceptions import ConnectionError
import os

countrSkip = 0
countrDnld = 0
download_dir = './pinterest_images/'
if not os.path.exists(download_dir):
    os.makedirs(download_dir)

pinterest = Pinterest(email='your_email',
                      password='******',
                      username='******',
                      cred_root='cred_root')

# your boards, pick one
boards = pinterest.boards()

# delme
for board in boards:
    target_board = board
    print(target_board['name'])
    if not os.path.exists(download_dir + target_board['name']):
        os.makedirs(download_dir + target_board['name'])

    # get all pins for the board
    board_pins = []
    pin_batch = pinterest.board_feed(board_id=target_board['id'])
示例#15
0
from py3pin.Pinterest import Pinterest
from PIL import Image
import requests
from io import BytesIO


def download_image(url, path):
    r = requests.get(url=url, stream=True)
    if r.status_code == 200:
        with open(path, 'wb') as f:
            for chunk in r.iter_content(1024):
                f.write(chunk)


pinterest = Pinterest(email='*****@*****.**',
                      password='******',
                      username='******',
                      cred_root='cred_root')

allpins = pinterest.search(scope='pins', query='something')
images = []
for pin in allpins:
    origUrl = pin['images']['orig']['url']
    images.append(origUrl)

i = 0
for url in images:
    #indx = str(url).rfind('.')
    #extension = str(url)[indx:]
    #download_image(url,  "img/" + str(i) + extension)
    response = requests.get(url)
    img = Image.open(BytesIO(response.content))
    print('Section count: ' + str(board['section_count']) + ' ')


def dump_board(file, board):
    if board['owner']['username'] == sai.USER:
        print_board(board)
        title = '<h1>' + str(board['name']) + '</h1>'
        data = '<div>' + str(board['pin_count']) + ' pins</div>'
        data += '<div>' + str(board['section_count']) + ' sections</div>'
        board_data = title + data + '\r\n'
        file.write(board_data)
        fetch_pins(file, board)


pinterest = Pinterest(email=sai.EMAIL,
                      password=sai.PWD,
                      username=sai.USER,
                      cred_root='cred_root')

# your boards
boards = pinterest.boards()

file = open('./index.html', "w+", encoding="utf-8")
file.write(
    '<html lang="en"><head><meta charset="UTF-8"><title>Pinterest Archive</title></head><body>\r\n'
)
for board in boards:
    dump_board(file, board)
    file.flush()

file.write('</body>')
file.close()