TOOLSP
"
WELCOME !

Please ! USE [CODE] tags for your LINKS and CODE.

Favor usar balisas [CODE] para sus vínculos y código.

Merci d'utiliser les balises [CODE] pour vos liens et code.


[code]http://Thank.you[/code]
"
*** Doc. Kodi & PYthon ***
.
.
Python & Modules PY
.
.
.
.
(Video) Cache Kodi
.
.
.
Addons Kodi
.
.
.
Addons Kodi
.
.
*** GITHUB ***
.
.
URLresolver (J.S.) [GIT] +
.
.
.
URLresolver (elD.) [GIT] -
.
.
URLresolver (tvA.) [GIT] -
.
.
.
.
Cloudflare (external) [GIT]
.
.
.
*** Associated ***
.
Pastebin Your list online
.
mediafire Upload Files
.
imgur Upload Pics
lyngsat TV logos collection
transparent .png
.
http://hola.org free? VPN
Hola.apk free? VPN App.
.
hidester- free Proxy
.
webgrabplus EPG - Eng
xmltv EPG - Fr
kazer EPG - Fr
.
.wordreference Traduction
.
mail.com (fast sign-in)
.
.
FRIENDS / PARTNERS

£$π community

créer un forum


Need help to fix karwan.tv

Go down

Need help to fix karwan.tv

Post by vbprofi on Sat 24 Mar - 2:37

Hello,
today this code no longer works. please help to fix it.
Code:

<item>
    <title>[COLOR cyan]Karwan.tv[/COLOR]</title>
<link>$doregex[makelist]</link>

<regex>
<name>makelist</name>
<listrepeat><![CDATA[
<title>[COLOR cyan][makelist.param1][/COLOR]</title>
<link>$doregex[getm3u8]|User-Agent=iPhone</link>
<thumbnail></thumbnail> ]]></listrepeat>
<expres><![CDATA[#$pyFunction
import requests
import re
import HTMLParser
import sys
reload(sys)
sys.setdefaultencoding("utf-8")

def GetLSProData(page_data,Cookie_Jar,m):

 html='http://karwan.tv/'
 ua='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36'
 headers={'Referer':'http://karwan.tv/','User-Agent':ua}
 session = requests.Session()
 session.cookies = Cookie_Jar
 cookies = session.cookies
 source = session.get(html, headers=headers )
# ck=re.findall('document.cookie="netiyi=(.*?)"',source.text)[0]
# cookies = {'netiyi': ck}
 source = session.get(html, headers=headers , cookies = cookies )
 ck=re.findall('(?s)(?i)<div class="bt-inner">.*?title="(.*?)".*?href="(.*?)"',source.text)

 from operator import itemgetter
 from collections import OrderedDict
 #ck = sorted(ck, key=itemgetter(1))


 return ck]]></expres>
<page></page>
<agent>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36</agent>
<cookieJar></cookieJar>
    <agent>Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/47.0.2526.70 Mobile/13C71 Safari/601.1.46</agent>
    <accept>*/*;q=0.8</accept>
</regex>


  <regex>
    <name>getm3u8</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m,):

 import requests
 import re

 html='http://karwan.tv/[makelist.param2]'
 ua='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36'
 headers={'Referer':'http://karwan.tv/','User-Agent':ua}
 session = requests.Session()
 session.cookies = Cookie_Jar
 cookies = session.cookies
 source = session.get(html, headers=headers )
# ck=re.findall('document.cookie="netiyi=(.*?)"',source.text)[0]
# cookies = {'netiyi': ck}
 source = session.get(html, headers=headers , cookies = cookies )
 ck=re.findall('(?s)<iframe.*?align.*?src="(.*?)"',source.text)[0]
 if 'http' not in ck : ck ='http://karwan.tv/'+ck
 
 source = requests.get(ck, headers=headers )
# ck=re.findall('[file|hls][\:|src\=].*["\'](http.*m3u8.*?)["\'].*?["k|\n]',source.text)[0]
 ck=re.findall('[file|hls][\:|src\=].*["\'](http.*m3u8.*?)["\'].*?["k|\n]',source.text)[0]

# ck=re.findall("hls: '(.*?)'",source.text)[0]

 return ck
]]></expres>
   <page></page>
    <cookieJar></cookieJar>
    <agent>Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/47.0.2526.70 Mobile/13C71 Safari/601.1.46</agent>
    <accept>*/*;q=0.8</accept>
  </regex>

