Help for Regex

Status
Not open for further replies.

gujal

Developer
Dec 26, 2013
517
283
63
need help please. Thank
hxxps://www.afromotion.tv/afrotv/watch/cz
Enjoy!
Code:
<item>
<title>Afromotion TV</title>
<link>$doregex[makelist]</link>
<regex>
<name>makelist</name>
<listrepeat><![CDATA[
   <title>[makelist.param1]</title>
   <link>$doregex[url]|User-Agent=iPhone</link>
   <thumbnail>[makelist.param2]</thumbnail>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m,url='https://www.afromotion.tv/afrotv/all'):
  import re,requests,HTMLParser
  h = HTMLParser.HTMLParser()
  headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1'}
  nextpg = True
  channels = []
  while nextpg:
      html = requests.get(url,headers=headers).text
      items = re.findall('<li><div.+?href="([^"]+).+?src="([^"]+).+?title">([^<]+).+?mark">([^<]+)',html)
      for surl,thumb,name,country in items:
        surl = 'https://www.afromotion.tv' + surl
        title = '[COLOR gold]%s[/COLOR] - [COLOR cyan]%s[/COLOR]'%(country,h.unescape(name))
        channels.append((title,thumb,surl))
      if '">»' in html:
        url = 'https://www.afromotion.tv' + re.findall('href="([^"]+)"\s*data-page[^<]+>»',html)[0]
      else:
        nextpg = False
  return sorted(channels)
]]></expres>
<page></page>
<cookieJar></cookieJar>
</regex>
<regex>
<name>url</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
  import re,requests
  token = re.findall('token"\s*content="([^"]+)',page_data)[0]
  id  =re.findall("Tv.play\('([^']+)",page_data)[0]
  headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1',
             'Referer':'https://www.afromotion.tv/',
             'X-Requested-With':'XMLHttpRequest',
             'X-CSRF-Token':token}
  data = {'_id':id}
  surl = 'https://www.afromotion.tv/ajax/gettvdata'  
  jd = requests.post(surl,data=data,headers=headers,cookies=Cookie_Jar).json()
  strurl = jd['url'][0]['src']
  return strurl
]]></expres>
<page>[makelist.param3]</page>
<referer>https://www.afromotion.tv/</referer>
<cookieJar></cookieJar>
</regex>
<thumbnail>https://cdn.afromotion.tv/uploads/images/logo-inline.png</thumbnail>
</item>
 

gujal

Developer
Dec 26, 2013
517
283
63
Hi

Thank you streamwatcher for putting the page up again

Can you guys help me with this one

Code:
hxxp://sportsonline.pw/channels/pt/sporttv1.html
Thank you in advance
This still works
Code:
<item>
<title>Sport TV1</title>
<Spor**dev*l>http://sportsonline.pw/channels/pt/sporttv1.html</Spor**dev*l>
<referer>http://sportsonline.pw/</referer>
</item>
 

boul

Member
Nov 24, 2017
34
0
6
Enjoy!
Code:
<item>
<title>Afromotion TV</title>
<link>https://www.tvaddons.co/forums/$doregex[makelist]</link>
<regex>
<name>makelist</name>
<listrepeat><=!=[=C=D=A=T=A=[
   <title>[makelist.param1]</title>
   <link>https://www.tvaddons.co/forums/$doregex[url]|User-Agent=iPhone</link>
   <thumbnail>[makelist.param2]</thumbnail>
]=]=></listrepeat>
<expres><=!=[=C=D=A=T=A=[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m,url='https://www.afromotion.tv/afrotv/all'):
  import re,requests,HTMLParser
  h = HTMLParser.HTMLParser()
  headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1'}
  nextpg = True
  channels = []
  while nextpg:
      html = requests.get(url,headers=headers).text
      items = re.findall('<li><div.+?href="([^"]+).+?src="([^"]+).+?title">([^<]+).+?mark">([^<]+)',html)
      for surl,thumb,name,country in items:
        surl = 'https://www.afromotion.tv' + surl
        title = '[COLOR gold]%s[/COLOR] - [COLOR cyan]%s[/COLOR]'%(country,h.unescape(name))
        channels.append((title,thumb,surl))
      if '">»' in html:
        url = 'https://www.afromotion.tv' + re.findall('href="([^"]+)"\s*data-page[^<]+>»',html)[0]
      else:
        nextpg = False
  return sorted(channels)
]=]=></expres>
<page></page>
<cookieJar></cookieJar>
</regex>
<regex>
<name>url</name>
<expres><=!=[=C=D=A=T=A=[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
  import re,requests
  token = re.findall('token"\s*content="([^"]+)',page_data)[0]
  id  =re.findall("Tv.play\('([^']+)",page_data)[0]
  headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1',
             'Referer':'https://www.afromotion.tv/',
             'X-Requested-With':'XMLHttpRequest',
             'X-CSRF-Token':token}
  data = {'_id':id}
  surl = 'https://www.afromotion.tv/ajax/gettvdata'  
  jd = requests.post(surl,data=data,headers=headers,cookies=Cookie_Jar).json()
  strurl = jd['url'][0]['src']
  return strurl
]=]=></expres>
<page>[makelist.param3]</page>
<referer>https://www.afromotion.tv/</referer>
<cookieJar></cookieJar>
</regex>
<thumbnail>https://cdn.afromotion.tv/uploads/images/logo-inline.png</thumbnail>
</item>
Thank so much gujal
 

boul

Member
Nov 24, 2017
34
0
6
Enjoy!
Code:
<item>
<title>Afromotion TV</title>
<link>https://www.tvaddons.co/forums/$doregex[makelist]</link>
<regex>
<name>makelist</name>
<listrepeat><=!=[=C=D=A=T=A=[
   <title>[makelist.param1]</title>
   <link>https://www.tvaddons.co/forums/$doregex[url]|User-Agent=iPhone</link>
   <thumbnail>[makelist.param2]</thumbnail>
]=]=></listrepeat>
<expres><=!=[=C=D=A=T=A=[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m,url='https://www.afromotion.tv/afrotv/all'):
  import re,requests,HTMLParser
  h = HTMLParser.HTMLParser()
  headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1'}
  nextpg = True
  channels = []
  while nextpg:
      html = requests.get(url,headers=headers).text
      items = re.findall('<li><div.+?href="([^"]+).+?src="([^"]+).+?title">([^<]+).+?mark">([^<]+)',html)
      for surl,thumb,name,country in items:
        surl = 'https://www.afromotion.tv' + surl
        title = '[COLOR gold]%s[/COLOR] - [COLOR cyan]%s[/COLOR]'%(country,h.unescape(name))
        channels.append((title,thumb,surl))
      if '">»' in html:
        url = 'https://www.afromotion.tv' + re.findall('href="([^"]+)"\s*data-page[^<]+>»',html)[0]
      else:
        nextpg = False
  return sorted(channels)
]=]=></expres>
<page></page>
<cookieJar></cookieJar>
</regex>
<regex>
<name>url</name>
<expres><=!=[=C=D=A=T=A=[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
  import re,requests
  token = re.findall('token"\s*content="([^"]+)',page_data)[0]
  id  =re.findall("Tv.play\('([^']+)",page_data)[0]
  headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1',
             'Referer':'https://www.afromotion.tv/',
             'X-Requested-With':'XMLHttpRequest',
             'X-CSRF-Token':token}
  data = {'_id':id}
  surl = 'https://www.afromotion.tv/ajax/gettvdata'  
  jd = requests.post(surl,data=data,headers=headers,cookies=Cookie_Jar).json()
  strurl = jd['url'][0]['src']
  return strurl
]=]=></expres>
<page>[makelist.param3]</page>
<referer>https://www.afromotion.tv/</referer>
<cookieJar></cookieJar>
</regex>
<thumbnail>https://cdn.afromotion.tv/uploads/images/logo-inline.png</thumbnail>
</item>
hi gujal, it's stop to work
 

cano58

New member
May 16, 2017
10
0
0
streamwatcher2013,

hxxp://www.kostenloslivetv.com/pro7/

you helped me last time but the regex is not working now, can you check it pls
thanks
 

gujal

Developer
Dec 26, 2013
517
283
63
need help please
hxxps://www.dailymotion.com/embed/video/x3b68jn?autoplay=1
Enjoy!
Code:
<item>
<title>CNews</title>
<link>$doregex[url]|Cookie=$get_cookies$</link>
<regex>
	<name>url</name>
	<expres>(.*)#</expres>
	<page>$doregex[url2]&redirect=0</page>
	<referer>http://www.dailymotion.com/</referer>
	<cookieJar/>
