Sistem belirtilen yolu bulamıyor hatası

Merhaba, bi captcha bypass kullanmak için git-hub formundan aşşagıdaki kodları aldım ama aşşagıdaki hatalar ile karşılaşıyorum nasıl düzeltmeliyim bulamadım yardımcı olursanız sevinirim.

HATA

C:\Users\user\AppData\Local\Programs\Python\Python38-32\python.exe C:/Users/user/Desktop/Python/recaptcha.py
C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pydub\utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
  warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
[INFO] Audio src: https://www.google.com:443/recaptcha/api2/payload?p=06AGdBq24_e_iVqGol4yXsutjBKVu1qPSwYbF5DNJ95BXRtSrRRpkRLb4CEDSeUEEEA45th4XQsymlkTKfSUk8dN7A_ka7KDROO2NNLAVrIT1WvXN_J6OSzfPv2a2aB09WsfzupwcwFjghNxaLtnHud00YX7CNOCqxl6h_uOYAPSwfnvpDVmhu3XAUkYGbYBWc_CZVczziU10L&k=6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-
C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pydub\utils.py:198: RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work
  warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
Traceback (most recent call last):
  File "C:/Users/user/Desktop/Python/recaptcha.py", line 70, in <module>
    sound = pydub.AudioSegment.from_mp3(os.getcwd()+"sample.mp3")
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pydub\audio_segment.py", line 738, in from_mp3
    return cls.from_file(file, 'mp3', parameters=parameters)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pydub\audio_segment.py", line 685, in from_file
    info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pydub\utils.py", line 274, in mediainfo_json
    res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Sistem belirtilen dosyayı bulamıyor

KOD

# -*- coding: utf-8 -*-
"""
Created on Sun Aug 16 10:01:10 2020
@author: OHyic
"""

#system libraries
import os
import random
import time

#selenium libraries
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import UnexpectedAlertPresentException
from selenium.webdriver.chrome.options import Options

#recaptcha libraries
import speech_recognition as sr
import ffmpy
import requests
import urllib
import pydub

def delay ():
    time.sleep(random.randint(2,3))
#create chrome driver
driver = webdriver.Chrome(executable_path=r'C:\Users\user\Desktop\chromedriver.exe')

#go to website
driver.get("https://www.google.com/recaptcha/api2/demo")

#switch to recaptcha frame
frames=driver.find_elements_by_tag_name("iframe")
driver.switch_to.frame(frames[0]);
delay()

#click on checkbox to activate recaptcha
driver.find_element_by_class_name("recaptcha-checkbox-border").click()

#switch to recaptcha audio control frame
driver.switch_to.default_content()
frames=driver.find_element_by_xpath("/html/body/div[2]/div[4]").find_elements_by_tag_name("iframe")
driver.switch_to.frame(frames[0])
delay()

#click on audio challenge
driver.find_element_by_id("recaptcha-audio-button").click()

#switch to recaptcha audio challenge frame
driver.switch_to.default_content()
frames= driver.find_elements_by_tag_name("iframe")
driver.switch_to.frame(frames[-1])
delay()

#click on the play button
driver.find_element_by_xpath("/html/body/div/div/div[3]/div/button").click()
#get the mp3 audio file
src = driver.find_element_by_id("audio-source").get_attribute("src")
print("[INFO] Audio src: %s"%src)
#download the mp3 audio file from the source
urllib.request.urlretrieve(src, os.getcwd()+"\\sample.mp3")
sound = pydub.AudioSegment.from_mp3(os.getcwd()+"sample.mp3")
sound.export(os.getcwd()+"\\sample.wav", format="wav")
sample_audio = sr.AudioFile(os.getcwd()+"sample.wav")
r= sr.Recognizer()

with sample_audio as source:
    audio = r.record(source)

#translate audio to text with google voice recognition
key=r.recognize_google(audio)
print("[INFO] Recaptcha Passcode: %s"%key)

#key in results and submit
driver.find_element_by_id("audio-response").send_keys(key.lower())
driver.find_element_by_id("audio-response").send_keys(Keys.ENTER)

Diğer dosyaları indirdiniz mi?

evet diğer dosyalarda var mp3 dosyası olarak indiriyor sonrasında hata veriyor
kaynak -> https://github.com/ohyicong/recaptcha_v2_solver

bu webdriveri indirdinmi veya dosya yolu doğrumu kontrol edermisin?
webdriver bazı hatalar vere biliyor

Bu kütüphane/uygulamalar sizde yüklü mü?

Hatanın kaynağı, stringin os.getcwd()'ye direk eklenmesi sonucu geçerli bir yol belirtmiyor olması olabilir. Şöyle yazınız (diğer yerlerde yazıldığı gibi):

sound = pydub.AudioSegment.from_mp3(os.getcwd() + "\\sample.mp3")

olay, makul bir path olabilsin diye iki ters slash (windows için) koymak yani
+ aynı hatadan bir yerde daha var onu da siz görün, düzeltin

Evet bu yolu zaten denedim genede hata veriyor

hepsini import ettim

“İndirdim” diyecektiniz galiba?

hatayı ve kodun değiştirdiğiniz halini ilk attığınız gibi atar mısınız

HATA

