U Èo.a 6ã @s¢dZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z dd d „Z d d „Zdidfdd„Zdd„Zdd„Zdd„Zdd„Zdd„ZdS)aM Tulip routine libraries, based on lambda's lamlib Author Twilight0 License summary below, for more details please read license.txt file This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . éN)Ú CookieJaré)ÚcacheTFÚÚ30c  Cs z g} |dksH| tj dd|i¡tjjg7} tjj| Ž}tj |¡}| dks`| dks`|dks¢t ¡}| tj ¡tj ¡tj  |¡g7} tjj| Ž}tj |¡}z^t j dkr´t ƒ‚ddl }| ¡}d|_|j|_| tjj|d g7} tjj| Ž}tj |¡}Wn YnXz| |¡Wni}YnXd |kr:n$|dksVt td ¡|d <nd |d <d |krjn<| dkrždtjj |¡jtjj |¡jf|d <n| |d <d|kr¸d|d<d|krÄn| dksÖ| |d<|dkr$Gdd„dtjjƒ}tj |¡}tj |¡}z |d =Wn YnXtjj|||d}ztjj|t| ƒd}WnÜtjjk r*}z¸|jdkrd| d¡krìdtjj |¡jtjj |¡jf}t t d||d | ¡}||d<tjj|||d}tjj|t| ƒd}n|dkrWY¢"WdSn|dkrWY¢ WdSW5d}~XYnX| dkrvzd !dd„|Dƒ¡}Wn YnXz|}Wn YnXn€| dkrà|dkr t"|jƒ| d ¡f}n<|dksÈt"|jƒ| t|ƒd!¡f}nt"|jƒ| d¡f}n| d"kr*zt|j#d#ƒ}Wnd$}YnX|d%krWdS| d&¡}nÌ| dkrŽzd !d'd„|Dƒ¡} Wn YnXz|} Wn YnX|j#}| d¡}|||| fWS| d(kr¢| $¡}nT| d)kr¸|j#}|WS|dkrÎ| d ¡}n(|dksì| t|ƒd!¡}n | d¡}|dkr| %¡|WSYdSXdS)*NÚhttpz%sÚcookieÚextendedT)ééé rF)Úcontextú User-AgentrzApple-iPhone/701.341ÚRefererz%s://%s/zAccept-Languagezen-USÚCookiec@seZdZdd„ZdS)zrequest..NoRedirectioncSs|S©N©)ÚselfÚrequestÚresponserrút/storage/emulated/0/Android/data/org.mmc.matrix/files/.kodi/addons/plugin.video.iptv.mmc/resources/modules/client.pyÚ http_responseVóz,request..NoRedirection.http_responseN)Ú__name__Ú __module__Ú __qualname__rrrrrÚ NoRedirectionUsr)ÚdataÚheaders©Útimeouti÷zcf-browser-verificationéPz%s://%sé¨ú; cSsg|]}d|j|jf‘qS©z%s=%s©ÚnameÚvalue©Ú.0ÚirrrÚ {szrequest..rÚ0i€iÚchunkzContent-Lengthi i i@cSsg|]}d|j|jf‘qSr$r%r(rrrr+sÚgeturlr)&ÚurllibrÚ ProxyHandlerÚ HTTPHandlerÚ build_openerÚinstall_openerÚ cookielibÚ LWPCookieJarÚ HTTPSHandlerÚHTTPCookieProcessorÚsysÚ version_infoÚ ExceptionÚsslÚcreate_default_contextÚcheck_hostnameÚ CERT_NONEÚ verify_modeÚupdaterÚgetÚ randomagentÚparseÚschemeÚnetlocÚHTTPErrorProcessorÚRequestÚurlopenÚintÚ HTTPErrorÚcodeÚreadÚcfcookieÚjoinÚstrrr.Úclose)ÚurlrPÚredirectÚerrorÚproxyÚpostrZmobileÚlimitÚrefererrÚoutputr ÚhandlersÚopenerÚcookiesr;Ú ssl_contextrrrrEÚcfÚresultÚcontentrrrrsè   "         *        $                     rcCst ¡ ||¡dSr)r/Ú URLopenerÚretrieve)ÚsourceÚ destinationrrrÚ retriever®srdc Csæt|tƒr0z| d¡g}WqP|g}YqPXn t|tƒrB|g}nt|tƒsPdS| ¡s\dSg}|D]z}t d¡ |¡}|D]}|  ||  dd¡¡}q~g}|D]Þ} t d|d| d|| d tj tj B¡ |¡} t | ƒd kr2||   d¡d kr2t d|d| d || d tj tj B¡ |¡} t |ƒd krJ| }g} q tt |ƒƒ} |  ¡| D]} || | krb|| =qbq t |ƒd krê|ikrêt d|dtj tj B¡ |¡}t |ƒd krêt d|dtj tj B¡ |¡}t|tƒrlg} |D]b}t d|d|dtj tj B¡ |¡} t | ƒd krft d|d|dtj tj B¡ |¡} | D]ô}|d }|dkrä|  d ||  |d¡¡d kr¾|d|  d ||  |d¡¡…}| |d¡d krN|d| |¡…}nj|  d¡d kr|d|  d¡…}nF|  d¡d kr,|d|  d¡…}n"|  d¡d krN|d|  d¡…}|  | ¡¡qjqþ| }nlg} |D]\}d|}|  |¡}|  ||¡}|  d||d¡}||krú|d krú|  ||t |ƒ¡}|d krâ|}|  d||d¡}q¬|d kr|d krd}n`|d kr>|d kr>||t |ƒ|…}n6|d krV|d|…}n|d krt||t |ƒd…}|r¤|||  d|  |¡¡d…}|||}||  ||  |¡¡t |ƒd…}|  |¡qt| }||7}qd|S)Nzutf-8rz(<[^>]*? [^>]*?>)Ú ú z(]*?(?:z=['"]z ['"].*?>))réÿÿÿÿú=z.*?>))z>)z .*?>)ú]*?['"])>z =(.[^>]*?)>z'"rú/ú>z.éé+z 37.0.2062.103z 37.0.2062.120z 37.0.2062.124z 38.0.2125.101z 38.0.2125.104z 38.0.2125.111z 39.0.2171.71z 39.0.2171.95z 39.0.2171.99z 40.0.2214.93z 40.0.2214.111z 40.0.2214.115z 42.0.2311.90z 42.0.2311.135z 42.0.2311.152z 43.0.2357.81z 43.0.2357.124z 44.0.2403.155z 44.0.2403.157z 45.0.2454.101z 45.0.2454.85z 46.0.2490.71z 46.0.2490.80z 46.0.2490.86z 47.0.2526.73z 47.0.2526.80z11.0zWindows NT 10.0zWindows NT 7.0zWindows NT 6.3zWindows NT 6.2zWindows NT 6.1zWindows NT 6.0zWindows NT 5.1zWindows NT 5.0z; WOW64z ; Win64; IA64z ; Win64; x64rzMMozilla/5.0 ({win_ver}{feature}; rv:{br_ver}) Gecko/20100101 Firefox/{br_ver}zeMozilla/5.0 ({win_ver}{feature}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{br_ver} Safari/537.36zEMozilla/5.0 ({win_ver}{feature}; Trident/7.0; rv:{br_ver}) like Gecko)Zwin_verÚfeatureZbr_ver)ÚxrangeÚrandomÚ randrangerwÚformatÚchoice)ZBR_VERSZWIN_VERSZFEATURESZRAND_UASÚindexrrrrB#s8þû þrBcCsdS)NzEMozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like GeckorrrrrÚagent3srœc Csþzêd|i}tjj||d}ztjj|t|ƒd}Wn0tjjk rd}z| d¡}W5d}~XYnXt d|¡d}t d|¡d}t d |¡d} t |ƒ} |   d ¡} | D]R} t | ƒdkr¬d | kr¬|   d ¡} t | d ƒ}tt t | ƒ| ddt |ƒƒƒ} q¬| t tjj |¡jƒ}d |||f}d|kr`t d|¡d}d|t |¡||f}t d¡t ¡}tj ¡tj ¡tj |¡g}tjj|Ž}tj |¡}z(tjj||d}tjj|t|ƒd}Wn YnXd dd„|Dƒ¡}|WSYnXdS)Nr)rrr!zname="jschl_vc" value="(.+?)"/>rz)setTimeout\(function\(\){\s*.*?.*:(.*?)};rgzchallenge-form\'\);\s*(.*)a.vú;rhrz2%s/cdn-cgi/l/chk_jschl?jschl_vc=%s&jschl_answer=%sztype="hidden" name="pass"zname="pass" value="(.*?)"z:%s/cdn-cgi/l/chk_jschl?pass=%s&jschl_vc=%s&jschl_answer=%sér#cSsg|]}d|j|jf‘qSr$r%r(rrrr+hszcfcookie..)r/rrGrHrIrJrLrqrsÚ parseJSStringÚsplitrwÚevalrOrCrEÚ quote_plusÚtimeÚsleepr4r5r1r6r7r2r3rN)rEÚuar rrrr^ZjschlÚinitÚbuilderZ decryptValÚlinesÚlineÚsectionsZline_valÚanswerÚqueryZpassvalr[rYrZrrrrrM7sH   &    rMcCs`zN|ddkrdnd}tt| dd¡ dd¡ dd¡ d d ¡|d…ƒƒ}|WSYnXdS) Nrú+rz!+[]Ú1z!![]z[]r,ú(zstr()rIr¡rt)ÚsÚoffsetÚvalrrrrŸos 4rŸ) TTFNNNFNNNrr)Ú__doc__rqr8r£r—r/Ú html.parserr}Úurllib.requestÚhttp.cookiejarrrrrrdr‹r’rBrœrMrŸrrrrÚs    g 8