当前位置: 首页 > 面试题库 >

如何解码python字符串

赫连越
2023-03-14
问题内容

我有一些我想解码的代码,但是如果正在使用任何代码页,猜测代码页的运气就不会很幸运。任何帮助将非常感激。

这是代码:

exec("import re;import base64");exec((lambda p,y:(lambda o,b,f:re.sub(o,b,f))(r"([0-9a-f]+)",lambda m:p(m,y),base64.b64decode("OTIgMjEsOTQsMTQsYywxMTcsMTEsMTA2LDNhLDJmLDRmLDhlCmVmIGUyLjEzZC5iZCA5MiBhMAplZiBjOSA5MiA3MwoKM2UgICAgICAgID0gJzEwNC44NC4xMTUnCjE5ICAgICAgID0gOTQuYTAoZTk9M2UpCmRkICAgICAgICAgICA9IGEwKDNlLCAyZi4xYikKYzcgICAgICAgICAgPSAyMS42NygxMDYuZTguZTYoJ2EzOi8vZWMvYzEvJyArIDNlICwgJ2M3LjEwOCcpKQo5OCAgICAgICAgICAgID0gMjEuNjcoMTA2LmU4LmU2KCdhMzovL2VjL2MxLycgKyAzZSwgJzk4LmUwJykpCmFhICAgICAgICAgPSAnZjQ6Ly85MS43Yi4xMzgvYmIvNzAuYjknCjc0ICAgICAgICA9IDE5LjJjKCdjZicpCjM4ICAgICAgID0gMTkuMmMoJ2MwJykKNjMgICAgICAgPSBkZC5mZC4xNDYoJzYzJywgJycpCmFiICAgICAgICAgPSAxOS4yYygnYzUnKQpiYyA9JzcyOi8vOTEuODEuNGUvMTMvMTNhLzEwNT8xNTk9JwpiYSA9JyZkMD0xNTMmZjE9YWUmMTU1PTEyMSYxMGY9NDEmNjA9ODQmN2Y9NTAnCmYwID0gJzcyOi8vOTEuODEuNGUvMTMvMTNhL2IyP2YxPWFlJmNhPScKZGUgPSAnJjdmPTUwJjEwZj00MCcKCjNmIDcwKCk6CgkxNGE9NTIoYWEpCQoJMTc9M2EuMjUoJ2YzPSIoLis/KSIuKz80OD0iKC4rPykiLis/MTAxPSIoLis/KSInLDNhLjVhKS4yNCgxNGEpCgk0NCBmMyw0OCw2MyAyMyAxNzoKCQkxNiBj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cplugin|d|thumbnailImage|executebuiltin|10|urllib2|mode|youtube|xbmcgui|15|if|match|isFolder|selfAddon|streamurl|argv|fanart_image|simpleyear|except|return|addDir|xbmc|infoLabels|in|findall|compile|channels|setProperty|splitparams|print|SetViewMode|iconImage|getSetting|2008092417|add_header|sys|status|ListItem|contextMenuItems|search_query|listitem|unquote_plus|item_data|req|adultpass|39|re|setInfo|addLink|searchterm|addon_id|def|AIzaSyBAdxZCHbeJwnQ7dDZQJNfcaF46MdqJ24E|AIzaSyA7v1QOHz8Q4my5J8uGSpr0zRrntRjnMmk|pairsofparams|ok|for|pass|splitName|handle|url|urlopen|Request|Firefox|Mozilla|AKfycbyBcUa5TlEQudk6Y_0o0ZubnmhGL_|com|urlresolver|50|site|open_url|True|playlist|else|keyb|elif|try|str|DOTALL|HostedMediaFile|simplename|Video|None|list|type|matches|GetList|iconimage|content|len|int|translatePath|channel|DefaultFolder|cleanedparams|close|Agent|Gecko|COLOR|False|Index|Title|https|metahandlers|adultopt|backdrop_url|text|GetChans|dialog|paramstring|isConfirmed|metalkettle|addLinkMeta|results|getControl|maxResults|split|googleapis|ytapi|meta|video|read|param|title|get_params|User|passw|b7Up8kQt11xgVwz3ErTo|addContextMenuItems|partition|random|append|decode|www|import|itemcount|xbmcaddon|dte|588677963413065728|PLAYLINK|icon|Password|viewType|showText|CatIndex|ytid|true|Keyboard|Addon|retry|videoId|special|pubDate|Content|heading|getText|TWITTER|setView|baseurl|metaset|Youtube|doModal|snippet|ActivateWindow|endOfDirectory|randint|playlistItems|ignore|ret|Cancel|movies|Player|Please|txt|ytapi2|UKTurk|ytapi1|common_addon|XXX|Dialog|password|addons|not|replaceItems|Information|enable_meta|dailymotion|fanart|DailyMotion|metahandler|playlistId|GB|strip|setContent|NT|adult|regionCode|field|sleep|totalItems|10000|rv|value|Adult|yesno|setSetting|accidental|watch|en|addon|ytpl2|utf|png|valid_url|resources|win|cover_url|twit|join|MetaData|path|id|get_meta|plot|home|setLabel|u|from|ytpl|part|continue|name|http|play|Playlist|blue|setText|Twitter|uk_turk|U|n|queries|twitter|prevent|100|img|thumbs|encode|plugin|search|os|Search|jpg|Window|the|li|script|macros|cnt|key|Action|to|access|Set|google|ukturk|Direct|urllib|set|x2026|range|ascii|embed|while|lower|enter|Movie|en_US|opted|money|Found|10147|movie|MAIN|burl|Lets|view|or|Show|Name|Mode|show|exec|Site|Link|mg|Info|auto|Feed|Turk|co|have|v3|liz|nbsp|libs|addDirectoryItem|year|XBMC|500|URL|amp|resolve|description|get|r|You|mp4|link|you|Go|M|v|me|s|S|UK|US|Container|hl|i|Windows|I|q|params|t|_".split("|")))

问题答案:

需要注意的是,如指出的评论,如果你只是想看到生成的脚本可以更换第二execprint,例如从那么回事:

exec("import re;import base64");exec((lambda p,y: ...

至:

exec("import re;import base64");print((lambda p,y: ...
                              # ^^^^^

并运行结果。如果你想了解多一点关于 如何 它的工作原理,见下图。

您有两个输入,一个输入只是用管道分隔的数据(pipestr),另一个是基于该数据的以base
64(b64str)编码的程序的结构。除去这两个字符串文字(加上不必要的'0x'),剩下的就是:

data = pipestr.split("|")
code = re.sub(
    r"([0-9a-f]+)",  # find all hexadecimals
    lambda match: data[int(match.group(1), 16)],  # replace them by indexing the data
    base64.b64decode(b64str)  # insert into the structure
)

这是解码后的结构:

92 21,94,14,c,117,11,106,3a,2f,4f,8e
ef e2.13d.bd 92 a0
ef c9 92 73

3e        = '104.84.115'
19       = 94.a0(e9=3e)
dd           = a0(3e, 2f.1b)
c7          = 21.67(106.e8.e6('a3://ec/c1/' + 3e , 'c7.108'))
98            = 21.67(106.e8.e6('a3://ec/c1/' + 3e, '98.e0'))
aa         = 'f4://91.7b.138/bb/70.b9'
74        = 19.2c('cf')
38       = 19.2c('c0')
63       = dd.fd.146('63', '')
ab         = 19.2c('c5')
bc ='72://91.81.4e/13/13a/105?159='
ba ='&d0=153&f1=ae&155=121&10f=41&60=84&7f=50'
f0 = '72://91.81.4e/13/13a/b2?f1=ae&ca='
de = '&7f=50&10f=40'

3f 70():
    14a=52(aa)  
    17=3a.25('f3="(.+?)".+?48="(.+?)".+?101="(.+?)"',3a.5a).24(14a)
    44 f3,48,63 23 17:
        16 c2 'be' 23 f3:
            20(f3,48,1,63,c7)
        16 'be' 23 f3:
            16 74 == '9e':
                16 38 == '':
                    78 = 14.bf()
                    b4 = 78.d8('d7 a5', '148 139 122 111 12f cf 64','','b8 118 a c0 111 ff da 112','b5','129 14c')
                    16 b4 == 1:
                    56 = 21.9f('', '113 99')
                    56.ad()
                    16 (56.7a()):
                        8a = 56.a7()
                        19.d9('c0',8a)      
                    20(f3,48,1,63,c7)
            16 74 == '9e':
                16 38 <> '':
                    20(f3,48,1,63,c7)
    3c('152 137 f9 136','48',2,'f4://91.7b.138/bb/102/fe.108',c7)
    21.f('154.2a(141)')

3f 77(48):
    16 '70' 23 48:
        9c(48)
    16 'be' 23 48:
        16 38 <> '':
            78 = 14.bf()
            b4 = 78.d8('d7 a5', 'b8 11f 10a c0 14b 118','111 f2','','b5','12c 14f 10a 123')
            16 b4 == 1:
               58:     
                  56 = 21.9f('', '113 99')
                  56.ad()
                  16 (56.7a()):
                    8a = 56.a7()
                  16 8a == 38:
                26 = 62(48)
                44 68 23 26:
                       3c(68["f3"],68["48"],3,63,c7)
               1e:45
    16 'b6' 23 48:
        26 = 62(48)
        10e = 65(26)
        44 68 23 26:
            7c(68["f3"],68["48"],3,63,10e,18=6f)
        a9('b6', '127')
        16 '70' 23 48:
            21.f('154.2a(50)')
    57 'be' c2 23 48:
        128 = 48
        26 = 62(48)
        44 68 23 26:
            16 '13.4e/7d?33=' 23 68["48"]:
                20(68["f3"],68["48"],3,63,c7)
            57 '13.4e/54?5f=' 23 68["48"]:
                20(68["f3"],68["48"],3,63,c7)
            55:
                16 'b9' 23 68["48"]:
                    20(68["f3"],68["48"],3,63,c7)
                55:
                    3c(68["f3"],68["48"],3,63,c7)
        21.f('154.2a(50)')

3f 9c(48):
    14a=52(48)  
    17=3a.25('f3="(.+?)".+?48="(.+?)".+?101="(.+?)"',3a.5a).24(14a)
    44 f3,48,63 23 17:
        16 '13.4e/54?5f=' 23 48:
            20(f3,48,3,63,c7)
        57 '13.4e/7d?33=' 23 48:
            20(f3,48,3,63,c7)
        55:
            20(f3,48,1,63,c7)
    21.f('154.2a(50)')

3f 62(48):
    14a=52(48)  
    61=3a.25('^#.+?:-?[0-9]*(.*?),(.*?)\fc(.*?)$',3a.158+3a.14d+3a.fb+3a.151).24(14a)
    10b = []
    44 15a, f3, 48 23 61:
        36 = {"15a": 15a, "f3": f3, "48": 48}
        10b.8f(36)
    5f = []
    44 68 23 10b:
        36 = {"f3": 68["f3"], "48": 68["48"]}
        61=3a.25(' (.+?)="(.+?)"',3a.158+3a.14d+3a.fb+3a.151).24(68["15a"])
        44 d1, d6 23 61:
            36[d1.cc().11e().4('-', '15c')] = d6.cc()
        5f.8f(36)
    1f 5f

3f 97(48,f3):
        29 48
        16 'b9' 23 48:
            29 '124 b9'
            77(48)
        55:
            16 '13.4e/7d?33=' 23 48:
            29 'ac 107'
            3d = 48.80('33=')[1]
            82 = bc + 3d + ba
            37 = 11.4a(82)
            37.2e('89-6c', '4c/5.0 (157; fb; 157 ce 5.1; dc-cb; d5:1.9.0.3) 6d/2d 4b/3.0.3')
            7 = 11.49(37)
            14a=7.85()
            7.6b()
            14a = 14a.4('\147','').4('\fc','').4('  ','')
            17=3a.25('"a2": "(.+?)".+?"87": "(.+?)"',3a.5a).24(14a)
            29 17
            44 9d,f3 23 17:
                48 = '72://91.13.4e/db?14e='+9d
                3c(f3,48,3,63,c7)
            57 '13.4e/54?5f=' 23 48:
            29 'ac f6'
            3d = 48.80('54?5f=')[1]
            82 = f0 + 3d + de
            37 = 11.4a(82)
            37.2e('89-6c', '4c/5.0 (157; fb; 157 ce 5.1; dc-cb; d5:1.9.0.3) 6d/2d 4b/3.0.3')
            7 = 11.49(37)
            14a=7.85()
            7.6b()
            14a = 14a.4('\147','').4('\fc','').4('  ','')
            17=3a.25('"87": "(.+?)".+?"a2": "(.+?)"',3a.5a).24(14a)
            44 f3,9d 23 17:
                48 = '72://91.13.4e/db?14e='+9d
                3c(f3,48,3,63,c7)
            57 'c6' 23 48:
                29 'c8'
                48 = 48.4('84','11c/84')
                37 = 11.4a(48)
                37.2e('89-6c', '4c/5.0 (157; fb; 157 ce 5.1; dc-cb; d5:1.9.0.3) 6d/2d 4b/3.0.3')
                7 = 11.49(37)
                14a=7.85()
                7.6b()
                17=3a.25('149","48"\:"(.+?)"').24(14a)[0]
                1a=17.4('\/','/')
                43=53
                13b=14.31(f3, 2b=63,e=63); 13b.3b( 60="5d", 22={ "71": f3 } )
                43=c.13e(47=66(2f.1b[1]),48=1a,34=13b)
                58:
                 21.b7 ().f5(1a, 13b, 6f)
                 1f 43
                1e:
                 45
            55:
            29 '116 132'
            16 4f.5b(48).e1():
                1a = 4f.5b(48).144()
            55: 1a=48 
            43=53
            13b=14.31(f3, 2b=63,e=63); 13b.3b( 60="5d", 22={ "71": f3 } )
            43=c.13e(47=66(2f.1b[1]),48=1a,34=13b)
            58:
                 21.b7 ().f5(1a, 13b, 6f)
                 1f 43
            1e:
                 45

3f a8():
    76 = ''
    e5 = '72://10c.114.4e/10d/150/4d-8b/130?96'
    37 = 11.4a(e5)
    37.2e('89-6c', '4c/5.0 (157; fb; 157 ce 5.1; dc-cb; d5:1.9.0.3) 6d/2d 4b/3.0.3')
    7 = 11.49(37)
    14a=7.85()
    7.6b()
    14a = 14a.4('/fc','')
    14a = 14a.90('df-8').103('df-8').4('&#39;','\'').4('&#10;',' - ').4('&#119;','')
    17=3a.25("<87>(.+?)</87>.+?<a4>(.+?)</a4>",3a.5a).24(14a)[1:]
    44 30, 95 23 17:
        58:
                30 = 30.90('11b', 'b3')
        1e:
                30 = 30.90('df-8','b3')
        95 = 95[:-15]
        30 = 30.4('&143;','')
        95 = '[6e f7][b]'+95+'[/b][/6e]'
        76 = 76+95+'\fc'+30+'\fc'+'\fc'
    9b('[6e f7][b]@fa[/b][/6e]', 76)

3f 9b(a6, 76):
    e9 = 125
    21.f('af(%d)' % e9)
    21.d2(100)
    e3 = 14.109(e9)
    a1 = 50
    11d (a1 > 0):
    58:
        21.d2(10)
        a1 -= 1
        e3.7e(1).ed(a6)
        e3.7e(5).f8(76)
        1f
    1e:
        45

3f 52(48):
    48 += '?%d=%d' % (8e.b1(1, d4), 8e.b1(1, d4))
    37 = 11.4a(48)
    37.2e('89-6c', '4c/5.0 (157; fb; 157 ce 5.1; dc-cb; d5:1.9.0.3) 6d/2d 4b/3.0.3')
    7 = 11.49(37)
    14a=7.85()
    14a = 14a.4('\147','').4('\15b','').4('&13c;','').4('\'','')
    7.6b()
    1f 14a

3f 88():
    86=[]
    79=2f.1b[2]
    16 65(79)>=2:
        15a=2f.1b[2]
        6a=15a.4('?','')
        16 (15a[65(15a)-1]=='/'):
            15a=15a[0:65(15a)-2]
        42=6a.80('&')
        86={}
        44 156 23 11a(65(42)):
            28={}
            28=42[156].80('=')
            16 (65(28))==2:
                86[28[0]]=28[1]

    1f 86

3f 20(f3,48,12,63,c7,145=''):
    ee=2f.1b[0]+"?48="+117.6(48)+"&12="+59(12)+"&f3="+117.6(f3)+"&63="+117.6(63)+"&145="+117.6(145)
    43=53
    13b=14.31(f3, 2b="69.e0", e=63)
    13b.3b( 60="5d", 22={ "71": f3, 'eb': 145 } )
    13b.27('1c', c7)
    43=c.13e(47=66(2f.1b[1]),48=ee,34=13b,18=53)
    1f 43

3f 3c(f3,48,12,63,c7,145=''):
    ee=2f.1b[0]+"?48="+117.6(48)+"&12="+59(12)+"&f3="+117.6(f3)+"&63="+117.6(63)+"&145="+117.6(145)
    43=53
    13b=14.31(f3, 2b="69.e0", e=63)
    13b.3b( 60="5d", 22={ "71": f3, 'eb': 145 } )
    13b.27('1c', c7)
    43=c.13e(47=66(2f.1b[1]),48=ee,34=13b,18=6f)
    1f 43

3f 7c(f3,48,12,63,93,18=6f):
    16 ab=='9e':
      16 c2 '6e' 23 f3:
        46=f3.8d('(')
        5c=""
        1d=""
        16 65(46)>0:
        5c=46[0]
        1d=46[2].8d(')')
        16 65(1d)>0:
        1d=1d[0]
        133 = 73.e7()
        83 = 133.ea('126', f3=5c ,13f=1d)
        ee=2f.1b[0]+"?48="+117.6(48)+"&51="+59(51)+"&12="+59(12)+"&f3="+117.6(f3)
        43=53
        13b=14.31(f3, 2b=83['e4'], e=63)
        13b.3b( 60="5d", 22= 83 )
        32 = []
        32.8f(('120 c4', '140.110(134)'))
        13b.8c(32, c3=53)
        16 c2 83['75'] == '': 13b.27('1c', 83['75'])
        55: 13b.27('1c', c7)
        43=c.13e(47=66(2f.1b[1]),48=ee,34=13b,18=18,d3=93)
        1f 43
    55:
        ee=2f.1b[0]+"?48="+117.6(48)+"&51="+59(51)+"&12="+59(12)+"&f3="+117.6(f3)
        43=53
        13b=14.31(f3, 2b=98, e=98)
        13b.3b( 60="5d", 22={ "71": f3 } )
        13b.27('1c', c7)
        43=c.13e(47=66(2f.1b[1]),48=ee,34=13b,18=18)
        1f 43

3f a9(64, 9a):
    16 64:
    c.cd(66(2f.1b[1]), 64)
    16 19.2c('135-12a')=='9e':
    21.f("154.2a(%150)" % 19.2c(9a) )

15a=88(); 48=5e; f3=5e; 12=5e; 51=5e; 63=5e
58: 51=117.35(15a["51"])
1e: 45
58: 48=117.35(15a["48"])
1e: 45
58: f3=117.35(15a["f3"])
1e: 45
58: 12=66(15a["12"])
1e: 45
58: 63=117.35(15a["63"])
1e: 45

#29 "131: "+59(51); 29 "12e: "+59(12); 29 "142: "+59(48); 29 "12d: "+59(f3)

16 12==5e 12b 48==5e 12b 65(48)<1: 70()
57 12==1:77(48)
57 12==2:a8()
57 12==3:97(48,f3)

c.b0(66(2f.1b[1]))

通过索引到数据中以选择适当的组件来替换这些各个部分(例如'c',在第一行中成为12,这是xbmcplugin从管道分隔的数据中获取的)。

>>> for x in range(20):
    print format(x, '2'), format(x, '2x'), data[x]

 0  0 0
 1  1 1
 2  2 2
 3  3 3
 4  4 replace
 5  5 5
 6  6 quote_plus
 7  7 response
 8  8 8
 9  9 9
10  a a
11  b B
12  c xbmcplugin
13  d d
14  e thumbnailImage
15  f executebuiltin
16 10 10
17 11 urllib2
18 12 mode
19 13 youtube

该程序生成并执行以下操作:

import xbmc,xbmcaddon,xbmcgui,xbmcplugin,urllib,urllib2,os,re,sys,urlresolver,random
from resources.libs.common_addon import Addon
from metahandler import metahandlers

addon_id        = 'plugin.video.ukturk'
selfAddon       = xbmcaddon.Addon(id=addon_id)
addon           = Addon(addon_id, sys.argv)
fanart          = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id , 'fanart.jpg'))
icon            = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id, 'icon.png'))
baseurl         = 'http://www.metalkettle.co/UKTurk/Index.txt'
adultopt        = selfAddon.getSetting('adult')
adultpass       = selfAddon.getSetting('password')
iconimage       = addon.queries.get('iconimage', '')
metaset         = selfAddon.getSetting('enable_meta')
ytapi1 ='https://www.googleapis.com/youtube/v3/search?q='
ytapi2 ='&regionCode=US&part=snippet&hl=en_US&key=AIzaSyA7v1QOHz8Q4my5J8uGSpr0zRrntRjnMmk&type=video&maxResults=50'
ytpl = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId='
ytpl2 = '&maxResults=50&key=AIzaSyBAdxZCHbeJwnQ7dDZQJNfcaF46MdqJ24E'

def Index():
    link=open_url(baseurl)  
    match=re.compile('name="(.+?)".+?url="(.+?)".+?img="(.+?)"',re.DOTALL).findall(link)
    for name,url,iconimage in match:
        if not 'XXX' in name:
            addDir(name,url,1,iconimage,fanart)
        if 'XXX' in name:
            if adultopt == 'true':
                if adultpass == '':
                    dialog = xbmcgui.Dialog()
                    ret = dialog.yesno('Adult Content', 'You have opted to show adult content','','Please set a password to prevent accidental access','Cancel','Lets Go')
                    if ret == 1:
                    keyb = xbmc.Keyboard('', 'Set Password')
                    keyb.doModal()
                    if (keyb.isConfirmed()):
                        passw = keyb.getText()
                        selfAddon.setSetting('password',passw)      
                    addDir(name,url,1,iconimage,fanart)
            if adultopt == 'true':
                if adultpass <> '':
                    addDir(name,url,1,iconimage,fanart)
    addLink('UK Turk Twitter Feed','url',2,'http://www.metalkettle.co/UKTurk/thumbs/twitter.jpg',fanart)
    xbmc.executebuiltin('Container.SetViewMode(500)')

def GetChans(url):
    if 'Index' in url:
        CatIndex(url)
    if 'XXX' in url:
        if adultpass <> '':
            dialog = xbmcgui.Dialog()
            ret = dialog.yesno('Adult Content', 'Please enter the password you set','to continue','','Cancel','Show me the money')
            if ret == 1:
               try:     
                  keyb = xbmc.Keyboard('', 'Set Password')
                  keyb.doModal()
                  if (keyb.isConfirmed()):
                    passw = keyb.getText()
                  if passw == adultpass:
                channels = GetList(url)
                for channel in channels:
                       addLink(channel["name"],channel["url"],3,iconimage,fanart)
               except:pass
    if 'movies' in url:
        channels = GetList(url)
        cnt = len(channels)
        for channel in channels:
            addLinkMeta(channel["name"],channel["url"],3,iconimage,cnt,isFolder=False)
        setView('movies', 'MAIN')
        if 'Index' in url:
            xbmc.executebuiltin('Container.SetViewMode(50)')
    elif 'XXX' not in url:
        burl = url
        channels = GetList(url)
        for channel in channels:
            if 'youtube.com/results?search_query=' in channel["url"]:
                addDir(channel["name"],channel["url"],3,iconimage,fanart)
            elif 'youtube.com/playlist?list=' in channel["url"]:
                addDir(channel["name"],channel["url"],3,iconimage,fanart)
            else:
                if 'txt' in channel["url"]:
                    addDir(channel["name"],channel["url"],3,iconimage,fanart)
                else:
                    addLink(channel["name"],channel["url"],3,iconimage,fanart)
        xbmc.executebuiltin('Container.SetViewMode(50)')

def CatIndex(url):
    link=open_url(url)  
    match=re.compile('name="(.+?)".+?url="(.+?)".+?img="(.+?)"',re.DOTALL).findall(link)
    for name,url,iconimage in match:
        if 'youtube.com/playlist?list=' in url:
            addDir(name,url,3,iconimage,fanart)
        elif 'youtube.com/results?search_query=' in url:
            addDir(name,url,3,iconimage,fanart)
        else:
            addDir(name,url,1,iconimage,fanart)
    xbmc.executebuiltin('Container.SetViewMode(50)')

def GetList(url):
    link=open_url(url)  
    matches=re.compile('^#.+?:-?[0-9]*(.*?),(.*?)\n(.*?)$',re.I+re.M+re.U+re.S).findall(link)
    li = []
    for params, name, url in matches:
        item_data = {"params": params, "name": name, "url": url}
        li.append(item_data)
    list = []
    for channel in li:
        item_data = {"name": channel["name"], "url": channel["url"]}
        matches=re.compile(' (.+?)="(.+?)"',re.I+re.M+re.U+re.S).findall(channel["params"])
        for field, value in matches:
            item_data[field.strip().lower().replace('-', '_')] = value.strip()
        list.append(item_data)
    return list

def PLAYLINK(url,name):
        print url
        if 'txt' in url:
            print 'Found txt'
            GetChans(url)
        else:
            if 'youtube.com/results?search_query=' in url:
            print 'Youtube Search'
            searchterm = url.split('search_query=')[1]
            ytapi = ytapi1 + searchterm + ytapi2
            req = urllib2.Request(ytapi)
            req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
            response = urllib2.urlopen(req)
            link=response.read()
            response.close()
            link = link.replace('\r','').replace('\n','').replace('  ','')
            match=re.compile('"videoId": "(.+?)".+?"title": "(.+?)"',re.DOTALL).findall(link)
            print match
            for ytid,name in match:
                url = 'https://www.youtube.com/watch?v='+ytid
                addLink(name,url,3,iconimage,fanart)
            elif 'youtube.com/playlist?list=' in url:
            print 'Youtube Playlist'
            searchterm = url.split('playlist?list=')[1]
            ytapi = ytpl + searchterm + ytpl2
            req = urllib2.Request(ytapi)
            req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
            response = urllib2.urlopen(req)
            link=response.read()
            response.close()
            link = link.replace('\r','').replace('\n','').replace('  ','')
            match=re.compile('"title": "(.+?)".+?"videoId": "(.+?)"',re.DOTALL).findall(link)
            for name,ytid in match:
                url = 'https://www.youtube.com/watch?v='+ytid
                addLink(name,url,3,iconimage,fanart)
            elif 'dailymotion' in url:
                print 'DailyMotion'
                url = url.replace('video','embed/video')
                req = urllib2.Request(url)
                req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
                response = urllib2.urlopen(req)
                link=response.read()
                response.close()
                match=re.compile('mp4","url"\:"(.+?)"').findall(link)[0]
                streamurl=match.replace('\/','/')
                ok=True
                liz=xbmcgui.ListItem(name, iconImage=iconimage,thumbnailImage=iconimage); liz.setInfo( type="Video", infoLabels={ "Title": name } )
                ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=streamurl,listitem=liz)
                try:
                 xbmc.Player ().play(streamurl, liz, False)
                 return ok
                except:
                 pass
            else:
            print 'Direct Link'
            if urlresolver.HostedMediaFile(url).valid_url():
                streamurl = urlresolver.HostedMediaFile(url).resolve()
            else: streamurl=url 
            ok=True
            liz=xbmcgui.ListItem(name, iconImage=iconimage,thumbnailImage=iconimage); liz.setInfo( type="Video", infoLabels={ "Title": name } )
            ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=streamurl,listitem=liz)
            try:
                 xbmc.Player ().play(streamurl, liz, False)
                 return ok
            except:
                 pass

def TWITTER():
    text = ''
    twit = 'https://script.google.com/macros/s/AKfycbyBcUa5TlEQudk6Y_0o0ZubnmhGL_-b7Up8kQt11xgVwz3ErTo/exec?588677963413065728'
    req = urllib2.Request(twit)
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
    response = urllib2.urlopen(req)
    link=response.read()
    response.close()
    link = link.replace('/n','')
    link = link.decode('utf-8').encode('utf-8').replace('&#39;','\'').replace('&#10;',' - ').replace('&#x2026;','')
    match=re.compile("<title>(.+?)</title>.+?<pubDate>(.+?)</pubDate>",re.DOTALL).findall(link)[1:]
    for status, dte in match:
        try:
                status = status.decode('ascii', 'ignore')
        except:
                status = status.decode('utf-8','ignore')
        dte = dte[:-15]
        status = status.replace('&amp;','')
        dte = '[COLOR blue][B]'+dte+'[/B][/COLOR]'
        text = text+dte+'\n'+status+'\n'+'\n'
    showText('[COLOR blue][B]@uk_turk[/B][/COLOR]', text)

def showText(heading, text):
    id = 10147
    xbmc.executebuiltin('ActivateWindow(%d)' % id)
    xbmc.sleep(100)
    win = xbmcgui.Window(id)
    retry = 50
    while (retry > 0):
    try:
        xbmc.sleep(10)
        retry -= 1
        win.getControl(1).setLabel(heading)
        win.getControl(5).setText(text)
        return
    except:
        pass

