Recent Changes - Search:

LiveStreamsPro

PmWiki

pmwiki.org

edit SideBar

Examples


More examples from forum users (not guaranteed to still work):

Complex python code block example

<item>
    <title>https://www.youtube.com/user/yorubahood/playlists</title>
    <link>$doregex[makelist]</link>
    <regex>
        <name>makelist</name>
        <listrepeat>
            <![CDATA[
           <title>[makelist.param2]</title><link>$doregex[makelist2]</link><referer></referer><thumbnail></thumbnail>
           ]]>
        </listrepeat>
        <expres>aria-describedby=.*?href="(.*?)"&gt;(.*?)&lt;</expres>
        <page>https://www.youtube.com/user/yorubahood/playlists</page>
        <cookieJar></cookieJar>
    </regex>
    <regex>
        <name>makelist2</name>
        <listrepeat>
            <![CDATA[
           <title>page [makelist2.param1]</title><link>$doregex[makelist3]</link><referer></referer><thumbnail></thumbnail>
           ]]>
        </listrepeat>
        <expres> (.*?),</expres>
        <page>$doregex[get-number]</page>
        <cookieJar></cookieJar>
    </regex>
    <regex>
        <name>makelist3</name>
        <listrepeat>
            <![CDATA[
           <title>[makelist3.param2]</title><link>plugin://plugin.video.youtube/play/?video_id=[makelist3.param1]</link <thumbnail>https://i.ytimg.com/vi/[makelist3.param1]/hqdefault.jpg</thumbnail>
           ]]>
        </listrepeat>
        <expres>spf-link " dir="ltr" href="\/watch\?v=(.*?)&amp;.*?\n(.*)</expres>
        <page>$doregex[get-source-page]</page>
        <cookieJar></cookieJar>
    </regex>
    <regex>
        <name>get-number</name>
        <expres>
            <![CDATA[#$pyFunction
           def GetLSProData(page_data,Cookie_Jar,m,lists='[makelist.param1]'):

            import requests
            import re
            lists = lists.replace('[', '').replace(']', '')
            url='https://www.youtube.com' + str(lists)
            headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:42.0) Gecko/20100101 Firefox/42.0 Iceweasel/42.0', 'Accept-Language': 'en-US'}

            rr = requests.get(url, headers=headers)
            number = re.findall('</a></li><li>(.*?) vid', rr.text)[0]
            #number = number.encode('unicode-escape')
            number = number.replace(',', '')
            real = int(float(number)) / 100
            real2 = real + 3

            liste = list(range(real2))
            return liste
           ]]>
        </expres>
        <page></page>
    </regex>
    <regex>
        <name>get-source-page</name>
        <expres>
            <![CDATA[#$pyFunction
           def GetLSProData(page_data,Cookie_Jar,m,lists='[makelist.param1]'):

            import requests
            import re
            import json
            lists = lists.replace('[', '').replace(']', '')
            pageUrl='https://www.youtube.com' + str(lists)
            headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:42.0) Gecko/20100101 Firefox/42.0 Iceweasel/42.0'}
            r1 = requests.get(pageUrl, headers = headers)
            source = r1.text
            page = [makelist2.param1]
            N = int(float(page))
            pre = 'https://www.youtube.com'
            if (N > 1):

              for itr in range (1,N):
               continuex = re.findall('data-uix-load-more-href="(.*?)"', source)[0]
               continuationx = pre + continuex
               r = requests.get(continuationx, headers = headers)
               source = r.text
               jdata = json.loads(source)
               source = jdata["load_more_widget_html"]
               page = jdata["content_html"]
              return page

            else:

             return source
           ]]>
        </expres>
        <page></page>
    </regex>
</item>
Courtesy of biezom.

Login with save session via dummy login item
<item>
<title>Login</title>
<link>$doregex[login]$doregex[savecookie]</link>

<regex>
        <name>login</name>
        <expres></expres>
        <page>http://www.streamlive.to/login.php</page>
        <referer></referer>
        <x-req>XMLHttpRequest</x-req>
        <rawpost>username=XXXXXXXXXX&amp;password=XXXXXXXXXX&amp;accessed_by=web&amp;submit=Login&amp;x=25&amp;y=15</rawpost>
        <cookieJar></cookieJar>