</regex>
<regex>
	<name>url2</name>
	<expres>$pyFunction:'$doregex[jsonurl]'.replace('\/','/')</expres>
	<page/>
</regex>
<regex>
	<name>jsonurl</name>
	<expres>mpegURL","url":"(.*?)"</expres>
	<page>http://www.dailymotion.com/embed/video/x3b68jn</page>
	<cookieJar/>
</regex>
<thumbnail></thumbnail>
</item>
 

boul

Member
Nov 24, 2017
34
0
6
Enjoy!
Code:
<item>
<title>CNews</title>
<link>https://www.tvaddons.co/forums/$doregex[url]|Cookie=$get_cookies$</link>
<regex>
	<name>url</name>
	<expres>(.*)#</expres>
	<page>$doregex[url2]&redirect=0</page>
	<referer>http://www.dailymotion.com/</referer>
	<cookieJar/>
</regex>
<regex>
	<name>url2</name>
	<expres>$pyFunction:'$doregex[jsonurl]'.replace('\/','/')</expres>
	<page/>
</regex>
<regex>
	<name>jsonurl</name>
	<expres>mpegURL","url":"(.*?)"</expres>
	<page>http://www.dailymotion.com/embed/video/x3b68jn</page>
	<cookieJar/>
</regex>
<thumbnail></thumbnail>
</item>
hi gujal, it's not work,
 

gujal

Developer
Dec 26, 2013
517
283
63
@boul
The code works fine on Kodi 17.6 with LSP 2.8.1

If you are on anything else, can't help
 

tpoupi

Member
Jan 2, 2016
32
0
6
some guru can help me to make regex. Thank so much

htpp://latino-webtv.com/ESPN-2-en-vivo/
 

cano58

New member
May 16, 2017
10
0
0
you are a genius;)

edit: when i take the streams it do not work, is there a token or anything?
 
Last edited:

streamwatcher2013

Well-known member
Oct 24, 2013
897
383
63
USA
need help please

hxxps://www.dailymotion.com/embed/video/x3b68jn?autoplay=1
It should run on Kodi 16 and up

Code:
<item>
<title>CNews</title>
<link>$doregex[getUrl]</link>
<regex>
<name>getUrl</name>
<expres><![CDATA[#$pyFunction
import re,requests
def GetLSProData(page_data,Cookie_Jar,m):
  source=requests.get(re.findall('mpegURL","url":"(h.*m3u8.*?)"',page_data)[0].replace('\\','')+'&redirect=0',headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0','Referer':'http://www.dailymotion.com/embed/video/x3b68jn','X-Requested-With':'XMLHttpRequest','Accept':'*/*'}).text
  return re.findall('(.*live-[3,4].*)#',source)[0] # 3 for 720p & 4 for 1080p
]]></expres>
<page>http://www.dailymotion.com/embed/video/x3b68jn</page>
<cookieJar/>
</regex>
<thumbnail>http://www.cnews.fr/assets/images/sitewide/og_direct.png</thumbnail>
</item>
 

cano58

New member
May 16, 2017
10
0
0
Im freaking out, how you do that? Can you teach me or tell me where i can learn this. I find many streams and pages but every time same problem, i dont know how make a regex makelist expres etc.
 

cano58

New member
May 16, 2017
10
0
0
can you look at this, the tsreams are not starting:

Code:
<item>
<title>canlitvlive.co</title>
<link>$doregex[makelist]</link>
<thumbnail></thumbnail>
<regex>
<name>makelist</name>
<listrepeat><![CDATA[
<title>[makelist.param2]</title>
<link>$doregex[getURL]|User-Agent=iPhone</link>
<thumbnail>[makelist.param3]</thumbnail>
]]></listrepeat>
<expres>(?s)li class="ondeiz" data-uri=.*?href="(.*?)".*?title="(.*?)".*?src="(.*?)"</expres>
<page>http://www.canlitvlive.co/tum-kanallar.html</page>
<cookieJar></cookieJar>
</regex>
<regex>
<name>getURL</name>
<expres>file:"(.+?)"</expres>
<page>http://www.canlitvlive.co[makelist.param1]</page>
<cookieJar></cookieJar>
</regex>
<fanart></fanart>
</item>
 
Status
Not open for further replies.