Type "help", "copyright", "credits" or "license()" for more information.
>>> 
============ RESTART: C:\Users\user\Desktop\asda\recaptcha_solver.py ===========

Warning (from warnings module):
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pydub\utils.py", line 170
    warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
[INFO] Audio src: https://www.google.com/recaptcha/api2/payload?p=06AGdBq26ym6vdvOmQnGj7AJAhwmNR6KkQExAh8JrpcaJBsZSgHWFSmvCI92xjvV0t_F3OxaCMnqMqrRbC0DlkRW5P6hJnS4QxDL0cAiy2adM6-ivAfr4-E75eUk7hrkkEChVymyi74g-aIYNyGyRLLsqo5i4YqhJl689eB06M2RFcARJ9iay74VFk2heux4ZtitvNqj5ZSrkh&k=6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-

Warning (from warnings module):
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pydub\utils.py", line 198
    warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work
Traceback (most recent call last):
  File "C:\Users\user\Desktop\asda\recaptcha_solver.py", line 71, in <module>
    sound = pydub.AudioSegment.from_mp3(os.getcwd() + "\\sample.mp3")
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pydub\audio_segment.py", line 738, in from_mp3
    return cls.from_file(file, 'mp3', parameters=parameters)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pydub\audio_segment.py", line 685, in from_file
    info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pydub\utils.py", line 274, in mediainfo_json
    res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Sistem belirtilen dosyayı bulamıyor
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 16 10:01:10 2020

@author: OHyic
"""

#system libraries
import os
import random
import time

#selenium libraries
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException   
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import UnexpectedAlertPresentException
from selenium.webdriver.chrome.options import Options

#recaptcha libraries
import speech_recognition as sr
import ffmpy
import requests
import urllib
import pydub

def delay ():
    time.sleep(random.randint(2,3))
#create chrome driver
driver = webdriver.Chrome(os.getcwd()+"\\webdriver\\chromedriver.exe") 

#go to website
driver.get("https://www.google.com/recaptcha/api2/demo")

#switch to recaptcha frame
frames=driver.find_elements_by_tag_name("iframe")
driver.switch_to.frame(frames[0]);
delay()

#click on checkbox to activate recaptcha
driver.find_element_by_class_name("recaptcha-checkbox-border").click()

#switch to recaptcha audio control frame
driver.switch_to.default_content()
frames=driver.find_element_by_xpath("/html/body/div[2]/div[4]").find_elements_by_tag_name("iframe")
driver.switch_to.frame(frames[0])
delay()

#click on audio challenge
driver.find_element_by_id("recaptcha-audio-button").click()

#switch to recaptcha audio challenge frame
driver.switch_to.default_content()
frames= driver.find_elements_by_tag_name("iframe")
driver.switch_to.frame(frames[-1])
delay()

#click on the play button
driver.find_element_by_xpath("/html/body/div/div/div[3]/div/button").click()
#get the mp3 audio file
src = driver.find_element_by_id("audio-source").get_attribute("src")
print("[INFO] Audio src: %s"%src)
#download the mp3 audio file from the source
urllib.request.urlretrieve(src, os.getcwd() + "\\sample.mp3")
sound = pydub.AudioSegment.from_mp3(os.getcwd() + "\\sample.mp3")
sound.export(os.getcwd() + "\\sample.wav", format="wav")
sample_audio = sr.AudioFile(os.getcwd() + "\\sample.wav")
r= sr.Recognizer()

with sample_audio as source:
    audio = r.record(source)

#translate audio to text with google voice recognition
key=r.recognize_google(audio)
print("[INFO] Recaptcha Passcode: %s"%key)

#key in results and submit
driver.find_element_by_id("audio-response").send_keys(key.lower())
driver.find_element_by_id("audio-response").send_keys(Keys.ENTER)

Sanırım FFmpeg kütüphanesine ihtiyaç duyuluyor.

64-bit:
https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20200831-4a11a6f-win64-static.zip
32-bit:
https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20200831-4a11a6f-win32-static.zip

Yukarıdaki linklerden sisteminize uygun olan FFmpeg kütüphanesini indirin. Dosyaları zip dosyasından çıkarın. Klasöre bir isim verin, “FFmpeg” olabilir ismi. Daha sonra bu klasörün bin klasörünün yolunu Windows ortam değişkenlerine ekleyin.

2 Beğeni

Sisteme ffmpeg kurmanız gerekiyor.

Separator için;

sound = pydub.AudioSegment.from_mp3(os.getcwd()+os.path.sep+“sample.mp3”)

Ya da

sound =  pydub.AudioSegment.from_mp3(os.path.join(os.getcwd(),“sample.mp3”))
1 Beğeni

path olarak ekledim ama sonuç degişmiyor

ffmpeg kütüphanesini komut satırından çalıştırabiliyor musunuz? Komut satırına ffmpeg yazın size zahmet.

C:\Users\user>ffmpeg
‘ffmpeg’ is not recognized as an internal or external command,
operable program or batch file.

Demek ki yolu yanlış eklemişsiniz.

1 Beğeni

yorgunluktan sonuna \bin yazmayı unutmuşum düzeldi tekrar test ediyorum

1 Beğeni

Teşekkürler herşeyi yapıp FFmpeg kütüphanesini path etmemişim gözden kaçmış

1 Beğeni