</regex>

<regex>
        <name>savecookie</name>
        <expres></expres>
        <page></page>
        <cookieJar>save[streamlive1.lwp]</cookieJar>
</regex>
</item>

<item>
<title>Bein ES</title>
<link>$doregex[url]</link>
        <regex>
                <name>url</name>
                <expres>$pyFunction:vipracing.decrypt_vipracing('http://www.streamlive.to/embedplayer_new2.php?channel=72400',False,False,'http://vipracing.info/')</expres>
                <page></page>
                <cookieJar>$doregex[loadcookie]</cookieJar>
        </regex>

        <regex>
                <name>loadcookie</name>
                <expres></expres>
                <page></page>
                <cookieJar>open[streamlive1.lwp]</cookieJar>
        </regex>
<thumbnail></thumbnail>
</item>

<item>
<title>Fox Sport 1</title>
<link>$doregex[url]</link>
        <regex>
                <name>url</name>
                <expres>$pyFunction:vipracing.decrypt_vipracing('http://www.streamlive.to/embedplayer_new2.php?channel=73260',False,False,'http://vipracing.info/')</expres>
                <page></page>
                <cookieJar>$doregex[loadcookie]</cookieJar>
        </regex>

        <regex>
                <name>loadcookie</name>
                <expres></expres>
                <page></page>
                <cookieJar>open[streamlive1.lwp]</cookieJar>
        </regex>
<thumbnail></thumbnail>
</item>
 


Openload example
<item>
<title>openload</title>
<link>$doregex[url]|User-Agent=iPhone</link>
<regex>
<name>url</name>
<expres><![CDATA[#$pyFunction
import re
from AADecoder import AADecoder
def baseN(num,b,numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
   return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])

def conv(s,addfactor=None):
   #print s
   if 'function()' in s:
       addfactor=s.split('b.toString(')[1].split(')')[0]
       fname=re.findall('function\(\)\{function (.*?)\(',s)[0]
       s=s.replace(fname,'myfunc')
       s=''.join(s.split('}')[1:])
   if '+' not in s:
       if '.0.toString' in s:
           ival,b=s.split('.0.toString(')
           b=b.replace(')','')
           #print  ival, b
           return baseN(int(ival),int(eval(b)))
       elif 'myfunc' in s:
           b,ival=s.split('myfunc(')[1].split(',')
           ival=ival.replace(')','').replace('(','')
           b=b.replace(')','').replace('(','')
           b=eval(addfactor.replace('a',b))
           #print  ival, b
           return baseN(int(ival),int(b))
       else:
           #print s
           return eval(s)
   r=''
   for ss in s.split('+'):
       r+=conv(ss,addfactor)
   return r

def GetLSProData(page_data,Cookie_Jar,m):
#print page_data
tt=re.findall('id=\"olvideo\".*\n.*?text/javascript\">(.*)</script>',page_data)[0]
print tt
aa=AADecoder(tt)
dtext= aa.decode()
print dtext
dtext=re.findall('window.vs=(.*?);',dtext)[0]
#print dtext
dtext=conv(dtext)
return dtext.replace("https","http")
return re.findall('[\'"](http.*?)[\'"]',dtext)[0].replace("https","http")
]]></expres>
<page>https://openload.co/f/L9K6t7ssO9U</page>
<cookieJar></cookieJar>
</regex>
<thumbnail></thumbnail>
</item>



Openload using Selenium web driver

<item>
<title>openload example</title>
<link>$doregex[get-url]</link>
<regex>
<name>get-url</name>
<expres><![CDATA[#$pyFunction
import urllib
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
user_agent = "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"

profile = webdriver.FirefoxProfile()
profile.set_preference("network.dns.disableIPv6", True)
profile.set_preference("general.useragent.override", user_agent)

capabilities = DesiredCapabilities.FIREFOX.copy()
driver = webdriver.Firefox(firefox_profile=profile, capabilities=capabilities)

def GetLSProData(page_data,Cookie_Jar,m):
   driver.get(m['page'])
   driver.find_element_by_id('videooverlay').click()
   url = driver.execute_script("return document.getElementsByTagName('video').olvideo_html5_api.src;")
   referrer = driver.execute_script("return window.location.href;")
   driver.quit()
   return '{url}|Referer={referrer}&User-Agent={user_agent}'.format(url=url,referrer=urllib.quote(referrer),user_agent=urllib.quote(user_agent))

]]></expres>
<page>https://openload.co/f/L9K6t7ssO9U</page>
</regex>
</item>
Courtesy of hubbab3.



