U JkdAE@sdZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z dZ de ZeedZeejddrejdjZnddlZeejddrejdjZnddlZeejdd rejdjZnd Zeejdd rejdjZnd Zeejdd r. Nz2.5.1zCommonFunctions-zQMozilla/5.0 (Windows NT 6.2; Win64; x64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1__main__xbmcxbmcguidbgFdbglevelopenerInputcCsVtddd}|sd}t||}||||rD|}tt|d|S)Nr )logrKeyboardsetHiddenInputdoModal isConfirmedgetTextrepr)titledefaulthiddenresultkeyboardrp/storage/emulated/0/Android/data/benim.Lokum.TV/files/.kodi/addons/plugin.video.uiiumovies/resources/lib/cmf3.py getUserInput=s   rcCsBtddd}|sd}t}|d||}tt|dt|S)Nr r r)r rDialognumericrstr)rrrrrrrgetUserInputNumbersQs rcCs`tddtd}t|ddD]$}||dr"|d||}q"t|}tt||S)Nr rzSystem.BuildVersion)- )r r getInfoLabelfindfloatr)versionkeyrrrgetXBMCVersion`s    r'c Cstddi}tdkr$tj|}||dddd}|D]f}t|dkrD|d}|d}z|dd }Wn(td t |d|d}YnX|||<qDtt |d|S) Nr r g(@?r!&r=utf-8z%Error utf-8 encoding argument value: ) r r'urllibparse unquote_plusr#splitlenencoder)ZparameterStringcommandsZ splitCommandscommandZ splitCommandr&valuerrr getParametersls"      r5cCsNtt|dtddt|}tj|}| dd}tt|d|S)Nr z(&#[0-9]+)([^;^0-9]+)z\1;\2z&r)) r rresubmakeUTF8htmlparser HTMLParserunescapereplace)txtrrrreplaceHTMLCodess  r?cCsvtt|d|d}|d}||krd|dkrd||||dd}|d}|d}q"tt|d|S)Nr <>r!r )r rr#r=strip)r9Z sub_startZsub_endrrr stripTagss    rDc Cstd|dd|}||}|||}|d||d}tt|dt|dt|dt|d ||kr|d kr|||t|}|d kr|}|d||d}td t|dt|d t|d qrtd |t||fd|d kr|d krd} n`|d kr>|d kr>||t||} n6|d krV|d|} n|d krt||t|d} |r|||d||d}|| |} tdtt| d| S)Nzmatch: rz]*?['"])>rz =(.[^>]*?)>'"Using %s as quotation markr*r!rBNo quotation mark foundr /rADone: ) r r6compileMSfindallr0r#rfindappendrCr)rGrFrHlsttmp cont_charrrr_getDOMAttributess. * *   r[cCstddg}|D]"}td|d|d||dtjtjB|}t|dkr||dd krtd|d|d ||d tjtjB|}t|dkrtd t|d |}g}qtdt|d t t t|}| |D]<}|||krtdt t|dt||d||=qqt|dkr|ikrtddtd|dtjtjB|}t|dkrtd|dtjtjB|}tdt t |d|S)Nr rz(]*?(?:z=['"]z ['"].*?>))rr rBr*z.*?>))zSetting main list r zSetting new list zPurging mismatch  - z+No list found, trying to match on name onlyz>)z .*?>)rQ)r r6rRrSrTrUr0r#rlistrangereversertype)itemrFattrsrXr&lst2testirrr_getDOMElementss0  66  &  ""rfc Cstdt|dt|dt|dtt|dt|trjz|}Wntdt|YnXt|trz|dg}Wqtdtt||g}YqXn(t|tr|g}nt|tstd d S|std d Sg}|D]}t d  |}|D]}| || d d}q t |||}t|tr|td|t|fdg} |D]}| t|||7} q^| }nrtdt|dg} |D]R}td|dt||||} ||| ||t| d}| | q| }||7}qtdt|d|S)NzName: z - Attrs:z - Ret: z - HTML: rz$Couldn't decode name binary string: r+z1Couldn't decode html binary string. Data length: z#Input isn't list or string/unicode.r zMissing tag namez(<[^>]*? [^>]*?>) r z,Getting attribute %s content for %s matches z'Getting element content for %s matches zGetting element content for %srQ)r rrr` isinstancedecoder0r]rCr6rRrUr=rfr[rLr#rW) r9rFrbrHZret_lstraZ temp_itemrGrXrctemprrrparseDOMsV:       " rlc Cstdt|d}t|dkr,td|g}g}tdd|D]}g} |rjt|dtjtjB|} n*|rt|dtjtjB|} n|g} t| dkrtd t| d|| 7}q>td |dq>t t dt|} | | D]} |r&||  |d kr&td t|| d || =qtdt|| d|| ddkrf|| || ddk|| t|ddkr|| || dt|dk||  || <q|s|rDt dt|D]t} td|| |r.|rtdtjtjB|| }ntdtjtjB|| }n|rt|dtjtjB|| } g}| D]} | d}| | ddd }|d}|dkrtd|d| | |d| |} n&tdd| | dd| d} | } t| dkr^|| q^ntdtdt|t|dkr|d|| <q|rt dt|D]} td|| ||  }z8zt||| <Wn tdt||| <YnXWn(tdt|t|| fYnXqXtd tt||S)!Nr scriptrzBCouldn't find any script tags. Assuming javascript file was given.Z Extractingrhz \(.*?\).*?;z [ ]+=.*?;zFound: zFound nothing on: rBzRemoving item: zCleaning item: rgr!zGetting values %sz (\(.*?\))z \((.*?)\)z.*?=.*?;r*rMrNrO;z-ERROR: Don't know what to extract values fromzValues extracted: %sz Evaluating %sz Couldn't json.loads, trying evalzCouldn't eval: %s from %srQ)r rlr0r6rRrSrTrUrr]r^r_r#rCrVrWjsonloadsevalr)datafunctionvariablerGZevaluatevaluesscriptsrXrmZtmp_lstrdreZtlstrYrZrrr extractJS5s           "   &ryc Cs|j}|d}i}|dr0tdt|dntdt||rVt|dddkrjtdd|d <|S|dr|d rtd dntd tj|ddtj|tj|d}| d dntddtj|}|dr |dD]}| |d|dq| dt |dr0| d|d|drJ| d|dztddtj |}| |d<| |d<|dddks|dddkr|}|d|d<|tdd |d <|WStjjk r}zt|} td!| td"t|jd#|jtt|ddd|d<t|} d| krf|jrf|j| d<| WYSd|d <|WYSd}~XYnptjjk r}zLt|} td$| td%tt|ddd|d<t|}|WYSd}~XYnXdS)&Nlink post_dataz called for : error0roz giving upistatusZhide_post_dataz Posting datazPosting data: z Content-Typez!application/x-www-form-urlencodedz Got requestheadersrr!z User-AgentcookieCookieZreferingRefererzconnecting to server...headernew_urlz no-contentfalser+contentDonez HTTPError : zHTTPError - Headers: z - Content: z URLError : r)getr rintr,r- urlencoderequestRequest add_header USERAGENTurlopeninfogeturlreadrjcloser| HTTPErrorrrfp fetchPageURLErrortimesleep) paramsrrzZret_objrheadZconZ inputdataeerrrHrrrrsp                  rcCstddttjddr|tjdj}t|}|dd}|dd}|dd }|d d }|d d }tt|d|StdddS)Nr r r cookiejarz<_LWPCookieJar.LWPCookieJar[z), Cookie(version=0,z>z >zCookie(version=0,zsX     #!6 U Q