Giter Club home page Giter Club logo

automacaoinstagram's Introduction

👋 Hi there, my name is Pedro! Check my Linkedin profile and connect with me

🌱 I’m currently learning software development fundamentals as a cadet at 42|SP.

🤔 I’m looking for help with good ideas and inspiration.

⚡ Fun fact: I have a degree in Nutrition Science, and I love surfing and listen to music.


🏅 Skills/Experiences

static badge static badge static badge static badge static badge static badge static badge



📖 Learning

static badge static badge static badge



🛠️ Tools

static badge static badge static badge static badge



4️⃣2️⃣ projects

Libft



I swimmed at 4️⃣2️⃣ piscine in June 2023



My stats


Snake animation

automacaoinstagram's People

Contributors

pedromelocf avatar

Watchers

 avatar

automacaoinstagram's Issues

Amigo voce pode me ajudar?

Peguei seu codigo pelo youtube, voce respondeu minha msg...
Depois que peguei o código tive que fazer varias alteraçoes devido a versão dos componentes e packs usados... tive dificuldade em capturar o xpath
O código ficou assim...

import random
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from time import sleep
from random import randint

chrome_driver_path = "chromedriver.exe"
chrome_options = Options()
chrome_options.add_argument("--lang=en-US")
chrome_service = Service(executable_path=chrome_driver_path)
driver = webdriver.Chrome(service=chrome_service, options=chrome_options)
driver.get('https://www.instagram.com/accounts/login/')
sleep(randint(3, 6))

usuario = driver.find_element(By.NAME, "username")
usuario.send_keys('user')
senha = driver.find_element(By.NAME, "password")
senha.send_keys('senha')

button_login = driver.find_element(By.CSS_SELECTOR, '#loginForm > div > div:nth-child(3) > button')
button_login.click()
sleep(randint(4, 8))

hashtag_list = ['casadecampo', 'bookingbrasil', 'carnaval2023', 'rustico', 'flat', 'gravata', 'recife', 'pernambuco',
'viagemcasal', 'hospedagem', 'natureza', 'nature', 'viajar', 'amoviajar', 'comida', 'boraviajar',
'viagembarata', 'caruaru', 'festa', 'gravatape']

tag = -1
likes = 0
comentarios = 0
avancos = 0

choice_hashtag_list = random.choice(hashtag_list)
hashtag_list.remove(choice_hashtag_list)

for hashtag in hashtag_list:
if avancos < 50:
tag += 1
driver.get('https://www.instagram.com/explore/tags/' + random.choice(hashtag_list) + '/')
sleep(6)
thumb_recente = driver.find_element(By.XPATH, '/html/body/div[2]/div/div/div[2]/div/div/div/div[1]/div[1]/div[2]/section/main/article/div/div/div/div[1]/div[1]/a/div/div[2]')
thumb_recente.click()
sleep(randint(8, 10))
try:
while avancos < 50:
button_like = webdriver.find_element(By.XPATH, '/html/body/div[2]/div/div/div[3]/div/div/div[1]/div/div[3]/div/div/div/div/div[2]/div/article/div/div[2]/div/div/div[2]/section[1]/span[1]/div')
button_like.click()
likes += 1
sleep(randint(3, 6))

            driver.find_element(By.XPATH, '/html/body/div[2]/div/div/div[3]/div/div/div[1]/div/div[3]/div/div/div/div/div[2]/div/article/div/div[2]/div/div/div[2]/section[1]/span[2]/div').click()
            comment_box = driver.find_element(By.XPATH, '/html/body/div[2]/div/div/div[3]/div/div/div[1]/div/div[3]/div/div/div/div/div[2]/div/article/div/div[2]/div/div/div[2]/section[3]/div/form/div/textarea')
            sleep(3)
            comentario_chance = randint(1, 10)

            if comentario_chance == 1:
                comment_box.send_keys('Top! Podemos estar enganado, mas acreditamos que tens o necessário para abrir as 7 PORTAS! Eai, VOCÊ TEM CORAGEM?!')
                sleep(randint(4, 6))
            elif comentario_chance == 2:
                comment_box.send_keys('Gostei! Podemos estar enganado, mas acreditamos que tens o necessário para abrir as 7 PORTAS! Eai, VOCÊ TEM CORAGEM?!')
                sleep(randint(2, 7))
            elif comentario_chance == 3:
                comment_box.send_keys('Parabéns! Podemos estar enganado, mas acreditamos que tens o necessário para abrir as 7 PORTAS! Eai, VOCÊ TEM CORAGEM?!')
                sleep(randint(4, 10))
            elif comentario_chance == 4:
                comment_box.send_keys('Amei! Podemos estar enganado, mas acreditamos que tens o necessário para abrir as 7 PORTAS! Eai, VOCÊ TEM CORAGEM?!')
                sleep(randint(4, 7))
            elif comentario_chance == 5:
                comment_box.send_keys('Show! Estávamos aqui olhando seu perfil... Acreditamos que tens o necessário para abrir as 7 PORTAS! Eai, VOCÊ TEM CORAGEM?!')
                sleep(randint(1, 3))
            elif comentario_chance == 6:
                comment_box.send_keys('WOW! Estávamos aqui olhando seu perfil... Acreditamos que tens o necessário para abrir as 7 PORTAS! Eai, VOCÊ TEM CORAGEM?!')
                sleep(randint(1, 4))
            elif comentario_chance == 7:
                comment_box.send_keys('Show de bola! Estávamos aqui olhando seu perfil... Acreditamos que tens o necessário para abrir as 7 PORTAS! Eai, VOCÊ TEM CORAGEM?!')
                sleep(randint(3, 7))
            elif comentario_chance == 8:
                comment_box.send_keys('Curti! Estávamos aqui olhando seu perfil... Acreditamos que tens o necessário para abrir as 7 PORTAS! Eai, VOCÊ TEM CORAGEM?!')
                sleep(randint(6, 9))
            elif comentario_chance == 9:
                comment_box.send_keys('Nossa! Estávamos aqui olhando seu perfil, podemos estar enganados mas... Acreditamos que tens o necessário para abrir as 7 PORTAS! Eai, VOCÊ TEM CORAGEM?!')
                sleep(randint(1, 12))
            elif comentario_chance == 10:
                comment_box.send_keys('Muito bom! Estávamos aqui olhando seu perfil, podemos estar enganados mas... Acreditamos que tens o necessário para abrir as 7 PORTAS! Eai, VOCÊ TEM CORAGEM?!')
                sleep(randint(4, 12))
            comment_box.send_keys(Keys.ENTER)
            comentarios += 1
            sleep(randint(2, 10))

            if avancos == 0:
                avancar_postagem = driver.find_element(By.XPATH, '/html/body/div[2]/div/div/div[3]/div/div/div[1]/div/div[3]/div/div/div/div/div[1]/div/div/div/button')
                avancar_postagem.click()
                sleep(randint(5, 10))
                avancos += 1
            elif avancos % 5 == 0:
                avancos += 1
                break
            else:
                avancar_postagem = driver.find_element(By.XPATH,
                                                          '/html/body/div[2]/div/div/div[3]/div/div/div[1]/div/div[3]/div/div/div/div/div[1]/div/div/div/button')
                avancar_postagem.click()
                sleep(randint(5, 10))
                avancos += 1
    except:
        continue
else:
    print('Liked {} fotos'.format(likes))
    print('Comentários {} fotos'.format(comentarios))

Mas alguma coisa esta acontecendo, pois ele abre as fotos mais nao curte e nem comenta, e ai ja vai pra proxima hashtag e clica em outra foto mas nao curte e nem comenta... voce pode me ajudar?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.