Google recaptcha example

<item>
<title>http://www.stream4free.eu/6ter Google recaptcha</title>
<link>$doregex[loadcookie]$doregex[getmainPage]$doregex[savecookie]|User-Agent=Mozilla/5.0 (X11; Linux i686; rv:44.0) Gecko/20100101 Firefox/44.0 Iceweasel/44.0</link>

<regex>
<name>savecookie</name>
<expres></expres>
<page></page>
<cookieJar>save[stream4Free.lwp]</cookieJar>
</regex>

<regex>
<name>getmainPage</name>
<expres>source src="(.*?)"</expres>
<page>$pyFunction: unCaptcha.performCaptcha('http://www.stream4free.eu/6ter',Cookie_Jar,returnpage=True,captcharegex='sitekey: "(.*?)"')</page>
<agent>Mozilla/5.0 (X11; Linux i686; rv:44.0) Gecko/20100101 Firefox/44.0 Iceweasel/44.0</agent>
<cookieJar></cookieJar>
</regex>

<regex>
<name>loadcookie</name>
<expres></expres>
<page></page>
<cookieJar>open[stream4Free.lwp]</cookieJar>
</regex>

</item>
Courtesy of biezom.



Google recaptcha example; item marked as not playable

<item>
<title>ddlfr decrypt test</title>
<link>$doregex[captcha]</link>
<regex>
<name>captcha</name>
<expres></expres>
<page>http://ddlfr.org/engine/ajax/content.protector.ajax.php</page>
<rawpost>g-recaptcha-response=$doregex[recaptcha]&amp;news=49183&amp;page=showfull&amp;param=news49183</rawpost>
</regex>
<regex>
<name>recaptcha</name>
<expres>$pyFunction: unCaptcha.performCaptcha('http://ddlfr.org/films/exclue/49183-le-pont-des-espions-dvdrip-truefrench.html',Cookie_Jar,returnpage=False,lang="en")</expres>
<page></page>
<NOTPlayable>True</NOTPlayable>
</regex>
</item>
Courtesy of shani.



Google recaptcha example with ignorecache to use the same page more than once

<item>
        <title>firstone</title>
        <link>https://forums.tvaddons.ag/$doregex[get-final]</link>
        <regex>
                <name>get-final</name>
                <expres>$pyFunction:'$doregex[get-url]'.replace('\\/','/')</expres>
                <page></page>
        </regex>
        <regex>
                <name>get-url</name>
                <expres>surl":"(.*?)"</expres>
                <page>https://api.firstonetv.eu/</page>
                <referer>https://www.firstonetv.eu/en/stream/fr/24</referer>
                <agent>Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1</agent>
                <rawpost>action=channel&amp;ctoken=$doregex[get-token]&amp;c=fr&amp;id=24</rawpost>
                <ignorecache>true</ignorecache>
                <cookieJar></cookieJar>
        </regex>
        <regex>
                <name>get-token</name>
                <expres>"ctoken":"(.*?)"</expres>
                <page>https://api.firstonetv.eu/</page>
                <referer>https://www.firstonetv.eu/en/stream/fr/24</referer>
                <agent>Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1</agent>
                <rawpost>action=recaptcha&amp;response=$doregex[recaptcha]</rawpost>
                <cookieJar></cookieJar>
        </regex>
        <regex>
                <name>recaptcha</name>
                <expres>$pyFunction: unCaptcha.performCaptcha('https://www.firstonetv.eu/en/stream/fr/24',Cookie_Jar,returnpage=False,captcharegex="sitekey.*'(.*?)'",lang="en")</expres>
                <page></page>
        </regex>
</item>
Courtesy of rorony.



Solve captcha image with XBMC window dialog

<item>
        <title>http://www.dl-protect.com/974E4FD1</title>
        <link>$doregex[get-videolink]</link>

        <regex>
                <name>get-videolink</name>
                <expres><![CDATA[#$pyFunction
import requests,xbmcgui,xbmc
import re,os,time
import xbmcaddon,xbmc
def GetLSProData(page_data,Cookie_Jar,m):

url = 'http://www.dl-protect.com/974E4FD1'
source= requests.get(url)


cookie1 = source.cookies['__cfduid']
cookie2 = source.cookies['PHPSESSID']
cookie3 = source.cookies['cu']

cookies ={'__cfduid': cookie1, 'PHPSESSID': cookie2, 'cu': cookie3}

imageurl= ''
try:
 imageurl = re.findall('Security code" src="(.*?)"', source.text)[0]
except:
 pass
time.sleep(1)
if imageurl=='':
 key = re.findall('name="key" value="(.*?)"', source.text)[0]
 data = {'key': key, 'submitform': 'Continue', 'submitform': ''}
 r1 = requests.post(url, data= data, cookies=cookies)
 link = re.findall('target="_blank">(.*?)<', r1.text)[0]
 r2 = requests.get(link)
 stream = re.findall('Streaming link: <a href="(.*?)"', r2.text)[0]
 r3 = requests.get(stream)
 videolink = re.findall("source src='(.*?)'", r3.text)[0]
 return 'http:' + videolink
else:

 key = re.findall('name="key" value="(.*?)"', source.text)[0]
 print key
 image = requests.get(imageurl, cookies=cookies)
 text=takeInputForImage(image.content)
 data = {'key': key, 'submitform': '', 'submitform': 'Decrypt+link', 'secure': text}
 r1 = requests.post(url, data= data, cookies=cookies)
 link = re.findall('target="_blank">(.*?)<', r1.text)[0]
 r2 = requests.get(link)
 stream = re.findall('Streaming link: <a href="(.*?)"', r2.text)[0]
 r3 = requests.get(stream)
 videolink = re.findall("source src='(.*?)'", r3.text)[0]
 return 'http:' + videolink


def takeInputForImage(img):
addon = xbmcaddon.Addon('plugin.video.live.streamspro')
addon_version = addon.getAddonInfo('version')
profile = xbmc.translatePath(addon.getAddonInfo('profile').decode('utf-8'))

local_captcha = os.path.join(profile, "mycaptchafile.jpg" )
localFile = open(local_captcha, "wb")    
localFile.write(img)
localFile.close()
solver = InputWindow(captcha=local_captcha)
solution = solver.get()
return solution

class InputWindow(xbmcgui.WindowDialog):
   def __init__(self, *args, **kwargs):
       self.cptloc = kwargs.get('captcha')
       self.img = xbmcgui.ControlImage(335,30,624,60,self.cptloc)
       self.addControl(self.img)
       self.kbd = xbmc.Keyboard()

   def get(self):
       self.show()
       time.sleep(2)
       self.kbd.doModal()
       if (self.kbd.isConfirmed()):
           text = self.kbd.getText()
           self.close()
           return text
       self.close()
       return False        
]]></expres>
                <page></page>
                <cookieJar></cookieJar>
        </regex>
</item>
Courtesy of biezom.



Handle special characters in html source

<item>
<title>frenchstream RegEx **http://frenchstream.tv**</title>
<link>$doregex[makelist]</link>
<regex>
<name>makelist</name>
<listrepeat><![CDATA[
<title>[makelist.param1]</title>
<link>[makelist.param2]</link>
<thumbnail>[makelist.param3]</thumbnail>
]]></listrepeat>
<expres>data-title="(.*?)".*\s.*\s.*\s.*\s.*data-dislike=.+\s.+a href="(.*?)".*\s.*\s.*\s.*\s.*?(http.*?)"</expres>
<page>$doregex[get-decode]</page>
<referer></referer>
</regex>
<regex>                                                  
<name>get-decode</name>                                            
<expres><![CDATA[#$pyFunction
import re
import HTMLParser
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
def GetLSProData(page_data,Cookie_Jar,m):

        parser = HTMLParser.HTMLParser()
        return re.sub("(&.+?;)", lambda m: parser.unescape(m.group()), page_data)


]]></expres>
<page>http://frenchstream.tv</page>
<agent>Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0</agent>
<cookieJar></cookieJar>
</regex>
</item>
Courtesy of rorony.



JSCrypto support in Python block. You need to pass ct, passphrase and salt. like this (its not going to play because the URL is old/expired
now but you can see zee bangla url in the log file.

<item>
<title>cryptojs decode</title>
<link>$doregex[url]</link>
<regex>
<name>url</name>
<expres><![CDATA[#$pyFunction
import jscrypto, base64,re

def GetLSProData(page_data,Cookie_Jar,m):
   ct="AAQz1rUDqp849MRxu0tqGRGvPcLzVG24xa5zbYxpwVHH6Z2p95xPPzNhMIRMcaTPvijE71RQU1X3cQhtnXdRScA6UBiLWNs9vMul2gldnMTpT92sDYHl\\
+hKBGy2dR22Un7ElToipSqeqRrwhEK8T9ROMChrBw8i7JOICpOYoVhqDB72BH2RG\/PqjRqsKittES5BVhTTY9cs+zQI0rM+FQA62bVCL57P3RD+E+aWJJLjUvoXBqc\\
t6Jc5W7li9mk9udgn9rPKkCbXSCvwIxcWS5C1kw4uSO7y0IlovaTWLAIw5nY0l4REjbC1wPWrtxDWLlr8J+\/sQdDF+P61VHz6yiC+w56QLDjVwz4kBl3r3uP\/VZ7kUuLwWHSHnbmmXv31f"\\
   salt="9b2328e8a4ee2717"
   passphrase="f12c8b59265dc1e898135211cc30be49"
   salt=salt.decode("hex")  
   print 'ssss'    
   url= jscrypto.decode(ct,passphrase,salt)
   return url.replace("\\/","/").replace('"','')
]]></expres>
<page></page>
<agent>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36</agent>
</regex>
</item>
Courtesy of shani.



Return values from an array in listrepeat. Requires version 2.4.5. It should be an array of list.

<item>
<title>CATEGORY2</title>
<link>$doregex[makelist]</link>
<regex>
<name>makelist</name>
<listrepeat><![CDATA[
<title> [makelist.param2]</title>
<link>$doregex[makelist2]</link>
<thumbnail></thumbnail>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
import json, base64,re
def GetLSProData(page_data,Cookie_Jar,m):
   jsdata=json.loads(page_data)
   s=[]
   for o in jsdata["LIVETV"]:
       s.append((o["cid"],o["category_name"],o["category_image"]))
   return s
]]></expres>
<page>http://pastebin.com/raw/Vxp6AEex</page>
<agent>Dalvik/2.1.0 (Linux; U; Android 5.0; App Runtime for Chrome Dev Build/50.5021.602.0)</agent>
</regex>
</item>
Courtesy of shani.



To handle json, try using json lib as its easier to manage. The example also shows how to process a page before passing it to listrepeat
<item>
<title>http://tv.vera.com.uy/categorias/33/189 tessssst</title>
<link>$doregex[makelist]</link>

<regex>
<name>makelist</name>
<listrepeat><![CDATA[
<title>title: [makelist.param1]</title>
<link>NA</link>
<thumbnail>[makelist.param2]</thumbnail>
]]></listrepeat>
<expres><![CDATA[line=name=(.*)\nimage_url=(.*)\ncontent_url=(.*?)\n]]></expres>
<page>$doregex[sources]</page>
</regex>

<regex>
<name>sources</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
import requests, re , urllib, urllib2, json

url = 'http://tv.vera.com.uy/categorias/content_json/33/0/189'
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0', 'Referer': ''}
source = requests.get(url, headers = headers,verify=False)
cookie1 = source.cookies['_veratv']
cookie = {'ci_session': cookie1}
r = requests.get(url, headers = headers, cookies=cookie,verify=False).text#.decode('unicode-escape')
jdata=json.loads(r)
data=''
for c in jdata:
   data+="line=name=%s\nimage_url=%s\ncontent_url=%s\n"%(c["name"],c["image_url"],c["content_url"])
return data.encode("utf-8")

return r

]]></expres>
<page></page>
</regex>
</item>
Courtesy of shani.