</item>

vbprofi

Messages : 43
Date d'inscription : 2017-05-03

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by vbprofi on Sat 24 Mar - 10:46

All channels are lists, but I can't find the problem because why the streams are not works.
the regex for capture the streamlink "hls: '(.*?)'" is true. I don't know, what the problem is.
have someone an idea?

vbprofi

Messages : 43
Date d'inscription : 2017-05-03

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by Goldonx on Sat 24 Mar - 16:11

Problem is here :
Code:
ck=re.findall('(?s)<iframe.*?align.*?src="(.*?)"',source.text)[0]


You have to write
Code:
ck=re.findall('(?s)<iframe.*?align.*?src="(.*?)"',source.text)[-1]

Goldonx

Messages : 16
Date d'inscription : 2018-02-11

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by vbprofi on Sat 24 Mar - 20:05

wow, that is working.... thank you!

vbprofi

Messages : 43
Date d'inscription : 2017-05-03

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by solved on Sat 24 Mar - 21:48

solved with that pretty [-1]

solved

Messages : 70
Date d'inscription : 2017-06-27

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by vbprofi on Sat 24 Mar - 23:11

do you have an idea, how I can sort the streams by custom names with above code? I will bring some streams on the top of the list and I don't know, how i can do that by using foreach-loop in python.

vbprofi

Messages : 43
Date d'inscription : 2017-05-03

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by Goldonx on Sun 25 Mar - 17:12

I'm sorry. I have no idea. I'm not an expert python.

Goldonx

Messages : 16
Date d'inscription : 2018-02-11

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by gujal on Tue 10 Apr - 14:10

@vbprofi
There is lot of unnecessary python code in your xml.
Here is a lean XML with channel thumbnails, and channels sorted alphabetically. Enjoy!
Code:
<item>
<title>[COLOR cyan]Karwan.tv[/COLOR]</title>
<link>$doregex[makelist]</link>
<regex>
<name>makelist</name>
<listrepeat><![CDATA[
<title>[COLOR cyan][makelist.param1][/COLOR]</title>
<link>$doregex[getm3u8]|User-Agent=iPhone</link>
<thumbnail>[makelist.param3]</thumbnail>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
 import re
 items=re.findall('class="bt-inner".+?title="\s*([^"]+).+?href="([^"]+).+?src="([^"]+)',page_data,re.DOTALL)
 return sorted(items)
]]></expres>
<page>http://karwan.tv/</page>
</regex>
<regex>
<name>getm3u8</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
 import re
 url=re.findall('''(?:file|hls):\s*["']([^"']+)["']''',page_data)[-1]
 return url
]]></expres>
<page>http://karwan.tv/$doregex[strpg]</page>
</regex>
<regex>
<name>strpg</name>
<expres>art-article.+?src="([^"]+)</expres>
<page>http://karwan.tv[makelist.param2]</page>
</regex>
</item>
avatar
gujal

Messages : 19
Date d'inscription : 2018-04-10

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by jairoxyz on Tue 10 Apr - 14:16

Hey @gujal, just arrived and already helping Wink

jairoxyz

Messages : 52
Date d'inscription : 2017-06-19

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by vbprofi on Tue 10 Apr - 14:34

@gujal, thanks for your solution. that is gread work!
Do you have an Idea, how I can sort the channelitems by own range?
I will bring some channelitems to the top.

thanks for spend your time!

vbprofi

Messages : 43
Date d'inscription : 2017-05-03

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by vbprofi on Wed 11 Apr - 2:40

Hello,
I have work out an solution for me. Give an chance to create a dynamic code for that solution? and how I can insert all other items without double items?

Code:

