Skip to content

Instantly share code, notes, and snippets.

@ypchen
Last active February 9, 2021 13:50
Show Gist options
  • Select an option

  • Save ypchen/3312e9f0ee2e9268d849057364c7fa9f to your computer and use it in GitHub Desktop.

Select an option

Save ypchen/3312e9f0ee2e9268d849057364c7fa9f to your computer and use it in GitHub Desktop.

Revisions

  1. ypchen revised this gist Feb 9, 2021. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion hdp_ims-1.18.1.py
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,18 @@
    def my_gist_hash ():
    return '3312e9f0ee2e9268d849057364c7fa9f'

    def my_addon_version ():
    return '1.18.1'

    def my_version ():
    return '1.18.1-gist-r10'
    return my_addon_version() + '-gist-r11'

    # priv: revision 70

    # If the version number mismatches, overwrite gist_hash in settings.xml
    if (my_addon_version() != xbmcaddon.Addon().getAddonInfo('version')):
    addon.setSetting('gist_hash', version_gist_hash[xbmcaddon.Addon().getAddonInfo('version')])

    sites = [
    {
    'title': '酷播 99KUBO',
  2. ypchen revised this gist Feb 9, 2021. 1 changed file with 448 additions and 18 deletions.
    466 changes: 448 additions & 18 deletions hdp_ims-1.18.1.py
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@ def my_gist_hash ():
    return '3312e9f0ee2e9268d849057364c7fa9f'

    def my_version ():
    return '1.18.1-gist-r9'
    return '1.18.1-gist-r10'

    # priv: revision 51
    # priv: revision 70

    sites = [
    {
    @@ -15,11 +15,18 @@ def my_version ():
    'siteVisible': 'siteVisible = True'
    },
    {
    'title': 'YouTube 頻道',
    'title': '劇迷 gimy.tv',
    'action': 'list_items',
    'callback': 'youtube_channel_list()',
    'callback': 'gimytv_id()',
    'isFolder': True,
    'siteVisible': 'siteVisible = (0 < len(youtube_channels))'
    'siteVisible': 'siteVisible = True'
    },
    {
    'title': '劇迷 gimy.cc',
    'action': 'list_items',
    'callback': 'gimycc_id()',
    'isFolder': True,
    'siteVisible': 'siteVisible = True'
    },
    ]

    @@ -134,18 +141,441 @@ def kubo_videos (params):
    return items
    # -- kubo --

    # -- youtube (work in progress) --
    def youtube_channel_list ():
    name = 'youtube_channel_list()'
    youtube_channels = []
    exec read_youtube_channels()
    xbmc.log('[%s] %s' % (name, 'youtube_channels={' + ', '.join(youtube_channels) + '}'), xbmc.LOGNOTICE)
    # -- gimy.tv --
    def gimytv_id ():
    # hard-coded top level menu items
    # link is the -id-- in the search criteria
    return [
    {
    'title': '電視劇', 'link': 'https://gimy.tv/genre/2-----------.html', 'action': 'list_items',
    'callback': 'gimytv_drama_category(params)', 'isFolder': True
    },
    {
    'title': '電影', 'link': 'https://gimy.tv/genre/1-----------.html', 'action': 'list_items',
    'callback': 'gimytv_movie_category(params)', 'isFolder': True
    },
    {
    'title': '動漫', 'link': 'https://gimy.tv/genre/4-----------.html', 'action': 'list_items',
    'callback': 'gimytv_area(params)', 'isFolder': True
    },
    {
    'title': '綜藝', 'link': 'https://gimy.tv/genre/3-----------.html', 'action': 'list_items',
    'callback': 'gimytv_area(params)', 'isFolder': True
    }
    ]

    gimytv_filter_URL_prefix = 'https://gimy.tv'
    gimytv_filter_insert_all = '全部'
    gimytv_filter_insert_at = '2020'
    gimytv_filter_insert_this = '2021'
    gimytv_filter_insert_pre = '-'
    gimytv_filter_insert_post = '.'
    gimytv_filter_str1 = '</ul>'
    gimytv_filter_str2 = '<a '
    gimytv_filter_str3 = '>'
    gimytv_filter_str4 = '</a'
    gimytv_filter_str5 = 'href="'
    gimytv_filter_str6 = '"'
    def gimytv_filter (params, url, explodeStart, nextCallback):
    html = get_link_contents(url)
    if ('' == html):
    return []
    htmlToExplode = str_between(html, explodeStart, gimytv_filter_str1)
    videos = htmlToExplode.split(gimytv_filter_str2)
    videos.pop(0)
    siteURLprefix = gimytv_filter_URL_prefix
    items = []
    prevTitle = ''
    for video in videos:
    title = str_between(video, gimytv_filter_str3, gimytv_filter_str4).strip()
    # order asc
    if ((prevTitle == gimytv_filter_insert_at) and (title == gimytv_filter_insert_all)):
    items.append({'title': gimytv_filter_insert_this, 'link': link.replace(gimytv_filter_insert_pre + gimytv_filter_insert_at + gimytv_filter_insert_post, gimytv_filter_insert_pre + gimytv_filter_insert_this + gimytv_filter_insert_post), 'action': 'list_items', 'callback': nextCallback, 'isFolder': True})
    link = siteURLprefix + str_between(video, gimytv_filter_str5, gimytv_filter_str6).strip()
    # order desc
    if ((prevTitle == gimytv_filter_insert_all) and (title == gimytv_filter_insert_at)):
    items.append({'title': gimytv_filter_insert_this, 'link': link.replace(gimytv_filter_insert_pre + gimytv_filter_insert_at + gimytv_filter_insert_post, gimytv_filter_insert_pre + gimytv_filter_insert_this + gimytv_filter_insert_post), 'action': 'list_items', 'callback': nextCallback, 'isFolder': True})
    items.append({'title': title, 'link': link, 'action': 'list_items', 'callback': nextCallback, 'isFolder': True})
    prevTitle = title
    return items

    def gimytv_drama_category (params):
    return gimytv_filter (params, params['link'], '">类型', 'gimytv_year(params)')

    def gimytv_movie_category (params):
    return gimytv_filter (params, params['link'], '">类型', 'gimytv_area(params)')

    def gimytv_area (params):
    return gimytv_filter (params, params['link'], '">地区', 'gimytv_year(params)')

    def gimytv_year (params):
    return gimytv_filter (params, params['link'], '">年份', 'gimytv_videos(params)')

    gimytv_videos_str1 = 'class="myui-page '
    gimytv_videos_str2 = '</ul>'
    gimytv_videos_str3 = 'class="visible-xs"'
    gimytv_videos_str4 = '</li>'
    gimytv_videos_str5 = '">'
    gimytv_videos_str6 = '/'
    gimytv_videos_str7 = '/'
    gimytv_videos_str8 = '</a>'
    #gimytv_videos_str9 = 'pagegbk" data="p-'
    #gimytv_videos_strA = '">尾頁</a>'
    gimytv_videos_strB = 'class="myui-vodlist '
    gimytv_videos_strC = '<div class="myui-foot '
    gimytv_videos_strD = '<li '
    gimytv_videos_strE = 'https://gimy.tv'
    gimytv_videos_strF = '</li>'
    gimytv_videos_strG = '上一页'
    gimytv_videos_strH = '">'
    gimytv_videos_strI = '</a'
    gimytv_videos_strJ = 'href="'
    gimytv_videos_strK = '"'
    gimytv_videos_strL = 'title="'
    gimytv_videos_strM = '"'
    gimytv_videos_strN = 'href="'
    gimytv_videos_strO = '"'
    gimytv_videos_strP = 'data-original="'
    gimytv_videos_strQ = '"'
    gimytv_videos_strR = 'pic-text text-right">'
    gimytv_videos_strS = '</span>'
    gimytv_videos_strT = '下一页'
    gimytv_videos_strU = '">'
    gimytv_videos_strV = '</a'
    gimytv_videos_strW = 'href="'
    gimytv_videos_strX = '"'
    gimytv_videos_strY = 'text-muted hidden-xs">'
    gimytv_videos_strZ = '</p>'
    def gimytv_videos (params):
    name = 'gimytv_videos()'
    data = json.loads(base64.b64decode(params['data']), 'utf-8')
    try:
    page = int(data['page'])
    except:
    page = 1
    html = get_link_contents(params['link'])
    if ('' == html):
    return []
    pageHtmlAll = str_between(html, gimytv_videos_str1, gimytv_videos_str2)
    pageHtml = str_between(pageHtmlAll, gimytv_videos_str3, gimytv_videos_str4)
    pages = []
    pages.append(str_between(pageHtml, gimytv_videos_str5, gimytv_videos_str6))
    pages.append(str_between(pageHtml, gimytv_videos_str7, gimytv_videos_str8))
    # xbmc.log('[%s] %s' % (name, 'pages={' + pages[0] + ',' + pages[1] + '}'), xbmc.LOGNOTICE)
    if ('' == pages[1]):
    pages[1] = str(page)
    pages[0] = pages[1]
    htmlToExplode = str_between(html, gimytv_videos_strB, gimytv_videos_strC)
    videos = htmlToExplode.split(gimytv_videos_strD)
    videos.pop(0)
    siteURLprefix = gimytv_videos_strE
    items = []
    items.append({'title': '第 [COLOR limegreen]' + pages[0] + '[/COLOR] 頁/共 [COLOR limegreen]' + pages[1] + '[/COLOR] 頁', 'link': '', 'action': '', 'callback': '', 'isFolder': False})
    pageBlocks = pageHtmlAll.split(gimytv_videos_strF)
    if (page > 1):
    for pageBlock in pageBlocks:
    if (gimytv_videos_strG == str_between(pageBlock, gimytv_videos_strH, gimytv_videos_strI).strip()):
    link = siteURLprefix + str_between(pageBlock, gimytv_videos_strJ, gimytv_videos_strK).strip()
    items.append({'title': '上一頁 (回第' + str(page-1) + '頁)', 'link': link, 'action': 'list_items', 'callback': 'gimytv_videos(params)', 'isFolder': True, 'page': (page-1)})
    break
    for video in videos:
    title = str_between(video, gimytv_videos_strL, gimytv_videos_strM).strip()
    if ('' != title):
    link = siteURLprefix + str_between(video, gimytv_videos_strN, gimytv_videos_strO).strip()
    image = str_between(video, gimytv_videos_strP, gimytv_videos_strQ).strip()
    note = '(' + str_between(video, gimytv_videos_strR, gimytv_videos_strS).strip() + ') ' + str_between(video, gimytv_videos_strY, gimytv_videos_strZ).strip()
    items.append({'title': title + ' -- ' + note, 'link': link, 'action': 'list_items', 'callback': 'gimytv_sources(params)', 'isFolder': True, 'image': image})
    if (int(page) < int(pages[1])):
    for pageBlock in pageBlocks:
    if (gimytv_videos_strT == str_between(pageBlock, gimytv_videos_strU, gimytv_videos_strV).strip()):
    link = siteURLprefix + str_between(pageBlock, gimytv_videos_strW, gimytv_videos_strX).strip()
    items.append({'title': '下一頁 (到第' + str(page+1) + '頁)', 'link': link, 'action': 'list_items', 'callback': 'gimytv_videos(params)', 'isFolder': True, 'page': (page+1)})
    break
    return items

    gimytv_sources_str1 = '播放地址'
    gimytv_sources_str2 = '</ul>'
    gimytv_sources_str3 = '<li>'
    gimytv_sources_str4 = '">'
    gimytv_sources_str5 = '</a>'
    gimytv_sources_str6 = 'href="#'
    gimytv_sources_str7 = '"'
    gimytv_sources_str8 = '播放地址'
    gimytv_sources_str9 = '剧情简介'
    gimytv_sources_strA = 'class="tab-content '
    gimytv_sources_strB = '<script '
    def gimytv_sources (params):
    name = 'gimytv_sources()'
    html = get_link_contents(params['link'])
    if ('' == html):
    return []
    htmlToExplode = str_between(html, gimytv_sources_str1, gimytv_sources_str2)
    videos = htmlToExplode.split(gimytv_sources_str3)
    videos.pop(0)
    items = []
    items.append({'title': '選擇來源:', 'link': '', 'action': '', 'callback': '', 'isFolder': False})
    for video in videos:
    title = str_between(video, gimytv_sources_str4, gimytv_sources_str5).strip()
    playlist_id = str_between(video, gimytv_sources_str6, gimytv_sources_str7).strip()
    # playlist_id = title
    items.append({'title': title, 'link': params['link'], 'action': 'list_items', 'callback': 'gimytv_episodes(params)', 'isFolder': True, 'playlist_id': playlist_id, 'playlist_title': title, 'html': str_between(str_between(html, gimytv_sources_str8, gimytv_sources_str9), gimytv_sources_strA, gimytv_sources_strB)})
    return items

    gimytv_episodes_str_default_id = 'playlist1'
    gimytv_episodes_str1 = '<div'
    gimytv_episodes_str2 = '</ul>'
    gimytv_episodes_str3 = '<li '
    gimytv_episodes_str4 = 'https://gimy.tv'
    gimytv_episodes_str5 = '.html">'
    gimytv_episodes_str6 = '<'
    gimytv_episodes_str7 = 'href="'
    gimytv_episodes_str8 = '"'
    def gimytv_episodes (params):
    name = 'gimytv_episodes()'
    data = json.loads(base64.b64decode(params['data']), 'utf-8')
    try:
    playlist_id = data['playlist_id']
    playlist_title = data['playlist_title']
    except:
    playlist_id = gimytv_episodes_str_default_id
    playlist_title = '預設'
    html = data['html']
    htmlToExplode = html
    videoSources = htmlToExplode.split(gimytv_episodes_str1)
    videoSources.pop(0)
    for videoSource in videoSources:
    if ((-1) != videoSource.find(playlist_id)):
    # xbmc.log('[%s] %s' % (name, 'playlist_id={' + playlist_id + '}'), xbmc.LOGNOTICE)
    html = videoSource
    htmlToExplode = str_between(html, playlist_id, gimytv_episodes_str2)
    videos = htmlToExplode.split(gimytv_episodes_str3)
    videos.pop(0)
    siteURLprefix = gimytv_episodes_str4
    items = []
    for video in videos:
    title = playlist_title + ': ' + str_between(video, gimytv_episodes_str5, gimytv_episodes_str6).strip()
    link = siteURLprefix + str_between(video, gimytv_episodes_str7, gimytv_episodes_str8).strip()
    # xbmc.log('[%s] %s' % (name, 'link={' + link + '}'), xbmc.LOGNOTICE)
    link = build_url_dict({'action': 'gimytv_episode', 'link': link})
    items.append({'title': title, 'link': link, 'isFolder': False, 'IsPlayable': 'True'})
    return items
    return []

    def gimytv_episode (params):
    html = get_link_contents(params['link'])
    if ('' == html):
    return []
    htmlToExplode = str_between(html, 'player_data=', '</script>')
    link = str_between(htmlToExplode, '"url":"', '"').replace('\\/', '/')
    playitem = xbmcgui.ListItem(path=link)
    playitem.setProperty('inputstreamaddon','inputstream.adaptive')
    playitem.setProperty('inputstream.adaptive.manifest_type','hls')
    playitem.setMimeType('application/vnd.apple.mpegurl')
    playitem.setContentLookup(False)
    xbmcplugin.setResolvedUrl(addon_handle, True, playitem)
    # -- gimy.tv --

    # -- gimy.cc --
    def gimycc_id ():
    # hard-coded top level menu items
    # link is the -id-- in the search criteria
    return [
    {
    'title': '電視劇', 'link': 'https://gimy.cc/vodshow/drama---time.html', 'action': 'list_items',
    'callback': 'gimycc_drama_category(params)', 'isFolder': True
    },
    {
    'title': '電影', 'link': 'https://gimy.cc/vodshow/1---.html', 'action': 'list_items',
    'callback': 'gimycc_movie_category(params)', 'isFolder': True
    },
    {
    'title': '動漫', 'link': 'https://gimy.cc/vodshow/anime---.html', 'action': 'list_items',
    'callback': 'gimycc_area(params)', 'isFolder': True
    },
    {
    'title': '綜藝', 'link': 'https://gimy.cc/vodshow/variety---.html', 'action': 'list_items',
    'callback': 'gimycc_area(params)', 'isFolder': True
    }
    ]

    gimycc_filter_URL_prefix = 'https://gimy.cc'
    gimycc_filter_insert_all = '全部'
    gimycc_filter_insert_at = '2020'
    gimycc_filter_insert_this = '2021'
    gimycc_filter_insert_pre = '-'
    gimycc_filter_insert_post = '-'
    gimycc_filter_str1 = '</ul>'
    gimycc_filter_str2 = '<a '
    gimycc_filter_str3 = '>'
    gimycc_filter_str4 = '</a'
    gimycc_filter_str5 = 'href="'
    gimycc_filter_str6 = '"'
    def gimycc_filter (params, url, explodeStart, nextCallback):
    html = get_link_contents(url)
    if ('' == html):
    return []
    htmlToExplode = str_between(html, explodeStart, gimycc_filter_str1)
    videos = htmlToExplode.split(gimycc_filter_str2)
    videos.pop(0)
    siteURLprefix = gimycc_filter_URL_prefix
    items = []
    for youtube_channel in youtube_channels:
    xbmc.log('[%s] %s' % (name, 'youtube_channel={' + youtube_channel + '}'), xbmc.LOGNOTICE)
    title = youtube_channel
    link = youtube_channel
    items.append({'title': title, 'link': link, 'action': 'list_items',
    'callback': 'youtube_items(params)', 'isFolder': True})
    prevTitle = ''
    for video in videos:
    title = str_between(video, gimycc_filter_str3, gimycc_filter_str4).strip()
    # order asc
    if ((prevTitle == gimycc_filter_insert_at) and (title == gimycc_filter_insert_all)):
    items.append({'title': gimycc_filter_insert_this, 'link': link.replace(gimycc_filter_insert_pre + gimycc_filter_insert_at + gimycc_filter_insert_post, gimycc_filter_insert_pre + gimycc_filter_insert_this + gimycc_filter_insert_post), 'action': 'list_items', 'callback': nextCallback, 'isFolder': True})
    link = siteURLprefix + str_between(video, gimycc_filter_str5, gimycc_filter_str6).strip()
    # order desc
    if ((prevTitle == gimycc_filter_insert_all) and (title == gimycc_filter_insert_at)):
    items.append({'title': gimycc_filter_insert_this, 'link': link.replace(gimycc_filter_insert_pre + gimycc_filter_insert_at + gimycc_filter_insert_post, gimycc_filter_insert_pre + gimycc_filter_insert_this + gimycc_filter_insert_post), 'action': 'list_items', 'callback': nextCallback, 'isFolder': True})
    items.append({'title': title, 'link': link, 'action': 'list_items', 'callback': nextCallback, 'isFolder': True})
    prevTitle = title
    return items
    # -- youtube (work in progress) --

    def gimycc_drama_category (params):
    return gimycc_filter (params, params['link'], '<span class="text-muted">類型', 'gimycc_year(params)')

    def gimycc_movie_category (params):
    return gimycc_filter (params, params['link'], '<span class="text-muted">類型', 'gimycc_area(params)')

    def gimycc_year (params):
    return gimycc_filter (params, params['link'], '<span class="text-muted">年份', 'gimycc_videos(params)')

    def gimycc_area (params):
    return gimycc_filter (params, params['link'], '<span class="text-muted">地區', 'gimycc_year(params)')

    gimycc_videos_str1 = '<ul class="stui-page text-center clearfix">'
    gimycc_videos_str2 = '</ul>'
    #gimycc_videos_str3 = ''
    #gimycc_videos_str4 = ''
    gimycc_videos_str5 = '<span class="num">'
    gimycc_videos_str6 = '</span>'
    #gimycc_videos_str7 = '下一頁</a>'
    #gimycc_videos_str8 = '</ul>'
    #gimycc_videos_str9 = 'pagegbk" data="p-'
    #gimycc_videos_strA = '">尾頁</a>'
    gimycc_videos_strB = '<ul class="stui-vodlist '
    gimycc_videos_strC = '<ul class="stui-page '
    gimycc_videos_strD = '<div class="stui-vodlist__box'
    gimycc_videos_strE = 'https://gimy.cc'
    gimycc_videos_strF = '</li>'
    gimycc_videos_strG = '上一頁'
    gimycc_videos_strH = '">'
    gimycc_videos_strI = '</a'
    gimycc_videos_strJ = 'href="'
    gimycc_videos_strK = '"'
    gimycc_videos_strL = 'title="'
    gimycc_videos_strM = '"'
    gimycc_videos_strN = 'href="'
    gimycc_videos_strO = '"'
    gimycc_videos_strP = 'data-original="'
    gimycc_videos_strQ = '"'
    gimycc_videos_strR = 'pic-text text-right">'
    gimycc_videos_strS = '</span>'
    gimycc_videos_strT = '下一頁'
    gimycc_videos_strU = '">'
    gimycc_videos_strV = '</a'
    gimycc_videos_strW = 'href="'
    gimycc_videos_strX = '"'
    gimycc_videos_strY = 'text-muted hidden-xs">'
    gimycc_videos_strZ = '</p>'
    def gimycc_videos (params):
    data = json.loads(base64.b64decode(params['data']), 'utf-8')
    try:
    page = int(data['page'])
    except:
    page = 1
    html = get_link_contents(params['link'])
    if ('' == html):
    return []
    # pageHtml = str_between(str_between(html, gimycc_videos_str1, gimycc_videos_str2), gimycc_videos_str3, gimycc_videos_str4)
    pageHtml = str_between(html, gimycc_videos_str1, gimycc_videos_str2)
    pages = str_between(pageHtml, gimycc_videos_str5, gimycc_videos_str6).split('/')
    # pages.append(str_between(pageHtml, gimycc_videos_str5, gimycc_videos_str6))
    # pages.append(str_between(str_between(pageHtml, gimycc_videos_str7, gimycc_videos_str8), gimycc_videos_str9, gimycc_videos_strA))
    if ('' == pages[1]):
    pages[1] = str(page)
    htmlToExplode = str_between(html, gimycc_videos_strB, gimycc_videos_strC)
    videos = htmlToExplode.split(gimycc_videos_strD)
    videos.pop(0)
    siteURLprefix = gimycc_videos_strE
    items = []
    items.append({'title': '第 [COLOR limegreen]' + pages[0] + '[/COLOR] 頁/共 [COLOR limegreen]' + pages[1] + '[/COLOR] 頁', 'link': '', 'action': '', 'callback': '', 'isFolder': False})
    pageBlocks = pageHtml.split(gimycc_videos_strF)
    if (page > 1):
    for pageBlock in pageBlocks:
    if (gimycc_videos_strG == str_between(pageBlock, gimycc_videos_strH, gimycc_videos_strI).strip()):
    link = siteURLprefix + str_between(pageBlock, gimycc_videos_strJ, gimycc_videos_strK).strip()
    items.append({'title': '上一頁 (回第' + str(page-1) + '頁)', 'link': link, 'action': 'list_items', 'callback': 'gimycc_videos(params)', 'isFolder': True, 'page': (page-1)})
    break
    for video in videos:
    title = str_between(video, gimycc_videos_strL, gimycc_videos_strM).strip()
    if ('' != title):
    link = siteURLprefix + str_between(video, gimycc_videos_strN, gimycc_videos_strO).strip()
    image = str_between(video, gimycc_videos_strP, gimycc_videos_strQ).strip()
    note = '(' + str_between(video, gimycc_videos_strR, gimycc_videos_strS).strip() + ') ' + str_between(video, gimycc_videos_strY, gimycc_videos_strZ).strip()
    items.append({'title': title + ' -- ' + note, 'link': link, 'action': 'list_items', 'callback': 'gimycc_sources(params)', 'isFolder': True, 'image': image})
    if (int(page) < int(pages[1])):
    for pageBlock in pageBlocks:
    if (gimycc_videos_strT == str_between(pageBlock, gimycc_videos_strU, gimycc_videos_strV).strip()):
    link = siteURLprefix + str_between(pageBlock, gimycc_videos_strW, gimycc_videos_strX).strip()
    items.append({'title': '下一頁 (到第' + str(page+1) + '頁)', 'link': link, 'action': 'list_items', 'callback': 'gimycc_videos(params)', 'isFolder': True, 'page': (page+1)})
    break
    return items

    def gimycc_sources (params):
    html = get_link_contents(params['link'])
    if ('' == html):
    return []
    htmlToExplode = str_between(html, '<ul class="nav nav-tabs pull-right', '</ul>')
    videos = htmlToExplode.split('<li>')
    videos.pop(0)
    items = []
    items.append({'title': '選擇來源:', 'link': '', 'action': '', 'callback': '', 'isFolder': False})
    for video in videos:
    title = str_between(video, '">', '</a>').strip()
    playlist_id = str_between(video, 'href="#', '"').strip()
    items.append({'title': title, 'link': params['link'], 'action': 'list_items', 'callback': 'gimycc_episodes(params)', 'isFolder': True, 'playlist_id': playlist_id, 'html': str_between(html, '<div class="tab-content ', '<div class="stui-pannel-box">')})
    return items

    def gimycc_episodes (params):
    data = json.loads(base64.b64decode(params['data']), 'utf-8')
    try:
    playlist_id = data['playlist_id']
    except:
    playlist_id = 'playlist1'
    html = data['html']
    htmlToExplode = str_between(html, 'id="' + playlist_id + '"', '</ul>')
    videos = htmlToExplode.split('<li')
    videos.pop(0)
    siteURLprefix = 'https://gimy.cc'
    items = []
    for video in videos:
    title = str_between(video, '">', '<').strip()
    link = siteURLprefix + str_between(video, 'href="', '"').strip()
    link = build_url_dict({'action': 'gimycc_episode', 'link': link})
    items.append({'title': title, 'link': link, 'isFolder': False, 'IsPlayable': 'True'})
    return items

    gimycc_episode_url_code_dict = {'JT':'', 'JC':'+', 'JD':',', 'JE':'-', 'JF':'.', 'JG':'/', 'Mw':'0', 'Mx':'1', 'My':'2', 'Mz':'3', 'M0':'4', 'M1':'5', 'M2':'6', 'M3':'7', 'M4':'8', 'M5':'9', 'NB':':', 'NC':';', 'ND':'<', 'NE':'=', 'NF':'>', 'NG':'?', 'VC':'[', 'VD':'\\', 'VE':']', 'VF':'^', 'VG':'_', 'Yx':'a', 'Yy':'b', 'Yz':'c', 'Y0':'d', 'Y1':'e', 'Y2':'f', 'Y3':'g', 'Y4':'h', 'Y5':'i', 'ZB':'j', 'ZC':'k', 'ZD':'l', 'ZE':'m', 'ZF':'n', 'ZG':'o', 'cw':'p', 'cx':'q', 'cy':'r', 'cz':'s', 'c0':'t', 'c1':'u', 'c2':'v', 'c3':'w', 'c4':'x', 'c5':'y', 'dB':'z'}

    def gimycc_episode (params):
    html = get_link_contents(params['link'])
    if ('' == html):
    return []
    htmlToExplode = str_between(html, 'player_data={', '</script>')
    # https://stackoverflow.com/questions/9475241/split-string-every-nth-character
    link = ''
    line = str_between(htmlToExplode, '"url":"', '"')
    n = 2
    lineSplit = [line[i:i+n] for i in range(0, len(line), n)]
    for s in lineSplit:
    link = link + gimycc_episode_url_code_dict[s]
    playitem = xbmcgui.ListItem(path=link)
    playitem.setProperty('inputstreamaddon','inputstream.adaptive')
    playitem.setProperty('inputstream.adaptive.manifest_type','hls')
    playitem.setMimeType('application/vnd.apple.mpegurl')
    playitem.setContentLookup(False)
    xbmcplugin.setResolvedUrl(addon_handle, True, playitem)
    # -- gimy.cc --
  3. ypchen revised this gist May 30, 2020. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions hdp_ims-1.18.1.py
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@ def my_gist_hash ():
    return '3312e9f0ee2e9268d849057364c7fa9f'

    def my_version ():
    return '1.18.1-gist-r8'
    return '1.18.1-gist-r9'

    # priv: revision 50
    # priv: revision 51

    sites = [
    {
    @@ -98,6 +98,8 @@ def list_sites (params):
    xbmcplugin.endOfDirectory(addon_handle)

    # -- kubo --
    kubo_episode_str3 = 'http'

    def kubo_videos (params):
    data = json.loads(base64.b64decode(params['data']), 'utf-8')
    try:
  4. ypchen revised this gist Apr 13, 2020. 1 changed file with 86 additions and 349 deletions.
    435 changes: 86 additions & 349 deletions hdp_ims-1.18.1.py
    Original file line number Diff line number Diff line change
    @@ -2,160 +2,76 @@ def my_gist_hash ():
    return '3312e9f0ee2e9268d849057364c7fa9f'

    def my_version ():
    return '1.18.1-gist-r7'
    return '1.18.1-gist-r8'

    # priv: revision 32
    # priv: revision 50

    def maplestage_html_mixdrop_check (link):
    return ((-1) != link.find('mixdrop.co'))

    def maplestage_html_mixdrop_exec (ifcase, link):
    provider = 'mixdrop'
    xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'link={' + link + '}'), xbmc.LOGNOTICE)
    if ((-1) == link.find('http:')) and ((-1) == link.find('https:')) and ((-1) != link.find('//')):
    # E.g., link={//mixdrop.co/e/anyesayun/}
    link = 'https:' + link
    html = get_link_contents(link)
    if ('' == html):
    return []
    infoA = str_between(html, 'MDCore.ref', '}))')
    inc(ifcase, 10)
    #xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'extract: infoA={' + infoA + '}'), xbmc.LOGNOTICE)
    if ('' == infoA):
    return []
    infoA += '}))'
    infoB = str_between(infoA, '}(', '}))')
    inc(ifcase, 10)
    #xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'extract: infoB={' + infoB + '}'), xbmc.LOGNOTICE)
    if ('' == infoB):
    return []
    infoSplit = str_between(infoB, ".split('", "')")
    inc(ifcase, 10)
    #xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'extract: infoSplit={' + infoSplit + '}'), xbmc.LOGNOTICE)
    if ('' == infoSplit):
    return []
    infoToSplit = str_between(infoB, ",'", "'.split")
    inc(ifcase, 10)
    xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'extract: infoToSplit={' + infoToSplit + '}'), xbmc.LOGNOTICE)
    if ('' == infoToSplit):
    return []
    infoArray = infoToSplit.split(infoSplit)

    infoUrls = str_between(infoB, "'", "',")
    inc(ifcase, 10)
    xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'extract: infoUrls={' + infoUrls + '}'), xbmc.LOGNOTICE)
    if ('' == infoUrls):
    return []
    infoUrlArray = infoUrls.split(';')
    for url in infoUrlArray:
    inc(ifcase, 1)
    #xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'compose: url={' + url + '}'), xbmc.LOGNOTICE)
    strResult = ''
    for eachChar in url:
    charOrd = ord(eachChar)
    charIndex = -1
    if ((ord('0') <= charOrd) and (ord('9') >= charOrd)):
    charIndex = ord(eachChar) - ord('0')
    elif (ord('a') <= charOrd):
    charIndex = ord(eachChar) - ord('a') + 10
    if (((0 > charIndex) or (len(infoArray) <= charIndex)) or ('' == infoArray[charIndex])):
    strResult += eachChar
    else:
    strResult += infoArray[charIndex]
    inc(ifcase, 1)
    #xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'compose: strResult={' + strResult + '}'), xbmc.LOGNOTICE)
    if ((-1) != strResult.find('MDCore.vsr')):
    break
    # MDCore.vsrc="//s-delivery5.mxdcontent.net/v/7666d79279f47721885009b78fa267eb.mp4?s=YrV6LhmtzB-q8gIk2OHX_w&e=1575134151"
    link = 'https:' + str_between(strResult, '="', '"')
    inc(ifcase, 10)
    xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'playing: link={' + link + '}'), xbmc.LOGNOTICE)
    playitem = xbmcgui.ListItem(path=link)
    return playitem

    html_providers = [
    {
    'check': maplestage_html_mixdrop_check,
    'exec': maplestage_html_mixdrop_exec
    },
    {
    'check': maplestage_html_verystream_check,
    'exec': maplestage_html_verystream_exec
    },
    {
    'check': maplestage_html_player_check,
    'exec': maplestage_html_player_exec
    },
    {
    'check': maplestage_html_rapidvideo_check,
    'exec': maplestage_html_rapidvideo_exec
    },
    {
    'check': maplestage_html_dmembed_check,
    'exec': maplestage_html_dmembed_exec
    },
    {
    'check': maplestage_html_ddppnew_check,
    'exec': maplestage_html_ddppnew_exec
    },
    {
    'check': maplestage_html_share_Nom3u8_check,
    'exec': maplestage_html_share_Nom3u8_exec
    },
    {
    'check': maplestage_html_1drama_check,
    'exec': maplestage_html_1drama_exec
    },
    {
    'check': maplestage_html_default_check,
    'exec': maplestage_html_default_exec
    }
    ]

    # ----- ims -----
    sites = [
    {
    'title': '播酷 poku.tv [原 gimy.tv (2020-0306 之前)]',
    'action': 'list_items',
    'callback': 'poku_id()',
    'isFolder': True
    },
    {
    'title': '酷播 99KUBO',
    'action': 'list_items',
    'callback': 'kubo_id()',
    'isFolder': True
    'isFolder': True,
    'siteVisible': 'siteVisible = True'
    },
    {
    'title': '楓林網',
    'title': 'YouTube 頻道',
    'action': 'list_items',
    'callback': 'maplestage_top()',
    'isFolder': True
    'callback': 'youtube_channel_list()',
    'isFolder': True,
    'siteVisible': 'siteVisible = (0 < len(youtube_channels))'
    },
    ]

    # the default order for ims sites will be generated if no client setting exists in /tmp
    site_order = []
    def read_program (python_program):
    python_program_text = ''
    if os.path.isfile(python_program):
    with open(python_program, 'r') as f:
    python_program_text = f.read()
    return (python_program_text)

    def read_site_order ():
    python_file = 'site_order.py'
    return read_program(os.path.join(get_tempdir(), python_file))

    def read_youtube_channels ():
    python_file = 'YouTube_Channels.py'
    # 1st: try /tmp
    python_program_text = read_program(os.path.join(get_tempdir(), python_file))
    if (0 >= len(python_program_text)):
    # 2nd: try /userdata
    python_program_text = read_program(os.path.join(xbmc.translatePath('special://masterprofile'), 'addon_data/plugin.video.hdp_ims', python_file))
    return (python_program_text)

    def list_sites (params):
    global site_order
    # read the client setting
    site_order_py = os.path.join(get_tempdir(), 'site_order.py')
    if os.path.isfile(site_order_py):
    with open(site_order_py, 'r') as f:
    site_order_text = f.read()
    exec site_order_text
    name = 'list_sites()'
    site_order = []
    youtube_channels = []

    xbmc.log('[%s] %s' % (name, '0. site_order={' + ', '.join(map(str, site_order)) + '}'), xbmc.LOGNOTICE)
    xbmc.log('[%s] %s' % (name, '0. youtube_channels={' + ', '.join(map(str, youtube_channels)) + '}'), xbmc.LOGNOTICE)

    # read user-defined site order
    exec read_site_order()
    # check if site_order is valid
    if (len(site_order) != len(sites)):
    site_order = range(len(sites))
    xbmc.log('[%s] %s' % (name, '1. site_order={' + ', '.join(map(str, site_order)) + '}'), xbmc.LOGNOTICE)

    # read user-defined youtube channels
    exec read_youtube_channels()
    xbmc.log('[%s] %s' % (name, '2. youtube_channels={' + ', '.join(youtube_channels) + '}'), xbmc.LOGNOTICE)

    for site_index in site_order:
    site = sites[site_index]
    li = xbmcgui.ListItem(site['title'])
    params['action'] = site['action']
    params['callback'] = site['callback']
    params['data'] = base64.b64encode(json.dumps(site).encode('utf-8'))
    url = build_url_dict(params)
    xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=site['isFolder'])
    exec site['siteVisible']
    if (siteVisible):
    li = xbmcgui.ListItem(site['title'])
    params['action'] = site['action']
    params['callback'] = site['callback']
    params['data'] = base64.b64encode(json.dumps(site).encode('utf-8'))
    url = build_url_dict(params)
    xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=site['isFolder'])
    if params['show_hidden_sites']:
    # Separator
    xbmcplugin.addDirectoryItem(handle=addon_handle, url='', listitem=xbmcgui.ListItem('----------'), isFolder=False)
    @@ -181,232 +97,53 @@ def list_sites (params):
    xbmcplugin.addDirectoryItem(handle=addon_handle, url='', listitem=xbmcgui.ListItem('=========='), isFolder=False)
    xbmcplugin.endOfDirectory(addon_handle)

    # -- poku.tv --
    def poku_id ():
    # hard-coded top level menu items
    # link is the -id-- in the search criteria
    return [
    {
    'title': '戲劇', 'link': 'https://poku.tv/vodshow/tvseries--time---------.html', 'action': 'list_items',
    'callback': 'poku_drama_category(params)', 'isFolder': True
    },
    {
    'title': '電影', 'link': 'https://poku.tv/vodshow/movies--time---------.html', 'action': 'list_items',
    'callback': 'poku_movie_category(params)', 'isFolder': True
    },
    {
    'title': '動漫', 'link': 'https://poku.tv/vodshow/anime--time---------.html', 'action': 'list_items',
    'callback': 'poku_area(params)', 'isFolder': True
    },
    {
    'title': '綜藝', 'link': 'https://poku.tv/vodshow/tvshow--time---------.html', 'action': 'list_items',
    'callback': 'poku_area(params)', 'isFolder': True
    }
    ]

    poku_filter_URL_prefix = 'https://poku.tv'
    poku_filter_insert_all = '全部'
    poku_filter_insert_at = '2019'
    poku_filter_insert_this = '2020'
    poku_filter_insert_pre = '-'
    poku_filter_insert_post = '-'
    poku_filter_str1 = '</ul>'
    poku_filter_str2 = '<a '
    poku_filter_str3 = '>'
    poku_filter_str4 = '</a'
    poku_filter_str5 = 'href="'
    poku_filter_str6 = '"'
    def poku_filter (params, url, explodeStart, nextCallback):
    html = get_link_contents(url)
    if ('' == html):
    return []
    htmlToExplode = str_between(html, explodeStart, poku_filter_str1)
    videos = htmlToExplode.split(poku_filter_str2)
    videos.pop(0)
    siteURLprefix = poku_filter_URL_prefix
    items = []
    prevTitle = ''
    for video in videos:
    title = str_between(video, poku_filter_str3, poku_filter_str4).strip()
    # order asc
    if ((prevTitle == poku_filter_insert_at) and (title == poku_filter_insert_all)):
    items.append({'title': poku_filter_insert_this, 'link': link.replace(poku_filter_insert_pre + poku_filter_insert_at + poku_filter_insert_post, poku_filter_insert_pre + poku_filter_insert_this + poku_filter_insert_post), 'action': 'list_items', 'callback': nextCallback, 'isFolder': True})
    link = siteURLprefix + str_between(video, poku_filter_str5, poku_filter_str6).strip()
    # order desc
    if ((prevTitle == poku_filter_insert_all) and (title == poku_filter_insert_at)):
    items.append({'title': poku_filter_insert_this, 'link': link.replace(poku_filter_insert_pre + poku_filter_insert_at + poku_filter_insert_post, poku_filter_insert_pre + poku_filter_insert_this + poku_filter_insert_post), 'action': 'list_items', 'callback': nextCallback, 'isFolder': True})
    items.append({'title': title, 'link': link, 'action': 'list_items', 'callback': nextCallback, 'isFolder': True})
    prevTitle = title
    return items

    def poku_year (params):
    return poku_filter (params, params['link'], '<span class="text_muted">年份', 'poku_videos(params)')

    def poku_area (params):
    return poku_filter (params, params['link'], '<span class="text_muted">地區', 'poku_year(params)')

    def poku_drama_category (params):
    return poku_filter (params, params['link'], '<span class="text_muted">分類', 'poku_year(params)')

    def poku_movie_category (params):
    return poku_filter (params, params['link'], '<span class="text_muted">分類', 'poku_area(params)')

    poku_videos_str1 = '<ul class="page '
    poku_videos_str2 = '/div>'
    #poku_videos_str3 = '<ul>'
    #poku_videos_str4 = '</d'
    poku_videos_str5 = '<span>第'
    poku_videos_str6 = '頁</'
    poku_videos_str7 = ';共有'
    poku_videos_str8 = '頁</'
    #poku_videos_str9 = 'pagegbk" data="p-'
    #poku_videos_strA = '">尾頁</a>'
    poku_videos_strB = '-- 列表 --'
    poku_videos_strC = '-- end 列表 --'
    poku_videos_strD = '<li '
    poku_videos_strE = 'https://poku.tv'
    poku_videos_strF = '</li>'
    poku_videos_strG = '上一頁'
    poku_videos_strH = '">'
    poku_videos_strI = '</a'
    poku_videos_strJ = 'href="'
    poku_videos_strK = '"'
    poku_videos_strL = 'title="'
    poku_videos_strM = '"'
    poku_videos_strN = 'href="'
    poku_videos_strO = '"'
    poku_videos_strP = 'data-original="'
    poku_videos_strQ = '"'
    poku_videos_strR = 'pic_text text_right">'
    poku_videos_strS = '</span>'
    poku_videos_strT = '下一頁'
    poku_videos_strU = '">'
    poku_videos_strV = '</a'
    poku_videos_strW = 'href="'
    poku_videos_strX = '"'
    def poku_videos (params):
    name = 'poku_videos()'
    # -- kubo --
    def kubo_videos (params):
    data = json.loads(base64.b64decode(params['data']), 'utf-8')
    try:
    page = int(data['page'])
    except:
    page = 1
    html = get_link_contents(params['link'])
    order = str_between(params['link'], '-order-', ' ').strip()
    html = get_link_contents(params['link'].replace('.html', '-p-' + str(page) + '.html' ))
    if ('' == html):
    return []
    # pageHtml = str_between(str_between(html, poku_videos_str1, poku_videos_str2), poku_videos_str3, poku_videos_str4)
    pageHtml = str_between(html, poku_videos_str1, poku_videos_str2)
    pages = []
    pages.append(str_between(pageHtml, poku_videos_str5, poku_videos_str6))
    # pages.append(str_between(str_between(pageHtml, poku_videos_str7, poku_videos_str8), poku_videos_str9, poku_videos_strA))
    totalPageStr = str_between(pageHtml, poku_videos_str7, poku_videos_str8)
    # dirty fix, probably caused by the incompatibility between str_between ad UTF-8 chars
    totalPage = ''
    for c in totalPageStr:
    if c.isdigit():
    totalPage += c
    else:
    break
    pages.append(totalPage)
    # xbmc.log('[%s] %s' % (name, 'pages={' + pages[0] + ',' + pages[1] + '}'), xbmc.LOGNOTICE)
    if ('' == pages[1]):
    pages[1] = str(page)
    pages[0] = pages[1]
    htmlToExplode = str_between(html, poku_videos_strB, poku_videos_strC)
    videos = htmlToExplode.split(poku_videos_strD)
    pageInfo = str_between(html, '當前:', '頁')
    if ('' == pageInfo):
    pageInfo = '1/1'
    pages = pageInfo.split('/')
    htmlToExplode = str_between(html, '<div class="listlf">', '<div class="footer">')
    videos = htmlToExplode.split('<li>')
    videos.pop(0)
    siteURLprefix = poku_videos_strE
    siteURLprefix = 'http://www.99kubo.tv'
    items = []
    items.append({'title': '第 [COLOR limegreen]' + pages[0] + '[/COLOR] 頁/共 [COLOR limegreen]' + pages[1] + '[/COLOR] 頁', 'link': '', 'action': '', 'callback': '', 'isFolder': False})
    pageBlocks = pageHtml.split(poku_videos_strF)
    items.append({'title': '第 [COLOR limegreen]' + pages[0] + '[/COLOR] 頁/共 [COLOR limegreen]' + pages[1] + '[/COLOR] 頁 目前排序方式:[COLOR limegreen]' + kubo_order_description[order] + '[/COLOR] (可按此處變更)', 'link': params['link'], 'action': 'list_items', 'callback': 'kubo_order(params)', 'isFolder': True})
    if (page > 1):
    for pageBlock in pageBlocks:
    if (poku_videos_strG == str_between(pageBlock, poku_videos_strH, poku_videos_strI).strip()):
    link = siteURLprefix + str_between(pageBlock, poku_videos_strJ, poku_videos_strK).strip()
    items.append({'title': '上一頁 (回第' + str(page-1) + '頁)', 'link': link, 'action': 'list_items', 'callback': 'poku_videos(params)', 'isFolder': True, 'page': (page-1)})
    break
    items.append({'title': '上一頁 (回第' + str(page-1) + '頁)', 'link': params['link'], 'action': 'list_items', 'callback': 'kubo_videos(params)', 'isFolder': True, 'page': (page-1)})
    for video in videos:
    title = str_between(video, poku_videos_strL, poku_videos_strM).strip()
    if ('' != title):
    link = siteURLprefix + str_between(video, poku_videos_strN, poku_videos_strO).strip()
    image = str_between(video, poku_videos_strP, poku_videos_strQ).strip()
    note = str_between(video, poku_videos_strR, poku_videos_strS).strip()
    items.append({'title': title + ' -- ' + note, 'link': link, 'action': 'list_items', 'callback': 'poku_sources(params)', 'isFolder': True, 'image': image})
    if (int(page) < int(pages[1])):
    for pageBlock in pageBlocks:
    if (poku_videos_strT == str_between(pageBlock, poku_videos_strU, poku_videos_strV).strip()):
    link = siteURLprefix + str_between(pageBlock, poku_videos_strW, poku_videos_strX).strip()
    items.append({'title': '下一頁 (到第' + str(page+1) + '頁)', 'link': link, 'action': 'list_items', 'callback': 'poku_videos(params)', 'isFolder': True, 'page': (page+1)})
    break
    title = str_between(video, 'title="', '"').strip()
    link = siteURLprefix + str_between(video, 'href="', '"').strip()
    image = str_between(video, 'data-original="', '"').strip()
    updateAt = str_between(video, '<p>更新:', '</p>').strip()
    score = str_between(video, '<p>得分:', '</p>').strip()
    items.append({'title': '[COLOR goldenrod]' + score + '[/COLOR] ' + title + ' (' + updateAt + ' 更新)', 'link': link, 'action': 'list_items', 'callback': 'kubo_episodes(params)', 'isFolder': True, 'image': image})
    if ((-1) != html.find('>下一页&gt;</a>')):
    items.append({'title': '下一頁 (到第' + str(page+1) + '頁)', 'link': params['link'], 'action': 'list_items', 'callback': 'kubo_videos(params)', 'isFolder': True, 'page': (page+1)})
    return items

    poku_sources_str1 = '<div class="play_source">'
    poku_sources_str2 = '/div>'
    poku_sources_str3 = '<a href='
    poku_sources_str4 = 'alt="'
    poku_sources_str5 = '"'
    #poku_sources_str6 = 'href="#'
    #poku_sources_str7 = '"'
    poku_sources_str8 = '<div class="play_source">'
    poku_sources_str9 = '<div class="pannel '
    def poku_sources (params):
    name = 'poku_sources()'
    html = get_link_contents(params['link'])
    if ('' == html):
    return []
    htmlToExplode = str_between(html, poku_sources_str1, poku_sources_str2)
    videos = htmlToExplode.split(poku_sources_str3)
    videos.pop(0)
    # -- kubo --

    # -- youtube (work in progress) --
    def youtube_channel_list ():
    name = 'youtube_channel_list()'
    youtube_channels = []
    exec read_youtube_channels()
    xbmc.log('[%s] %s' % (name, 'youtube_channels={' + ', '.join(youtube_channels) + '}'), xbmc.LOGNOTICE)
    items = []
    items.append({'title': '選擇來源:', 'link': '', 'action': '', 'callback': '', 'isFolder': False})
    for video in videos:
    title = str_between(video, poku_sources_str4, poku_sources_str5).strip()
    # playlist_id = str_between(video, poku_sources_str6, poku_sources_str7).strip()
    playlist_id = title
    items.append({'title': title, 'link': params['link'], 'action': 'list_items', 'callback': 'poku_episodes(params)', 'isFolder': True, 'playlist_id': playlist_id, 'html': str_between(html, poku_sources_str8, poku_sources_str9)})
    for youtube_channel in youtube_channels:
    xbmc.log('[%s] %s' % (name, 'youtube_channel={' + youtube_channel + '}'), xbmc.LOGNOTICE)
    title = youtube_channel
    link = youtube_channel
    items.append({'title': title, 'link': link, 'action': 'list_items',
    'callback': 'youtube_items(params)', 'isFolder': True})
    return items

    poku_episodes_str1 = '<div class="player_infotip">'
    poku_episodes_str2 = '</ul>'
    def poku_episodes (params):
    name = 'poku_episodes()'
    data = json.loads(base64.b64decode(params['data']), 'utf-8')
    try:
    playlist_id = data['playlist_id']
    except:
    playlist_id = '順暢雲'
    html = data['html']
    htmlToExplode = html
    videoSources = htmlToExplode.split(poku_episodes_str1)
    videoSources.pop(0)
    for videoSource in videoSources:
    if ((-1) != videoSource.find(playlist_id)):
    # xbmc.log('[%s] %s' % (name, 'playlist_id={' + playlist_id + '}'), xbmc.LOGNOTICE)
    html = videoSource
    htmlToExplode = str_between(html, playlist_id, poku_episodes_str2)
    videos = htmlToExplode.split('<li>')
    videos.pop(0)
    siteURLprefix = 'https://poku.tv'
    items = []
    for video in videos:
    title = playlist_id + ': ' + str_between(video, '">', '<').strip()
    link = siteURLprefix + str_between(video, 'href="', '"').strip()
    xbmc.log('[%s] %s' % (name, 'link={' + link + '}'), xbmc.LOGNOTICE)
    link = build_url_dict({'action': 'poku_episode', 'link': link})
    items.append({'title': title, 'link': link, 'isFolder': False, 'IsPlayable': 'True'})
    return items
    return []

    def poku_episode (params):
    html = get_link_contents(params['link'])
    if ('' == html):
    return []
    htmlToExplode = str_between(html, 'player_data=', '</script>')
    link = str_between(htmlToExplode, '"url":"', '"').replace('\\/', '/')
    playitem = xbmcgui.ListItem(path=link)
    playitem.setProperty('inputstreamaddon','inputstream.adaptive')
    playitem.setProperty('inputstream.adaptive.manifest_type','hls')
    playitem.setMimeType('application/vnd.apple.mpegurl')
    playitem.setContentLookup(False)
    xbmcplugin.setResolvedUrl(addon_handle, True, playitem)
    # -- poku.tv --
    # -- youtube (work in progress) --
  5. ypchen revised this gist Mar 10, 2020. 1 changed file with 26 additions and 14 deletions.
    40 changes: 26 additions & 14 deletions hdp_ims-1.18.1.py
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@ def my_gist_hash ():
    return '3312e9f0ee2e9268d849057364c7fa9f'

    def my_version ():
    return '1.18.1-gist-r6'
    return '1.18.1-gist-r7'

    # priv: revision 24
    # priv: revision 32

    def maplestage_html_mixdrop_check (link):
    return ((-1) != link.find('mixdrop.co'))
    @@ -311,6 +311,7 @@ def poku_videos (params):
    # xbmc.log('[%s] %s' % (name, 'pages={' + pages[0] + ',' + pages[1] + '}'), xbmc.LOGNOTICE)
    if ('' == pages[1]):
    pages[1] = str(page)
    pages[0] = pages[1]
    htmlToExplode = str_between(html, poku_videos_strB, poku_videos_strC)
    videos = htmlToExplode.split(poku_videos_strD)
    videos.pop(0)
    @@ -365,25 +366,36 @@ def poku_sources (params):
    items.append({'title': title, 'link': params['link'], 'action': 'list_items', 'callback': 'poku_episodes(params)', 'isFolder': True, 'playlist_id': playlist_id, 'html': str_between(html, poku_sources_str8, poku_sources_str9)})
    return items

    poku_episodes_str1 = '<div class="player_infotip">'
    poku_episodes_str2 = '</ul>'
    def poku_episodes (params):
    name = 'poku_sources()'
    name = 'poku_episodes()'
    data = json.loads(base64.b64decode(params['data']), 'utf-8')
    try:
    playlist_id = data['playlist_id']
    except:
    playlist_id = '順暢雲'
    html = data['html']
    htmlToExplode = str_between(html, '由' + playlist_id + '提供', '</ul>')
    videos = htmlToExplode.split('<li>')
    videos.pop(0)
    siteURLprefix = 'https://poku.tv'
    items = []
    for video in videos:
    title = playlist_id + ': ' + str_between(video, '">', '<').strip()
    link = siteURLprefix + str_between(video, 'href="', '"').strip()
    link = build_url_dict({'action': 'poku_episode', 'link': link})
    items.append({'title': title, 'link': link, 'isFolder': False, 'IsPlayable': 'True'})
    return items
    htmlToExplode = html
    videoSources = htmlToExplode.split(poku_episodes_str1)
    videoSources.pop(0)
    for videoSource in videoSources:
    if ((-1) != videoSource.find(playlist_id)):
    # xbmc.log('[%s] %s' % (name, 'playlist_id={' + playlist_id + '}'), xbmc.LOGNOTICE)
    html = videoSource
    htmlToExplode = str_between(html, playlist_id, poku_episodes_str2)
    videos = htmlToExplode.split('<li>')
    videos.pop(0)
    siteURLprefix = 'https://poku.tv'
    items = []
    for video in videos:
    title = playlist_id + ': ' + str_between(video, '">', '<').strip()
    link = siteURLprefix + str_between(video, 'href="', '"').strip()
    xbmc.log('[%s] %s' % (name, 'link={' + link + '}'), xbmc.LOGNOTICE)
    link = build_url_dict({'action': 'poku_episode', 'link': link})
    items.append({'title': title, 'link': link, 'isFolder': False, 'IsPlayable': 'True'})
    return items
    return []

    def poku_episode (params):
    html = get_link_contents(params['link'])
  6. ypchen revised this gist Mar 7, 2020. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion hdp_ims-1.18.1.py
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ def my_gist_hash ():
    return '3312e9f0ee2e9268d849057364c7fa9f'

    def my_version ():
    return '1.18.1-gist-r5'
    return '1.18.1-gist-r6'

    # priv: revision 24

    @@ -138,6 +138,7 @@ def maplestage_html_mixdrop_exec (ifcase, link):
    site_order = []

    def list_sites (params):
    global site_order
    # read the client setting
    site_order_py = os.path.join(get_tempdir(), 'site_order.py')
    if os.path.isfile(site_order_py):
  7. ypchen revised this gist Mar 7, 2020. 1 changed file with 233 additions and 11 deletions.
    244 changes: 233 additions & 11 deletions hdp_ims-1.18.1.py
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@ def my_gist_hash ():
    return '3312e9f0ee2e9268d849057364c7fa9f'

    def my_version ():
    return '1.18.1-gist-r4'
    return '1.18.1-gist-r5'

    # priv: revision 9
    # priv: revision 24

    def maplestage_html_mixdrop_check (link):
    return ((-1) != link.find('mixdrop.co'))
    @@ -115,34 +115,38 @@ def maplestage_html_mixdrop_exec (ifcase, link):
    # ----- ims -----
    sites = [
    {
    'title': '楓林網',
    'title': '播酷 poku.tv [原 gimy.tv (2020-0306 之前)]',
    'action': 'list_items',
    'callback': 'maplestage_top()',
    'callback': 'poku_id()',
    'isFolder': True
    },
    {
    'title': '劇迷 gimy.tv',
    'title': '酷播 99KUBO',
    'action': 'list_items',
    'callback': 'gimy_id()',
    'callback': 'kubo_id()',
    'isFolder': True
    },
    {
    'title': '酷播 99KUBO',
    'title': '楓林網',
    'action': 'list_items',
    'callback': 'kubo_id()',
    'callback': 'maplestage_top()',
    'isFolder': True
    }
    },
    ]

    # the default order for ims sites
    site_order = [ 0, 1, 2 ]
    # the default order for ims sites will be generated if no client setting exists in /tmp
    site_order = []

    def list_sites (params):
    # read the client setting
    site_order_py = os.path.join(get_tempdir(), 'site_order.py')
    if os.path.isfile(site_order_py):
    with open(site_order_py, 'r') as f:
    site_order_text = f.read()
    exec site_order_text
    # check if site_order is valid
    if (len(site_order) != len(sites)):
    site_order = range(len(sites))
    for site_index in site_order:
    site = sites[site_index]
    li = xbmcgui.ListItem(site['title'])
    @@ -175,3 +179,221 @@ def list_sites (params):
    # Separator
    xbmcplugin.addDirectoryItem(handle=addon_handle, url='', listitem=xbmcgui.ListItem('=========='), isFolder=False)
    xbmcplugin.endOfDirectory(addon_handle)

    # -- poku.tv --
    def poku_id ():
    # hard-coded top level menu items
    # link is the -id-- in the search criteria
    return [
    {
    'title': '戲劇', 'link': 'https://poku.tv/vodshow/tvseries--time---------.html', 'action': 'list_items',
    'callback': 'poku_drama_category(params)', 'isFolder': True
    },
    {
    'title': '電影', 'link': 'https://poku.tv/vodshow/movies--time---------.html', 'action': 'list_items',
    'callback': 'poku_movie_category(params)', 'isFolder': True
    },
    {
    'title': '動漫', 'link': 'https://poku.tv/vodshow/anime--time---------.html', 'action': 'list_items',
    'callback': 'poku_area(params)', 'isFolder': True
    },
    {
    'title': '綜藝', 'link': 'https://poku.tv/vodshow/tvshow--time---------.html', 'action': 'list_items',
    'callback': 'poku_area(params)', 'isFolder': True
    }
    ]

    poku_filter_URL_prefix = 'https://poku.tv'
    poku_filter_insert_all = '全部'
    poku_filter_insert_at = '2019'
    poku_filter_insert_this = '2020'
    poku_filter_insert_pre = '-'
    poku_filter_insert_post = '-'
    poku_filter_str1 = '</ul>'
    poku_filter_str2 = '<a '
    poku_filter_str3 = '>'
    poku_filter_str4 = '</a'
    poku_filter_str5 = 'href="'
    poku_filter_str6 = '"'
    def poku_filter (params, url, explodeStart, nextCallback):
    html = get_link_contents(url)
    if ('' == html):
    return []
    htmlToExplode = str_between(html, explodeStart, poku_filter_str1)
    videos = htmlToExplode.split(poku_filter_str2)
    videos.pop(0)
    siteURLprefix = poku_filter_URL_prefix
    items = []
    prevTitle = ''
    for video in videos:
    title = str_between(video, poku_filter_str3, poku_filter_str4).strip()
    # order asc
    if ((prevTitle == poku_filter_insert_at) and (title == poku_filter_insert_all)):
    items.append({'title': poku_filter_insert_this, 'link': link.replace(poku_filter_insert_pre + poku_filter_insert_at + poku_filter_insert_post, poku_filter_insert_pre + poku_filter_insert_this + poku_filter_insert_post), 'action': 'list_items', 'callback': nextCallback, 'isFolder': True})
    link = siteURLprefix + str_between(video, poku_filter_str5, poku_filter_str6).strip()
    # order desc
    if ((prevTitle == poku_filter_insert_all) and (title == poku_filter_insert_at)):
    items.append({'title': poku_filter_insert_this, 'link': link.replace(poku_filter_insert_pre + poku_filter_insert_at + poku_filter_insert_post, poku_filter_insert_pre + poku_filter_insert_this + poku_filter_insert_post), 'action': 'list_items', 'callback': nextCallback, 'isFolder': True})
    items.append({'title': title, 'link': link, 'action': 'list_items', 'callback': nextCallback, 'isFolder': True})
    prevTitle = title
    return items

    def poku_year (params):
    return poku_filter (params, params['link'], '<span class="text_muted">年份', 'poku_videos(params)')

    def poku_area (params):
    return poku_filter (params, params['link'], '<span class="text_muted">地區', 'poku_year(params)')

    def poku_drama_category (params):
    return poku_filter (params, params['link'], '<span class="text_muted">分類', 'poku_year(params)')

    def poku_movie_category (params):
    return poku_filter (params, params['link'], '<span class="text_muted">分類', 'poku_area(params)')

    poku_videos_str1 = '<ul class="page '
    poku_videos_str2 = '/div>'
    #poku_videos_str3 = '<ul>'
    #poku_videos_str4 = '</d'
    poku_videos_str5 = '<span>第'
    poku_videos_str6 = '頁</'
    poku_videos_str7 = ';共有'
    poku_videos_str8 = '頁</'
    #poku_videos_str9 = 'pagegbk" data="p-'
    #poku_videos_strA = '">尾頁</a>'
    poku_videos_strB = '-- 列表 --'
    poku_videos_strC = '-- end 列表 --'
    poku_videos_strD = '<li '
    poku_videos_strE = 'https://poku.tv'
    poku_videos_strF = '</li>'
    poku_videos_strG = '上一頁'
    poku_videos_strH = '">'
    poku_videos_strI = '</a'
    poku_videos_strJ = 'href="'
    poku_videos_strK = '"'
    poku_videos_strL = 'title="'
    poku_videos_strM = '"'
    poku_videos_strN = 'href="'
    poku_videos_strO = '"'
    poku_videos_strP = 'data-original="'
    poku_videos_strQ = '"'
    poku_videos_strR = 'pic_text text_right">'
    poku_videos_strS = '</span>'
    poku_videos_strT = '下一頁'
    poku_videos_strU = '">'
    poku_videos_strV = '</a'
    poku_videos_strW = 'href="'
    poku_videos_strX = '"'
    def poku_videos (params):
    name = 'poku_videos()'
    data = json.loads(base64.b64decode(params['data']), 'utf-8')
    try:
    page = int(data['page'])
    except:
    page = 1
    html = get_link_contents(params['link'])
    if ('' == html):
    return []
    # pageHtml = str_between(str_between(html, poku_videos_str1, poku_videos_str2), poku_videos_str3, poku_videos_str4)
    pageHtml = str_between(html, poku_videos_str1, poku_videos_str2)
    pages = []
    pages.append(str_between(pageHtml, poku_videos_str5, poku_videos_str6))
    # pages.append(str_between(str_between(pageHtml, poku_videos_str7, poku_videos_str8), poku_videos_str9, poku_videos_strA))
    totalPageStr = str_between(pageHtml, poku_videos_str7, poku_videos_str8)
    # dirty fix, probably caused by the incompatibility between str_between ad UTF-8 chars
    totalPage = ''
    for c in totalPageStr:
    if c.isdigit():
    totalPage += c
    else:
    break
    pages.append(totalPage)
    # xbmc.log('[%s] %s' % (name, 'pages={' + pages[0] + ',' + pages[1] + '}'), xbmc.LOGNOTICE)
    if ('' == pages[1]):
    pages[1] = str(page)
    htmlToExplode = str_between(html, poku_videos_strB, poku_videos_strC)
    videos = htmlToExplode.split(poku_videos_strD)
    videos.pop(0)
    siteURLprefix = poku_videos_strE
    items = []
    items.append({'title': '第 [COLOR limegreen]' + pages[0] + '[/COLOR] 頁/共 [COLOR limegreen]' + pages[1] + '[/COLOR] 頁', 'link': '', 'action': '', 'callback': '', 'isFolder': False})
    pageBlocks = pageHtml.split(poku_videos_strF)
    if (page > 1):
    for pageBlock in pageBlocks:
    if (poku_videos_strG == str_between(pageBlock, poku_videos_strH, poku_videos_strI).strip()):
    link = siteURLprefix + str_between(pageBlock, poku_videos_strJ, poku_videos_strK).strip()
    items.append({'title': '上一頁 (回第' + str(page-1) + '頁)', 'link': link, 'action': 'list_items', 'callback': 'poku_videos(params)', 'isFolder': True, 'page': (page-1)})
    break
    for video in videos:
    title = str_between(video, poku_videos_strL, poku_videos_strM).strip()
    if ('' != title):
    link = siteURLprefix + str_between(video, poku_videos_strN, poku_videos_strO).strip()
    image = str_between(video, poku_videos_strP, poku_videos_strQ).strip()
    note = str_between(video, poku_videos_strR, poku_videos_strS).strip()
    items.append({'title': title + ' -- ' + note, 'link': link, 'action': 'list_items', 'callback': 'poku_sources(params)', 'isFolder': True, 'image': image})
    if (int(page) < int(pages[1])):
    for pageBlock in pageBlocks:
    if (poku_videos_strT == str_between(pageBlock, poku_videos_strU, poku_videos_strV).strip()):
    link = siteURLprefix + str_between(pageBlock, poku_videos_strW, poku_videos_strX).strip()
    items.append({'title': '下一頁 (到第' + str(page+1) + '頁)', 'link': link, 'action': 'list_items', 'callback': 'poku_videos(params)', 'isFolder': True, 'page': (page+1)})
    break
    return items

    poku_sources_str1 = '<div class="play_source">'
    poku_sources_str2 = '/div>'
    poku_sources_str3 = '<a href='
    poku_sources_str4 = 'alt="'
    poku_sources_str5 = '"'
    #poku_sources_str6 = 'href="#'
    #poku_sources_str7 = '"'
    poku_sources_str8 = '<div class="play_source">'
    poku_sources_str9 = '<div class="pannel '
    def poku_sources (params):
    name = 'poku_sources()'
    html = get_link_contents(params['link'])
    if ('' == html):
    return []
    htmlToExplode = str_between(html, poku_sources_str1, poku_sources_str2)
    videos = htmlToExplode.split(poku_sources_str3)
    videos.pop(0)
    items = []
    items.append({'title': '選擇來源:', 'link': '', 'action': '', 'callback': '', 'isFolder': False})
    for video in videos:
    title = str_between(video, poku_sources_str4, poku_sources_str5).strip()
    # playlist_id = str_between(video, poku_sources_str6, poku_sources_str7).strip()
    playlist_id = title
    items.append({'title': title, 'link': params['link'], 'action': 'list_items', 'callback': 'poku_episodes(params)', 'isFolder': True, 'playlist_id': playlist_id, 'html': str_between(html, poku_sources_str8, poku_sources_str9)})
    return items

    def poku_episodes (params):
    name = 'poku_sources()'
    data = json.loads(base64.b64decode(params['data']), 'utf-8')
    try:
    playlist_id = data['playlist_id']
    except:
    playlist_id = '順暢雲'
    html = data['html']
    htmlToExplode = str_between(html, '由' + playlist_id + '提供', '</ul>')
    videos = htmlToExplode.split('<li>')
    videos.pop(0)
    siteURLprefix = 'https://poku.tv'
    items = []
    for video in videos:
    title = playlist_id + ': ' + str_between(video, '">', '<').strip()
    link = siteURLprefix + str_between(video, 'href="', '"').strip()
    link = build_url_dict({'action': 'poku_episode', 'link': link})
    items.append({'title': title, 'link': link, 'isFolder': False, 'IsPlayable': 'True'})
    return items

    def poku_episode (params):
    html = get_link_contents(params['link'])
    if ('' == html):
    return []
    htmlToExplode = str_between(html, 'player_data=', '</script>')
    link = str_between(htmlToExplode, '"url":"', '"').replace('\\/', '/')
    playitem = xbmcgui.ListItem(path=link)
    playitem.setProperty('inputstreamaddon','inputstream.adaptive')
    playitem.setProperty('inputstream.adaptive.manifest_type','hls')
    playitem.setMimeType('application/vnd.apple.mpegurl')
    playitem.setContentLookup(False)
    xbmcplugin.setResolvedUrl(addon_handle, True, playitem)
    # -- poku.tv --
  8. ypchen revised this gist Dec 15, 2019. 1 changed file with 67 additions and 3 deletions.
    70 changes: 67 additions & 3 deletions hdp_ims-1.18.1.py
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@ def my_gist_hash ():
    return '3312e9f0ee2e9268d849057364c7fa9f'

    def my_version ():
    return '1.18.1-gist-r3'
    return '1.18.1-gist-r4'

    # priv: revision 8
    # priv: revision 9

    def maplestage_html_mixdrop_check (link):
    return ((-1) != link.find('mixdrop.co'))
    @@ -64,7 +64,7 @@ def maplestage_html_mixdrop_exec (ifcase, link):
    strResult += infoArray[charIndex]
    inc(ifcase, 1)
    #xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'compose: strResult={' + strResult + '}'), xbmc.LOGNOTICE)
    if ((-1) != strResult.find('MDCore.vsrc')):
    if ((-1) != strResult.find('MDCore.vsr')):
    break
    # MDCore.vsrc="//s-delivery5.mxdcontent.net/v/7666d79279f47721885009b78fa267eb.mp4?s=YrV6LhmtzB-q8gIk2OHX_w&e=1575134151"
    link = 'https:' + str_between(strResult, '="', '"')
    @@ -111,3 +111,67 @@ def maplestage_html_mixdrop_exec (ifcase, link):
    'exec': maplestage_html_default_exec
    }
    ]

    # ----- ims -----
    sites = [
    {
    'title': '楓林網',
    'action': 'list_items',
    'callback': 'maplestage_top()',
    'isFolder': True
    },
    {
    'title': '劇迷 gimy.tv',
    'action': 'list_items',
    'callback': 'gimy_id()',
    'isFolder': True
    },
    {
    'title': '酷播 99KUBO',
    'action': 'list_items',
    'callback': 'kubo_id()',
    'isFolder': True
    }
    ]

    # the default order for ims sites
    site_order = [ 0, 1, 2 ]

    def list_sites (params):
    site_order_py = os.path.join(get_tempdir(), 'site_order.py')
    if os.path.isfile(site_order_py):
    with open(site_order_py, 'r') as f:
    site_order_text = f.read()
    exec site_order_text
    for site_index in site_order:
    site = sites[site_index]
    li = xbmcgui.ListItem(site['title'])
    params['action'] = site['action']
    params['callback'] = site['callback']
    params['data'] = base64.b64encode(json.dumps(site).encode('utf-8'))
    url = build_url_dict(params)
    xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=site['isFolder'])
    if params['show_hidden_sites']:
    # Separator
    xbmcplugin.addDirectoryItem(handle=addon_handle, url='', listitem=xbmcgui.ListItem('----------'), isFolder=False)
    for site in hidden_sites:
    li = xbmcgui.ListItem(site['title'])
    params['action'] = site['action']
    params['callback'] = site['callback']
    params['data'] = base64.b64encode(json.dumps(site).encode('utf-8'))
    url = build_url_dict(params)
    xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=site['isFolder'])
    # Separator
    xbmcplugin.addDirectoryItem(handle=addon_handle, url='', listitem=xbmcgui.ListItem('=========='), isFolder=False)
    # Version
    if ((not params['show_hidden_sites']) and ('1' == addon.getSetting('hs_show'))):
    params['action'] = 'input_password_to_show_hidden_sites'
    url = build_url_dict(params)
    isFolder = True
    else:
    url = ''
    isFolder = False
    xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=xbmcgui.ListItem('[版本資訊] hdp_ims: ' + my_version()), isFolder=isFolder)
    # Separator
    xbmcplugin.addDirectoryItem(handle=addon_handle, url='', listitem=xbmcgui.ListItem('=========='), isFolder=False)
    xbmcplugin.endOfDirectory(addon_handle)
  9. ypchen revised this gist Nov 30, 2019. 1 changed file with 108 additions and 2 deletions.
    110 changes: 108 additions & 2 deletions hdp_ims-1.18.1.py
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,112 @@ def my_gist_hash ():
    return '3312e9f0ee2e9268d849057364c7fa9f'

    def my_version ():
    return '1.18.1-gist-r2'
    return '1.18.1-gist-r3'

    # priv: revision 2
    # priv: revision 8

    def maplestage_html_mixdrop_check (link):
    return ((-1) != link.find('mixdrop.co'))

    def maplestage_html_mixdrop_exec (ifcase, link):
    provider = 'mixdrop'
    xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'link={' + link + '}'), xbmc.LOGNOTICE)
    if ((-1) == link.find('http:')) and ((-1) == link.find('https:')) and ((-1) != link.find('//')):
    # E.g., link={//mixdrop.co/e/anyesayun/}
    link = 'https:' + link
    html = get_link_contents(link)
    if ('' == html):
    return []
    infoA = str_between(html, 'MDCore.ref', '}))')
    inc(ifcase, 10)
    #xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'extract: infoA={' + infoA + '}'), xbmc.LOGNOTICE)
    if ('' == infoA):
    return []
    infoA += '}))'
    infoB = str_between(infoA, '}(', '}))')
    inc(ifcase, 10)
    #xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'extract: infoB={' + infoB + '}'), xbmc.LOGNOTICE)
    if ('' == infoB):
    return []
    infoSplit = str_between(infoB, ".split('", "')")
    inc(ifcase, 10)
    #xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'extract: infoSplit={' + infoSplit + '}'), xbmc.LOGNOTICE)
    if ('' == infoSplit):
    return []
    infoToSplit = str_between(infoB, ",'", "'.split")
    inc(ifcase, 10)
    xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'extract: infoToSplit={' + infoToSplit + '}'), xbmc.LOGNOTICE)
    if ('' == infoToSplit):
    return []
    infoArray = infoToSplit.split(infoSplit)

    infoUrls = str_between(infoB, "'", "',")
    inc(ifcase, 10)
    xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'extract: infoUrls={' + infoUrls + '}'), xbmc.LOGNOTICE)
    if ('' == infoUrls):
    return []
    infoUrlArray = infoUrls.split(';')
    for url in infoUrlArray:
    inc(ifcase, 1)
    #xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'compose: url={' + url + '}'), xbmc.LOGNOTICE)
    strResult = ''
    for eachChar in url:
    charOrd = ord(eachChar)
    charIndex = -1
    if ((ord('0') <= charOrd) and (ord('9') >= charOrd)):
    charIndex = ord(eachChar) - ord('0')
    elif (ord('a') <= charOrd):
    charIndex = ord(eachChar) - ord('a') + 10
    if (((0 > charIndex) or (len(infoArray) <= charIndex)) or ('' == infoArray[charIndex])):
    strResult += eachChar
    else:
    strResult += infoArray[charIndex]
    inc(ifcase, 1)
    #xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'compose: strResult={' + strResult + '}'), xbmc.LOGNOTICE)
    if ((-1) != strResult.find('MDCore.vsrc')):
    break
    # MDCore.vsrc="//s-delivery5.mxdcontent.net/v/7666d79279f47721885009b78fa267eb.mp4?s=YrV6LhmtzB-q8gIk2OHX_w&e=1575134151"
    link = 'https:' + str_between(strResult, '="', '"')
    inc(ifcase, 10)
    xbmc.log('[%s, %d, %s] %s' % ('hdp_ims', ifcase[0], provider, 'playing: link={' + link + '}'), xbmc.LOGNOTICE)
    playitem = xbmcgui.ListItem(path=link)
    return playitem

    html_providers = [
    {
    'check': maplestage_html_mixdrop_check,
    'exec': maplestage_html_mixdrop_exec
    },
    {
    'check': maplestage_html_verystream_check,
    'exec': maplestage_html_verystream_exec
    },
    {
    'check': maplestage_html_player_check,
    'exec': maplestage_html_player_exec
    },
    {
    'check': maplestage_html_rapidvideo_check,
    'exec': maplestage_html_rapidvideo_exec
    },
    {
    'check': maplestage_html_dmembed_check,
    'exec': maplestage_html_dmembed_exec
    },
    {
    'check': maplestage_html_ddppnew_check,
    'exec': maplestage_html_ddppnew_exec
    },
    {
    'check': maplestage_html_share_Nom3u8_check,
    'exec': maplestage_html_share_Nom3u8_exec
    },
    {
    'check': maplestage_html_1drama_check,
    'exec': maplestage_html_1drama_exec
    },
    {
    'check': maplestage_html_default_check,
    'exec': maplestage_html_default_exec
    }
    ]
  10. ypchen revised this gist Sep 22, 2019. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions hdp_ims-1.18.1.py
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    def my_gist_hash ():
    return ''
    return '3312e9f0ee2e9268d849057364c7fa9f'

    def my_version ():
    return '1.18.1-gist-r1'
    return '1.18.1-gist-r2'

    # priv: revision 2
  11. ypchen created this gist Sep 22, 2019.
    5 changes: 5 additions & 0 deletions hdp_ims-1.18.1.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    def my_gist_hash ():
    return ''

    def my_version ():
    return '1.18.1-gist-r1'