def open_url(url):
    url += '?%d=%d' % (random.randint(1, 10000), random.randint(1, 10000))
    req = urllib2.Request(url)
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
    response = urllib2.urlopen(req)
    link=response.read()
    link = link.replace('\r','').replace('\t','').replace('&nbsp;','').replace('\'','')
    response.close()
    return link

def get_params():
    param=[]
    paramstring=sys.argv[2]
    if len(paramstring)>=2:
        params=sys.argv[2]
        cleanedparams=params.replace('?','')
        if (params[len(params)-1]=='/'):
            params=params[0:len(params)-2]
        pairsofparams=cleanedparams.split('&')
        param={}
        for i in range(len(pairsofparams)):
            splitparams={}
            splitparams=pairsofparams[i].split('=')
            if (len(splitparams))==2:
                param[splitparams[0]]=splitparams[1]

    return param

def addDir(name,url,mode,iconimage,fanart,description=''):
    u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)+"&description="+urllib.quote_plus(description)
    ok=True
    liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
    liz.setInfo( type="Video", infoLabels={ "Title": name, 'plot': description } )
    liz.setProperty('fanart_image', fanart)
    ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
    return ok

def addLink(name,url,mode,iconimage,fanart,description=''):
    u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)+"&description="+urllib.quote_plus(description)
    ok=True
    liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
    liz.setInfo( type="Video", infoLabels={ "Title": name, 'plot': description } )
    liz.setProperty('fanart_image', fanart)
    ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=False)
    return ok