<item>
<title>[COLOR cyan]Karwan.TV (testing...)[/COLOR]</title>
<link>$doregex[makelist]</link>
<regex>
<name>makelist</name>
<listrepeat><![CDATA[
<title>[COLOR cyan][makelist.param1][/COLOR]</title>
<link>$doregex[getm3u8]|User-Agent=iPhone</link>
<thumbnail>[makelist.param3]</thumbnail>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
 import re
 items=re.findall('class="bt-inner".+?title="\s*([^"]+).+?href="([^"]+).+?src="([^"]+)',page_data,re.DOTALL)
# return sorted(items)
#
#New Sorting...
 ch = []
#RonahiTV
 ch.append(items[0])
#MedyaHaberTV
 ch.append(items[5])
#CiraTV
 ch.append(items[13])
#SterkTV
 ch.append(items[15])
#AryenTV
 ch.append(items[24])
#JinTV
 ch.append(items[40])
#ZarokTV
 ch.append(items[41])
#MedMüzik
 ch.append(items[44])
#ArtiTV
 ch.append(items[45])
 ch = sorted(ch)

 return ch #items
]]></expres>
<page>http://karwan.tv/</page>
</regex>
<regex>
<name>getm3u8</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
 import re
 url=re.findall('''(?:file|hls):\s*["']([^"']+)["']''',page_data)[-1]
 return url
]]></expres>
<page>http://karwan.tv/$doregex[strpg]</page>
</regex>
<regex>
<name>strpg</name>
<expres>art-article.+?src="([^"]+)</expres>
<page>http://karwan.tv[makelist.param2]</page>
</regex>
</item>

vbprofi

Messages : 43
Date d'inscription : 2017-05-03

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by gujal on Wed 11 Apr - 6:00

That is just simple python code. Keep adding more to 'mylist' as required. Enjoy!
Code:
<item>
<title>[COLOR cyan]Karwan.tv[/COLOR]</title>
<link>$doregex[makelist]</link>
<regex>
<name>makelist</name>
<listrepeat><![CDATA[
<title>[COLOR cyan][makelist.param1][/COLOR]</title>
<link>$doregex[getm3u8]|User-Agent=iPhone</link>
<thumbnail>[makelist.param3]</thumbnail>
]]></listrepeat>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
  import re
  items=re.findall('class="bt-inner".+?title="\s*([^"]+)\s*".+?href="([^"]+).+?src="([^"]+)',page_data,re.DOTALL)
  mylist = ['Ronahî','Medya Haber','Çira','Stêrk','Aryen','JIN',
            'Zarok','Med Müzik','Arti']
  chs = []
  for title,url,thumb in items:
    if any([x.lower() in title.lower() for x in mylist]):
      title = '00' + title
    else:
      title = '99' + title
    chs.append((title,url,thumb))
  myorder = []
  for title,url,thumb in sorted(chs):
    myorder.append((title[2:],url,thumb))
  return myorder
]]></expres>
<page>http://karwan.tv/</page>
</regex>
<regex>
<name>getm3u8</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
  import re
  url=re.findall('''(?:file|hls):\s*["']([^"']+)["']''',page_data)[-1]
  return url
]]></expres>
<page>http://karwan.tv/$doregex[strpg]</page>
</regex>
<regex>
<name>strpg</name>
<expres>art-article.+?src="([^"]+)</expres>
<page>http://karwan.tv[makelist.param2]</page>
</regex>
</item>
avatar
gujal

Messages : 19
Date d'inscription : 2018-04-10

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by vbprofi on Wed 11 Apr - 9:34

wow, great work! that is working well and that is it!!!!
thank you very very much!
Best regards

vbprofi

Messages : 43
Date d'inscription : 2017-05-03

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by vbprofi on Wed 18 Apr - 15:57

today the above code is not working.
with adding referer karwan.tv and change the array [-1] to 0, 1 or 2 it is not works.
@gujal have you an idea what the problem is?

Update/Edit:
I have find the problem... by adding cookies_yar and referer that is working again...

vbprofi

Messages : 43
Date d'inscription : 2017-05-03

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by solved on Thu 31 May - 9:02

it looks like it is
solved ...

solved

Messages : 70
Date d'inscription : 2017-06-27

View user profile

Back to top Go down

Re: Need help to fix karwan.tv

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum