Harkame / YggTorrentScraper

YggTorrent scraper
GNU General Public License v3.0
17 stars 3 forks source link

Stuck during Cloudflare detection #18

Closed jorismi closed 2 years ago

jorismi commented 2 years ago

Hi,

i'm trying to use your solution by I have an infinite loading on the page "Checking your browser ...."

I just want to make a search to see if a certain item is available on yggtorrent, I don't need to login.

This is how I use your code, tell me if I'm doing something wrong.

from yggtorrentscraper import YggTorrentScraper, set_yggtorrent_tld, YggTorrentScraperSelenium
from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("--log-level=3")
options.add_argument("--disable-blink-features")
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_experimental_option("excludeSwitches", ["enable-logging"])

driver = webdriver.Chrome("C:\chromedriver.exe", options=options)

scraper = YggTorrentScraperSelenium(driver=driver)
torrents_
![Screenshot 2022-01-12 222018](https://user-images.githubusercontent.com/6593741/149260088-51998ed6-9257-4398-8eab-3d6509f2da10.jpg)
![Screenshot 2022-01-12 222018](https://user-images.githubusercontent.com/6593741/149260112-ec712711-a5b7-4ae5-b324-c4f3e00e31ab.jpg)
url = scraper.search({"name": "walking dead"})

Thank you for your help

LiliwoL commented 2 years ago

Same here. Stuck on CloudFlare. I'm on macos.

Harkame commented 2 years ago

Hi, I have found a solution

First install undetected_chromedriver

pip install undetected-chromedriver

This example is working for me

from yggtorrentscraper import (
    YggTorrentScraper,
    set_yggtorrent_tld,
    YggTorrentScraperSelenium,
)
from selenium import webdriver
import undetected_chromedriver.v2 as uc

if __name__ == "__main__":

    options = webdriver.ChromeOptions()
    options.add_argument("--log-level=3")
    options.add_argument("--disable-blink-features")
    options.add_argument("--disable-blink-features=AutomationControlled")

    driver = uc.Chrome("C:\chromedriver.exe", options=options)

    scraper = YggTorrentScraperSelenium(driver=driver)

    urls = scraper.search({"name": "walking dead s08"})

    print(urls)
jorismi commented 2 years ago

Awesome Harkame, it's working !!

I just had to add this line because I have multiple profile on my chrome and at first it was stuck on the selection profile page :

options.add_argument('--user-data-dir=c:\\temp\\default')

Thanks for your help, wonderful job =)