Send session cookies using Python requests (Note that stream expires after 45 sec).
<item>
<title>TEST | BBC News - FILMON</title>
<link>$doregex[get-url]</link>
<regex>
<name>get-url</name>
<expres><![CDATA[#$pyFunction
def getCookiesString(cookieJar):
   try:
       cookieString=""
       for index, cookie in enumerate(cookieJar):
           cookieString+=cookie.name + "=" + cookie.value +";"
   except: pass
   #print 'cookieString',cookieString
   return cookieString

def GetLSProData(page_data,Cookie_Jar,m):
 import requests, re, urllib
 headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'}
 url = 'http://www.filmon.com/tv/channel/export?channel_id=27'
 session = requests.session()
 source= session.get(url, headers = headers,cookies = Cookie_Jar)
 swf = re.findall('streamer":"(.*?)"', source.text)[0]
 cleanswf = swf.replace('\\/','/')
 referer = 'http://www.filmon.com' + cleanswf
 headers1 = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36', 'Referer': url, 'X-Requested-With': 'XMLHttpRequest'}
 url2 = 'http://www.filmon.com/api-v2/channel/27'
 source1= session.get(url2, headers = headers1,cookies = Cookie_Jar)
 getHD = re.findall('"high","url":"([^"]+)"', source1.text)[0]

 return getHD + '|Referer=' + referer+'&cookie='+getCookiesString(session.cookies)+'&User-Agent=Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'
]]></expres>
<page></page>
</regex>
<thumbnail>http://obamapacman.com/wp-content/uploads/2011/06/BBC-Logo-iPad.jpg</thumbnail>
</item>
Courtesy of shani.

Use listrepeat in regex to read from multiple sites.
<item>
<title> MULTI-SITE  /  1-EXPRES   (data-in-1st-regex) </title>
<link>$doregex[makelist]</link>

<regex>
<name>makelist</name>
<listrepeat><![CDATA[
 <title> [makelist.param2] </title>
 <link>[makelist.param1]</link>
 <thumbnail>NA</thumbnail>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
import re, requests
def GetLSProData(page_data,Cookie_Jar,m):
headers = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0'}
data = []
sites = ['http://S1', 'http://S2blabla', 'http://Sthree', 'http://SCUATRO']

for site in sites:
   source = requests.get(site, headers=headers).text
   data += re.findall('a href="(http:\/\/.*?mp4)" title="([^"]+)"', source)
return data
]]></expres>
<page></page>
</regex>
Courtesy of jujuii.

Use regex in title to read epg from external file
<item>
<title>$doregex[test]</title>
<link>N/A</link>

<regex>
<name>test</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m,):
 import time, requests, re, HTMLParser
 from bisect import bisect_left
 time = time.strftime("%Y%m%d%H%M%S", time.gmtime())
 try:
  epg = 'https://pastebin.com/raw/WY9vbyHe'
  source = requests.get(epg).text
#   ch = 'TF1'
  ch = 'FRANCE 2'
#   ch = 'CANAL\+'
#   ch = 'France 3 Corse Via Stella'
#   ch = 'Franceinfo'
  regex = 'start="(\d+?) .+?channel="' + ch
  start = re.findall(regex, source)
  pos = (bisect_left(start, time))
  t1 = start[pos]
  t2 = start[pos + 1]
  regex = 'start="' + t1 + '.+?channel="' + ch + '">[\\n\\r]*.+?title lang="fr">(.+?)<'
  now = re.findall(regex, source)[0]
  regex = 'start="' + t2 + '.+?channel="' + ch + '">[\\n\\r]*.+?title lang="fr">(.+?)<'
  next = re.findall(regex, source)[0]
 except:
  return ' [COLOR green]No program data[/COLOR]'
 return ' [COLOR green]NOW: [/COLOR]' + HTMLParser.HTMLParser().unescape(now) + '\n[COLOR green] NEXT: [/COLOR]' + HTMLParser.HTMLParser().unescape(next)
]]></expres>
<page></page>
</regex>
</item>
Courtesy of twogun.

Edit - History - Print - Recent Changes - Search
Page last modified on May 14, 2017, at 05:22 PM
Free Web Hosting