cloudflare-scrape-Android icon indicating copy to clipboard operation
cloudflare-scrape-Android copied to clipboard

getting cloudflare page...

Open lfgtavora opened this issue 4 years ago • 15 comments

Hello not working for me :/ did i any thing wrong??

private const val USER_AGENT =
        "Mozilla/5.0 (Linux; Android 6.0.1; SM-G920V Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36"

url = "https://socialblade.com/youtube/top/country/ca"

fun getResquest(context: Context, url: String) {

        val cloudflare = Cloudflare(context, url)
        cloudflare.user_agent = USER_AGENT
        cloudflare.setCfCallback(object : CfCallback {
            override fun onSuccess(
                cookieList: MutableList<HttpCookie>?,
                hasNewUrl: Boolean,
                newUrl: String?
            ) {
                val test = Jsoup.connect(url).cookies(ConvertUtil.List2Map(cookieList))
                    .ignoreHttpErrors(true).ignoreContentType(true).timeout(10000)
                    .userAgent(USER_AGENT).get()

                test.body().toString()
            }

            override fun onFail(code: Int, msg: String?) {
                throw RuntimeException()
            }

        })

        cloudflare.getCookies()
    }

the val test.body is returning this html:

DDoS protection by Cloudflare
Ray ID: 5bee9bb84b03f86f

lfgtavora avatar Aug 07 '20 05:08 lfgtavora

I'm Checking

zhkrb avatar Aug 07 '20 07:08 zhkrb

Yes.. Not working for me too... Always onFailed

nhCoder avatar Aug 08 '20 14:08 nhCoder

Yes.. Not working for me too... Always onFailed

actually i got onSuccess, but the response page is cloudflare html

lfgtavora avatar Aug 08 '20 17:08 lfgtavora

Looks very strange, check passed on HttpURLConnent, but same cookies in jsoup is not work, even if they have same header....

zhkrb avatar Aug 09 '20 04:08 zhkrb

Fixed and updated.

zhkrb avatar Aug 09 '20 07:08 zhkrb

@zhkrb Ok thanks.... May i ask if rhino based is working or not.... If not why don't you remove folders

nhCoder avatar Aug 09 '20 14:08 nhCoder

@zhkrb now its works! but now open like a webview with a captch page to complete challenger, is it normal?

lfgtavora avatar Aug 09 '20 20:08 lfgtavora

just another feedback, will be cool if u let progress bar to users responsability, eg: i use shimmer to load my list and dont want that progress_bar from the lib in front every thing.... By the way, keep the good work, your lib saved my life 😄

lfgtavora avatar Aug 09 '20 21:08 lfgtavora

@naveedhassan913 rhino branch is not working. Now it's hrad to parse with v8 and rhino engine, I'm trying to make them work. Because webview branch realize with code is so dirty

zhkrb avatar Aug 10 '20 02:08 zhkrb

@lfgtavora yes, webview branch needs a webview to pass the js check. Even if the anti DDOS page does not return CAPTCHA challenge, it has a hidden webview working in dialog. I'll add a switch to hide the dialog. But in my opinion, get cookie in all network requests is not a good idea. you should Maintaining a global cookie, and decision whether to update cookie and Re request according of the response.

zhkrb avatar Aug 10 '20 02:08 zhkrb

@zhkrb ahhh now i got the point about the cookies! thankyou!

lfgtavora avatar Aug 11 '20 18:08 lfgtavora

excuse me @zhkrb , can you help me to bypass cloudflare from this website? (http://komikcast.com/) I always got onFailed when I used your library that contains webView in there implementation 'com.zhkrb.cloudflare-scrape-android:scrape-webview:0.0.3'
thank you 😁

Abealkindy avatar Aug 28 '20 17:08 Abealkindy

@Abealkindy This website is looks like set up to be accessible only by US IP.

CN/RU/JP ip is always return Access denied in my test

zhkrb avatar Aug 29 '20 00:08 zhkrb

anyone can check this site (https://komikindo.co)

exoarm8 avatar Mar 06 '22 12:03 exoarm8

anyone can check this site (https://komikindo.co) Now I checked with the application that the creator of the repository shared in another branch, it is processed successfully. It's really worth the wait. .

nareshalka avatar Mar 07 '22 13:03 nareshalka