def addLinkMeta(name,url,mode,iconimage,itemcount,isFolder=False):
    if metaset=='true':
      if not 'COLOR' in name:
        splitName=name.partition('(')
        simplename=""
        simpleyear=""
        if len(splitName)>0:
        simplename=splitName[0]
        simpleyear=splitName[2].partition(')')
        if len(simpleyear)>0:
        simpleyear=simpleyear[0]
        mg = metahandlers.MetaData()
        meta = mg.get_meta('movie', name=simplename ,year=simpleyear)
        u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&site="+str(site)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
        ok=True
        liz=xbmcgui.ListItem(name, iconImage=meta['cover_url'], thumbnailImage=iconimage)
        liz.setInfo( type="Video", infoLabels= meta )
        contextMenuItems = []
        contextMenuItems.append(('Movie Information', 'XBMC.Action(Info)'))
        liz.addContextMenuItems(contextMenuItems, replaceItems=True)
        if not meta['backdrop_url'] == '': liz.setProperty('fanart_image', meta['backdrop_url'])
        else: liz.setProperty('fanart_image', fanart)
        ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=isFolder,totalItems=itemcount)
        return ok
    else:
        u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&site="+str(site)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
        ok=True
        liz=xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=icon)
        liz.setInfo( type="Video", infoLabels={ "Title": name } )
        liz.setProperty('fanart_image', fanart)
        ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=isFolder)
        return ok

def setView(content, viewType):
    if content:
    xbmcplugin.setContent(int(sys.argv[1]), content)
    if selfAddon.getSetting('auto-view')=='true':
    xbmc.executebuiltin("Container.SetViewMode(%s)" % selfAddon.getSetting(viewType) )

params=get_params(); url=None; name=None; mode=None; site=None; iconimage=None
try: site=urllib.unquote_plus(params["site"])
except: pass
try: url=urllib.unquote_plus(params["url"])
except: pass
try: name=urllib.unquote_plus(params["name"])
except: pass
try: mode=int(params["mode"])
except: pass
try: iconimage=urllib.unquote_plus(params["iconimage"])
except: pass

#print "Site: "+str(site); print "Mode: "+str(mode); print "URL: "+str(url); print "Name: "+str(name)

if mode==None or url==None or len(url)<1: Index()
elif mode==1:GetChans(url)
elif mode==2:TWITTER()
elif mode==3:PLAYLINK(url,name)

xbmcplugin.endOfDirectory(int(sys.argv[1]))


 类似资料:
  • 问题内容: 大家!我可以请您帮我解码以下JSON代码: 我想将上述结构组织为: 注1: 文件夹:收件箱 来自(来自):… 日期(日期):… 时间(时间):… utcOffsetSeconds:… 收件人(地址):… 收件人(姓名):… 状态(deliveryStatus):… 文字(正文):… 笔记2: … 先感谢您! 问题答案: 您可以使用该函数来解码JSON字符串: 而且您会得到像这样的东西:

  • 问题内容: 这是我从提要查找器URL(JSON编码)中作为字符串得到的: 我如何在php中使用json_decode()函数对其进行解码并获取最后一个数组元素(“提要”)?我尝试了以下代码,但没有运气 请帮忙 .. 问题答案: 请注意,使用第二个参数调用它时,已经返回一个数组。 更新: 作为JSON中的值 是一个对象数组,其内容为: 要获取URL,您必须使用或访问数组。 但这是数组的基本处理。也许

  • 问题内容: 我想知道是否有一种方法可以解码类似JSON的字符串。 我得到了字符串: 这不是有效的JSON字符串,因此我无法直接使用python API对其进行解码。Python将仅接受字符串化的JSON字符串,例如: 其中属性被引用为字符串。 问题答案: 使用demjson模块,该模块具有在非严格模式下解码的能力。

  • 问题内容: 我是python3的新手,来自python2,并且我对unicode基本概念有些困惑。我读了一些不错的文章,使事情变得更加清楚,但是我看到python 3上有2种方法可以处理编码和解码,而且我不确定要使用哪种方法。 因此,Python 3中的想法是,每个字符串都是unicode,并且可以按字节进行编码和存储,或者可以再次解码回unicode字符串。 但是有两种方法可以做到: 会生成,但

  • 问题内容: 我得到了一个像这样的字符串 我该如何编写Java代码来解码编码字符,例如 在字符串中。是否有任何现有的类/方法可以对其进行解码? 谢谢。 问题答案: 要取消转义HTML / XML实体,请使用Apache Commons Lang 或homegrow one 。

  • 问题内容: 我有一个像这样的字符串: 我想加密要在干净URL中使用的字符串A。像这样的东西: 给定字符串A,python中是否有编码API,它返回字符串B?给定字符串B,python中是否有解码API,它返回字符串A? 问题答案: 进行编码/解码的一种方法是使用包base64,例如: 是您要找的东西吗?对于您的特殊情况,您将获得: 输入:12234_1_Hello’World_34433_22ac