Help for Regex Help for Regex - Page 3 | Kodi Forums
Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26

Thread: Help for Regex

  1. #21
    Addon Developer gujal's Avatar
    Join Date
    Dec 2013
    Posts
    94
    Quote Originally Posted by boul View Post
    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 '">&raquo;' in html:
            url = 'https://www.afromotion.tv' + re.findall('href="([^"]+)"\s*data-page[^<]+>&raquo;',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>


  2. #22
    Addon Developer gujal's Avatar
    Join Date
    Dec 2013
    Posts
    94
    Quote Originally Posted by hugoladeira View Post
    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>
    <sportsdevil>http://sportsonline.pw/channels/pt/sporttv1.html</sportsdevil>
    <referer>http://sportsonline.pw/</referer>
    </item>

  3. #23
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    THANK so much

  4. #24
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    Quote Originally Posted by gujal View Post
    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

  5. #25
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    Quote Originally Posted by gujal View Post
    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

  6. #26
    Junior Member
    Join Date
    May 2017
    Posts
    3
    streamwatcher2013,

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

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

Page 3 of 3 FirstFirst 123

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •