Ejemplo n.º 1
0
def credentials(filename):

    path = locate(filename)

    with open(path, 'r') as f:
        content = f.readlines()
        content = [x.strip() for x in content]

    return (content)
####################################################################################
### Download influencers' posts

from Instagram.Admin.FileLocator import locate
from Instagram.InstaLogin import login, credentials
import os
import pandas
import pickle
import re
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time

influencers = ['barcelonafoodexperience']
driver = webdriver.Chrome(locate("chromedriver.exe"))

scroll_num = 3


def last_post(user):

    ## Find the last scrape file
    scrape_files = [
        x for x in os.listdir('Instagram\\Data') if x.endswith(".pkl")
    ]

    ## Unpickle the data
    with open('Instagram\\Data\\' + scrape_files[len(scrape_files) - 1],
              'rb') as pf:
        df = pickle.load(pf)