Recent Changes - Search:

LiveStreamsPro

PmWiki

pmwiki.org

edit SideBar

CloudFlare

LSPRO supports CloudFlare site protection.

As you are aware, many sites are now adopting cloudflare front. What it does, is it runs a javascript and produce a key which should be sent as a cookie of the page. Therefore, if you access the page directly, it will not work and bring cloudflare page.


To access the page, you just need to produce Cloudflare cookie.\\ Here is the example, stream4k is using CF so before accessing their site, we need to call createCFCookie.


createCookie function takes 3 params: url, cookie_jar and user agent.


Example:

<item>
    <title>Cloudflare TEST</title>
    <link>$doregex[get-url]|Cookie=$get_cookies$&amp;User-Agent=Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0</link>
    <regex>
        <name>get-url</name>
        <expres>video = "(.*?)"</expres>
        <page>http://stream4k.net/index.php?m=streams&amp;id=30</page>
        <cookieJar>$doregex[createCFCookie]</cookieJar>
        <agent>Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0</agent>
    </regex>
    <regex>
        <name>createCFCookie</name>
        <expres></expres>
        <page>$pyFunction:cloudflare.createCookie('http://stream4k.net/index.php?m=streams&amp;id=30',Cookie_Jar,'Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0')</page>
        <cookieJar></cookieJar>
    </regex>
</item>

Another more complex example for http://www.stream4free.eu/south-park-hd. So, first thing first. You can play these links from US without captcha, if you access .pro url. It does show the cloudflare but thats already working with LSPro. For example


Code:

<item>
    <title>cloudflare test</title>
    <link>$doregex[getmainPage]|User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36</link>
    <regex>
        <name>createCFCookie</name>
        <expres></expres>
        <page>$pyFunction:cloudflare.createCookie('http://www.stream4free.pro/south-park-hd',Cookie_Jar,'Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1')</page>
        <cookieJar></cookieJar>
    </regex>
    <regex>
        <name>getmainPage</name>
        <expres>source src="(.*?)"</expres>
        <page>http://www.stream4free.pro/south-park-hd</page>
        <cookieJar>$doregex[createCFCookie]</cookieJar>
        <ignorecache />
    </regex>
</item>

However, lets say we do have google recaptcha (not recaptcha uncaptcha that allow you to click etc) which shows you some picture or numbers etc. In this case, we can show the picture to the user and they can enter the text (much like other addons) and then we process the page.
Each site implement it little different but basic arrange is almost same. The page show the captcha (challenge), user solve the captcha (response) and both these data along with something to identify the page/session are then post to the website.
So we have a function (you need 2.0.2 version) getGoogleRecaptchaResponse which takes the sitekey, cookieJar and type. type could be 1, 2 3,
respectively for get/post/rawpost (that is where this function is being used).


for example


Code:

<item>
    <title>Google recaptcha</title>
    <link>$doregex[loadcookie]$doregex[getmainPage]$doregex[createCFCookie]$doregex[savecookie]|User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36</link>
    <regex>
        <name>createCFCookie</name>
        <expres></expres>
        <page>$pyFunction:cloudflare.createCookie('http://www.stream4free.pro/south-park-hd',Cookie_Jar,'Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1')</page>
        <cookieJar></cookieJar>
    </regex>
    <regex>
        <name>savecookie</name>
        <expres></expres>
        <page></page>
        <cookieJar>save[stream4Free.lwp]</cookieJar>
    </regex>
    <regex>
        <name>getmainPage</name>
        <expres>source src="(.*?)"</expres>
        <page>http://www.stream4free.eu/south-park-hd</page>
        <cookieJar>$doregex[postcatpcha]</cookieJar>
        <ignorecache/>
    </regex>
    <regex>
        <name>postcatpcha</name>
        <expres></expres>
        <page>http://www.stream4free.eu/cdn-cgi/l/chk_captcha?$doregex[showcaptcha]&amp;id=$doregex[getId]</page>
        <cookieJar></cookieJar>
    </regex>
    <regex>
        <name>showcaptcha</name>
        <expres>$pyFunction:getGoogleRecaptchaResponse('$doregex[getGoogleCaptchaChallenge]',Cookie_Jar,1)</expres>
        <page></page>
        <cookieJar></cookieJar>
        <noredirect>true</noredirect>
    </regex>
    <regex>
        <name>getGoogleCaptchaChallenge</name>
        <expres>recap.*?\?k=(.*?)\"</expres>
        <page>http://www.stream4free.eu/south-park-hd</page>
        <cookieJar></cookieJar>
        <noredirect>true</noredirect>
    </regex>
    <regex>
        <name>getId</name>
        <expres>data-ray="(.*?)"</expres>
        <page>http://www.stream4free.eu/south-park-hd</page>
        <cookieJar></cookieJar>
        <noredirect>true</noredirect>
    </regex>
    <regex>
        <name>loadcookie</name>
        <expres></expres>
        <page></page>
        <cookieJar>open[stream4Free.lwp]</cookieJar>
    </regex>
</item>

here loadcookie, savecookie are existing code which loads the cookies if exists. This will help us to open the url again and again after with one
captcha worked (as they dont show captcha after first succesful try for the session). If we dont do the load and save then we will have to solve the captcha everytime we run.
createCFCookie is existing code which allow us to see the page, if CloudFlare protection is enable.
So for catpcha, showcaptcha regex is when we are calling the function by passing the key for the site (getting it from the page first)., it will show
the image, and whatever you type will be sent back to postcatpcha regex, which then post it along with the page id (it could be different for other
servers) to the site and hopefully, it would work. after that we access the page again but this time which the cookieJar that was updated and it should
work and allow us to access any page.


When you play the same link again, if the session not expired, you shouldn't see the catpcha anymore.

Edit - History - Print - Recent Changes - Search
Page last modified on February 26, 2016, at 03:22 AM