Пример #1
0
def new_viditem(v={}, as_dict=False):
    pathdl = plugin.url_for(endpoint=download, vurl=v.get('contentUrl', v.get('hostPageUrl', '')))
    ctxlist = []
    citem = ('Download', 'RunPlugin({0})'.format(pathdl),)
    ctxlist.append(citem)
    pathdel = plugin.url_for(endpoint=fav_del, idvid=v.get('videoId', ''))
    citem = ('DELETE', 'RunPlugin({0})'.format(pathdel),)
    ctxlist.append(citem)
    img = v.get('thumbnail', v.get('thumbnailUrl', 'DefaultVideo.png'))
    lbl = v.get('label', v.get('name', ''))
    lbl2 = v.get('label2', v.get('videoId', ''))
    vidpath = v.get('path', None)
    if vidpath is None:
        vidpath = plugin.url_for(endpoint=play, vtitle=v.get('name', lbl), vurl=v.get('contentUrl', v.get('hostPageUrl', lbl2)))
    xitem = None
    if not as_dict:
        xitem = ListItem(label=lbl, label2=lbl2, icon=img, thumbnail=img, path=vidpath)
        xitem.add_context_menu_items(items=ctxlist, replace_items=False)
        xitem.playable = True
        xitem.is_folder = False
        xitem.set_info(info_type='video', info_labels={'Title': lbl, 'Plot': lbl2, 'Premiered': v.get('datePublished', '')})
        xitem.thumbnail = img
        xitem.icon = img
        idvid = v.get('videoId', 0)
        if idvid is not 0:
            xitem.set_property(key='videoId', value=idvid)
            xitem.set_info(info_type='video', info_labels={'VideoID': idvid})
    else:
        xitem = {'label': lbl, 'label2': lbl2, 'icon': img, 'thumbnail': img, 'is_playable': True, 'path': vidpath}
    return xitem
Пример #2
0
def makeitem(name=None, img=None, path='blogposts', playable=False, **kwargs):
    #if doDebug():
    xitem = None
    try:
        if not path.startswith('plugin://'):
            itempath = plugin.url_for(endpoint=path, items=kwargs)
        else:
            itempath = path
        lbl2 = kwargs.get("label2",
                          itempath.partition('plugin.video.tumblrv/')[-1])
        if img is None:
            img = "https://api.tumblr.com/v2/blog/{0}/avatar/64".format(name)
        xitem = ListItem(label=name,
                         label2=lbl2,
                         icon=img,
                         thumbnail=img,
                         path=itempath)
        xitem.playable = playable
        xitem.poster = img
        #litem = {'label': name, 'thumbnail': img, 'icon': img, 'is_playable': playable, 'path': itempath)}
        if path == 'blogposts':
            img = "https://api.tumblr.com/v2/blog/{0}/avatar/64".format(name)
        elif plugin.request.path.find(
                'following/') != -1 or plugin.request.path.find(
                    'liked/') != -1 or plugin.request.path.find(
                        'dashboard/') != -1:
            blogname = kwargs.get('blogname', name)
            ctxaction = "RunPlugin({0})".format(
                plugin.url_for(endpoint=blogposts, blogname=blogname))
            cname = "[COLOR green]GOTO:[/COLOR] {0}".format(blogname)
            citem = (
                cname,
                ctxaction,
            )
            ctxlist.append(citem)
            vidurl = kwargs.get("vidurl", None)
            if vidurl is not None:
                pathdl = plugin.url_for(endpoint=download, urlvideo=vidurl)
                citem = (
                    'Download',
                    'RunPlugin({0})'.format(pathdl),
                )
                ctxlist.append(citem)
            vidid = kwargs.get('id', None)
            if vidid is not None:
                pathaddlike = plugin.url_for(endpoint=addlike, id=vidid)
                citem = (
                    'Like',
                    'RunPlugin({0})'.format(pathaddlike),
                )
                ctxlist.append(citem)
        xitem.add_context_menu_items(items=ctxlist, replace_items=False)
    except Exception as ex:
        outmsg = "Error: {0}\n{1}\n{2}\n".format(str(ex), str(ex.message),
                                                 str(ex.args))
        plugin.notify(msg=outmsg, delay=10000)
        print outmsg
    return xitem
Пример #3
0
def dashboard_old(listlikes, alltags, litems):
    for item in listlikes:
        if item.get('type', '') == 'video':
            b = item
            img = item.get("thumbnail_url", __imgtumblr__)
            img2 = item.get("image_permalink", __imgtumblr__)
            alltags.extend(item.get('tags', []))
            try:
                if len(b.get('slug', '')) > 0:
                    lbl = b.get('slug', '')
                elif len(b.get('title', '')) > 0:
                    lbl = b.get('title', '')
                elif len(b.get('caption', '')) > 0:
                    lbl = Strip(b.get('caption', ''))
                elif len(b.get('summary', '')) > 0:
                    lbl = b.get('summary', '')
                elif len(b.get('source_title', '')) > 0:
                    lbl = b.get('source_title', '')
                else:
                    lbl = b.get('short_url', '')
                if len(item.get('summary', '')) > 0:
                    lbl2 = item.get('summary', '')
                else:
                    lbl2 = item.get('blog_name', '') + " / " + item.get('source_title', '') + "(" + item.get(
                        'slug_name', '') + ")"
            except:
                lbl = b.get('blog_name', '')
                lbl2 = b.get('short_url', '')
            vidurl = item.get('video_url', '')
            img = item.get('thumbnail_url',
                           item.get('image_permalink', item.get('image_permalink', __imgtumblr__))).replace('https:',
                                                                                                            'http:')
            img2 = item.get('image_permalink',
                            item.get('thumbnail_url', item.get('thumbnail_url', __imgtumblr__))).replace('https:',
                                                                                                         'http:')
            if vidurl is not None and len(vidurl) > 10:
                if len(b.get('caption', '')) > 0:
                    lbl = Strip(b.get('caption', ''))
                litem = ListItem(label=lbl, label2=lbl2, icon=img2, thumbnail=img, path=vidurl)
                litem.playable = True
                litem.is_folder = False
                if item.get('date', '') is not None:
                    rdate = str(item.get('date', '')).split(' ', 1)[0].strip()
                litem.set_info(info_type='video', info_labels={'Date': rdate})
                litem.set_art({'poster': img2, 'thumbnail': img, 'fanart': img2})
                pathdl = plugin.url_for(endpoint=download, urlvideo=vidurl)
                pathaddlike = plugin.url_for(endpoint=addlike, id=item.get('id', ''))
                litem.add_context_menu_items(
                    [('Download', 'RunPlugin({0})'.format(pathdl)), ('Like', 'RunPlugin({0})'.format(pathaddlike)),
                     ('Show Image', 'ShowPicture({0})'.format(img)), ])
                litems.append(litem)
    item = listlikes[-1]
    plugin.set_setting('lastid', str(item.get('id', lastid)))
    savetags(alltags)
    # litems.append(nextitem)
    return litems
Пример #4
0
    def test_context_menu(self):
        menu_items = [('label1', 'foo'), ('label2', 'bar')]
        item = ListItem()
        item.add_context_menu_items(menu_items)
        self.assertEqual(item.get_context_menu_items(), menu_items)

        extra_menu_item = ('label3', 'baz')
        menu_items.append(extra_menu_item)
        item.add_context_menu_items([extra_menu_item])
        self.assertEqual(item.get_context_menu_items(), menu_items)
Пример #5
0
    def test_context_menu(self):
        menu_items = [('label1', 'foo'), ('label2', 'bar')]
        item = ListItem()
        item.add_context_menu_items(menu_items)
        self.assertEqual(item.get_context_menu_items(), menu_items)

        extra_menu_item = ('label3', 'baz')
        menu_items.append(extra_menu_item)
        item.add_context_menu_items([extra_menu_item])
        self.assertEqual(item.get_context_menu_items(), menu_items)
Пример #6
0
def dashboard_items(results=[]):
    alltags = []
    litems = []
    for item in results:
        if item.get('type', '') == 'video':
            b = {}
            b.update(item)
            lbl = ""
            lbl2 = ""
            img = item.get('thumbnail_url',
                           item.get('image_permalink', __imgtumblr__))
            alltags.extend(item.get('tags', []))
            try:
                if len(b.get('slug', '')) > 0:
                    lbl = b.get('slug', '')
                elif len(b.get('title', '')) > 0:
                    lbl = b.get('title', '')
                elif len(b.get('caption', '')) > 0:
                    lbl = Strip(b.get('caption', ''))
                elif len(b.get('summary', '')) > 0:
                    lbl = b.get('summary', '')
                elif len(b.get('source_title', '')) > 0:
                    lbl = b.get('source_title', '')
                else:
                    lbl = b.get('short_url', '')
                if len(item.get('summary', '')) > 0:
                    lbl2 = item.get('summary', '')
                else:
                    lbl2 = item.get('blog_name', "") + " / " + item.get(
                        'source_title', '') + "(" + item.get('slug_name',
                                                             '') + ")"
            except:
                lbl = b.get(b.keys()[0], "")
                lbl2 = b.get(b.keys()[-1], "")
            vidurl = item.get('video_url', "")
            if vidurl is not None and len(vidurl) > 10:
                litem = ListItem(label=lbl,
                                 label2=lbl2,
                                 icon=img,
                                 thumbnail=img,
                                 path=vidurl)
                litem.playable = True
                litem.is_folder = False
                if item.get('date', '') is not None:
                    rdate = str(item.get('date', '')).split(' ', 1)[0].strip()
                litem.set_info(info_type='video', info_labels={'Date': rdate})
                litem.set_art({'poster': img, 'thumbnail': img, 'fanart': img})
                pathdl = plugin.url_for(endpoint=download, urlvideo=vidurl)
                litem.add_context_menu_items([
                    ('Download', 'RunPlugin({0})'.format(pathdl)),
                ])
                litems.append(litem)
    return litems, alltags
Пример #7
0
    def test_context_menu(self):
        menu_items = [('label1', 'foo'), ('label2', 'bar')]
        item = ListItem()
        item.add_context_menu_items(menu_items)
        self.assertEqual(item.get_context_menu_items(), menu_items)

        extra_menu_item = ('label3', 'baz')
        menu_items.append(extra_menu_item)
        item.add_context_menu_items([extra_menu_item])
        self.assertEqual(item.get_context_menu_items(), menu_items)

        # Verify replace_items branch gets executed and works.
        item.add_context_menu_items([extra_menu_item], True)
        self.assertEqual(item.get_context_menu_items(), [extra_menu_item])
Пример #8
0
def search():
    # plugin.log.debug(TUMBLRAUTH)
    # client = TumblrRestClient(**TUMBLRAUTH)
    # info = client.info()
    litems = []
    searchtxt = ''
    searchquery = ''
    offsetnum = 0
    searchtxt = plugin.get_setting('lastsearch')
    searchtxt = plugin.keyboard(searchtxt, 'Search All Sites', False)
    searchquery = searchtxt.replace(' ', '+')
    plugin.set_setting(key='lastsearch', val=searchtxt)
    results = following_list(offset=offsetnum)
    listmatch = []
    max = 20
    # if len(results) < 20:
    #    max = len(results) - 1
    for blog in results:
        name = blog.get('name', '')
        posts = tclient.posts(name, type='video')
        for post in posts.get('posts', []):
            for k, v in post.items():
                try:
                    if searchquery.lower() in str(v.encode('latin-1', 'ignore')).lower():
                        listmatch.append(post)
                        break
                except:
                    pass
    plugin.notify(msg="Matches: {0}".format(str(len(listmatch))))
    alltags = []
    for post in listmatch:
        lbl2 = post.get('blog_name', '')
        lbl = post.get('slug', '').replace('-', ' ')
        img = post.get('thumbnail_url', post.get('image_permalink', __imgtumblr__))
        img2 = post.get('image_permalink', post.get('thumbnail_url', __imgtumblr__))
        alltags.extend(post.get('tags', []))
        try:
            if post.get('slug', '') is not None:
                lbl = post.get('slug', '').replace('-', ' ')
            if len(post.get('caption', '')) > 0:
                lbl = Strip(post.get('caption', ''))
            elif len(post.get('summary', '')) > 0:
                lbl = post.get('summary', '')
            elif len(post.get('source_title', '')) > 0:
                lbl = post.get('source_title', '')
            else:
                lbl = post.get('short_url', '')
            if post.get('video_url', '') is not None:
                vidurl = post.get('video_url', '')
        except:
            plugin.notify(str(repr(post)))
        litem = ListItem(label=lbl, label2=lbl2, icon=img2, thumbnail=img, path=vidurl)
        litem.playable = True
        litem.is_folder = False
        if len(post.get('date', '')) > 0:
            rdate = str(post.get('date', '')).split(' ', 1)[0].strip()
        litem.set_info(info_type='video', info_labels={'Date': rdate, 'Duration': post.get('duration', '')})
        litem.set_art({'poster': img2, 'thumbnail': img, 'fanart': img2})
        pathdl = plugin.url_for(endpoint=download, urlvideo=vidurl)
        pathaddlike = plugin.url_for(endpoint=addlike, id=post.get('id', ''))
        litem.add_context_menu_items(
            [('Download', 'RunPlugin({0})'.format(pathdl)), ('Like', 'RunPlugin({0})'.format(pathaddlike)), ])
        litems.append(litem)
    savetags(alltags)
    return litems
Пример #9
0
def blogposts(blogname, offset=0):
    listposts = []
    lbl = ''
    lbl2 = ''
    vidurl = ''
    results = []
    alltags = []
    litems = []
    if blogname.find('.') != -1:
        shortname = blogname.split('.', 1)[-1]
        if shortname.find('.') != -1:
            blogname = shortname.lsplit('.')[0]
    strpage = str((20 + int(offset)) / 20)
    nextitem = ListItem(label="Next Page -> #{0}".format(strpage), label2=blogname, icon=__imgnext__,
                        thumbnail=__imgnext__,
                        path=plugin.url_for(blogposts, blogname=blogname, offset=int(20 + int(offset))))
    nextitem.set_art({'poster': __imgnext__, 'thumbnail': __imgnext__, 'fanart': __imgnext__})
    nextitem.is_folder = True
    # litems = [nextitem]
    results = tclient.posts(blogname=blogname, limit=20, offset=int(offset), type='video')
    if results is not None:
        if len(results.get('posts', '')) > 1:
            results = results.get('posts', '')
        for post in results:
            lbl2 = post.get('blog_name', '')
            lbl = post.get('slug', '').replace('-', ' ')
            img = post.get('thumbnail_url', post.get('image_permalink', __imgtumblr__))
            img2 = post.get('image_permalink', post.get('thumbnail_url', __imgtumblr__))
            alltags.extend(post.get('tags', []))
            try:
                if post.get('slug', '') is not None:
                    lbl = post.get('slug', '').replace('-', ' ')
                if len(post.get('caption', '')) > 0:
                    lbl = Strip(post.get('caption', ''))
                elif len(post.get('summary', '')) > 0:
                    lbl = post.get('summary', '')
                elif len(post.get('source_title', '')) > 0:
                    lbl = post.get('source_title', '')
                else:
                    lbl = post.get('short_url', '')
                if post.get('video_url', '') is not None:
                    vidurl = post.get('video_url', '')
            except:
                plugin.notify(str(repr(post)))
            litem = ListItem(label=lbl, label2=lbl2, icon=img2, thumbnail=img, path=vidurl)
            litem.playable = True
            litem.is_folder = False
            if len(post.get('date', '')) > 0:
                rdate = str(post.get('date', '')).split(' ', 1)[0].strip()
            litem.set_info(info_type='video', info_labels={'Date': rdate, 'Duration': post.get('duration', '')})
            litem.set_art({'poster': img2, 'thumbnail': img, 'fanart': img2})
            pathdl = plugin.url_for(endpoint=download, urlvideo=vidurl)
            pathaddlike = plugin.url_for(endpoint=addlike, id=post.get('id', ''))
            litem.add_context_menu_items(
                [('Download', 'RunPlugin({0})'.format(pathdl)), ('Like', 'RunPlugin({0})'.format(pathaddlike)), ])
            litems.append(litem)
    else:
        litems = []
        backurl = ''
        if offset == 0:
            backurl = plugin.url_for(endpoint=blogs_following, offset=0)
        else:
            backurl = plugin.url_for(blogposts, blogname=blogname, offset=(int(offset) - 20))
        nextitem = ListItem(label="No Results - GO BACK".format(strpage), label2=blogname, icon=__imgtumblr__,
                            thumbnail=__imgtumblr__, path=backurl)
        nextitem.set_art({'poster': __imgtumblr__, 'thumbnail': __imgtumblr__, 'fanart': __imgtumblr__})
        nextitem.is_folder = True
        litems = [nextitem]
    savetags(alltags)
    litems.append(nextitem)
    return litems
Пример #10
0
def liked(offset=0):
    # setview_thumb()
    likes = {}
    alltags = []
    litems = []
    listlikes = []
    strpage = str(((int(offset) + 20) / 20))
    nextitem = ListItem(label="Next Page -> #{0}".format(int(strpage) + 1), label2="Liked Videos", icon=__imgnext__,
                        thumbnail=__imgnext__, path=plugin.url_for(liked, offset=int(20 + int(offset))))
    nextitem.set_art({'poster': __imgnext__, 'thumbnail': __imgnext__, 'fanart': __imgnext__})
    nextitem.is_folder = True
    # litems = [nextitem]
    results = tclient.likes(limit=20, offset=int(offset))
    if results is not None:
        if results.get('liked_posts', '') is not None:
            listlikes = results.get('liked_posts', '')
        else:
            listlikes = results.get(results.keys()[-1])
    for item in listlikes:
        if item.get('type', '') == 'video':
            b = {}
            b.update(item)
            lbl = ""
            lbl2 = ""
            img = item.get('thumbnail_url', item.get('image_permalink', item.get('image_permalink', "")))
            alltags.extend(item.get('tags', []))
            if img == '':
                img = __imgtumblr__
            try:
                if len(b.get('slug', '')) > 0:
                    lbl = b.get('slug', '')
                elif len(b.get('title', '')) > 0:
                    lbl = b.get('title', '')
                elif len(b.get('caption', '')) > 0:
                    lbl = Strip(b.get('caption', ''))
                elif len(b.get('summary', '')) > 0:
                    lbl = b.get('summary', '')
                elif len(b.get('source_title', '')) > 0:
                    lbl = b.get('source_title', '')
                else:
                    lbl = b.get('short_url', '')
                if len(item.get('summary', '')) > 0:
                    lbl2 = item.get('summary', '')
                else:
                    lbl2 = item.get('blog_name', "") + " / " + item.get('source_title', '') + "(" + item.get(
                        'slug_name', '') + ")"
            except:
                lbl = b.get(b.keys()[0], "")
                lbl2 = b.get(b.keys()[-1], "")
            vidurl = item.get('video_url', "")
            if vidurl is not None and len(vidurl) > 10:
                litem = ListItem(label=lbl, label2=lbl2, icon=img, thumbnail=img, path=vidurl)
                litem.playable = True
                litem.is_folder = False
                if item.get('date', '') is not None:
                    rdate = str(item.get('date', '')).split(' ', 1)[0].strip()
                litem.set_info(info_type='video', info_labels={'Date': rdate})
                litem.set_art({'poster': img, 'thumbnail': img, 'fanart': img})
                pathdl = plugin.url_for(endpoint=download, urlvideo=vidurl)
                litem.add_context_menu_items([('Download', 'RunPlugin({0})'.format(pathdl)), ])
                litems.append(litem)
    savetags(alltags)
    litems.append(nextitem)
    return litems
Пример #11
0
def dashboard_items(results=[]):
    alltags = []
    litems = []
    for item in results:
        b = {}
        b.update(item)
        vidid = b.get('id', 0)
        ctxlist = []
        lbl = ""
        lbl2 = ""
        vidurl = item.get('video_url', '')
        if vidid != 0:
            pathaddlike = plugin.url_for(endpoint=addlike, id=vidid)
            citemlike = (
                'Like',
                'RunPlugin({0})'.format(pathaddlike),
            )
            ctxlist.append(citemlike)
        pathtoblog = plugin.url_for(blogposts,
                                    blogname=b.get('blog_name', ''),
                                    offset=0)
        citemblog = (
            'View Blog',
            'RunPlugin({0})'.format(pathtoblog),
        )
        ctxlist.append(citemblog)
        pathdl = plugin.url_for(endpoint=download, urlvideo=vidurl)
        citemdl = (
            'Download',
            'RunPlugin({0})'.format(pathdl),
        )
        ctxlist.append(citemdl)
        img = item.get('thumbnail_url',
                       item.get('image_permalink', __imgtumblr__))
        alltags.extend(item.get('tags', []))
        lbl = b.get(
            'summary',
            b.get(
                'source_title',
                b.get(
                    'short_url',
                    b.get(
                        'title',
                        b.get('blog_name',
                              b.get('source_title', b.get('caption', '')))))))
        lbl2 = b.get('blog_name', '') + " " + str(vidid) + " " + b.get(
            'short_url', '')
        from urllib import quote_plus
        if vidurl.find('.mp4') == -1 and len(vidurl) > 0:
            vidurl = "plugin://plugin.video.hubgay/playtumblr/" + quote_plus(
                vidurl)
        else:
            vidurl = "plugin://plugin.video.hubgay/playmovie/" + quote_plus(
                b.get('short_url', b.get('source_url', '')))
        litem = ListItem(label=lbl,
                         label2=lbl2,
                         icon=img,
                         thumbnail=img,
                         path=vidurl)
        litem.playable = True
        litem.is_folder = False
        postdate = item.get(
            'date',
            datetime.datetime.fromtimestamp(item.get(
                'timestamp', None)).isoformat(sep=' ').rpartition(':')[0])
        if postdate is not None:
            lbl2 += postdate
        else:
            postdate = datetime.datetime.fromtimestamp(
                item.get('timestamp',
                         1500000000)).isoformat(sep=' ').rpartition(':')[0]
        postdate = postdate.split(' ', 1)[0]
        litem.set_info(info_type='video', info_labels={'Date': postdate})
        litem.set_art({'poster': img, 'thumbnail': img, 'fanart': img})
        litem.add_context_menu_items(ctxlist)
        litems.append(litem)
    return litems, alltags
Пример #12
0
def dashboard(lastid=0, offset=0):
    #setview_thumb()
    likes = {}
    listlikes = []
    litems = []
    strpage = str(((int(offset) + 20) / 20))
    # results = tclient.dashboard(offset=offset, limit=100)
    lastid = plugin.get_setting('lastid', int)
    if lastid == 0:
        lastid = 10000000000
    if lastid is None or lastid < 1000000:
        lastid = 10000000000
    results = tclient.dashboard(limit=20,
                                offset=offset,
                                type='video',
                                since_id=lastid)
    nextitem = ListItem(label="Next Page -> #{0}".format(int(strpage) + 1),
                        label2="Liked Videos",
                        icon=__imgnext__,
                        thumbnail=__imgnext__,
                        path=plugin.url_for(dashboard,
                                            offset=int(20 + int(offset)),
                                            lastid=lastid))
    nextitem.set_art({
        'poster': __imgnext__,
        'thumbnail': __imgnext__,
        'fanart': __imgnext__
    })
    nextitem.is_folder = True
    # litems = [nextitem]
    litems = []
    alltags = []
    if results is not None:
        if results.get('posts', '') is not None:
            if results.get('posts', ''):
                results = results.get('posts', '')
            try:
                if isinstance(results, list):
                    listlikes = results
                else:
                    listlikes = results.get(results.keys()[0])
            except:
                listlikes = []
        else:
            listlikes = results.get(results.keys()[-1])
    for item in listlikes:
        if item.get('type', '') == 'video':
            b = item
            img = __imgtumblr__
            alltags.extend(item.get('tags', []))
            if 'thumb' in str(item.keys()[:]):
                if item.get('thumbnail_url', '') is not None:
                    img = item.get(
                        'thumbnail_url', ''
                    )  # .replace('https', 'http') #item.get('thumbnail_url','')
            elif 'image' in str(item.keys()[:]):
                if item.get('image_permalink', ""):
                    img = item.get('image_permalink', "")
            try:
                if len(b.get('slug', '')) > 0:
                    lbl = b.get('slug', '')
                elif len(b.get('title', '')) > 0:
                    lbl = b.get('title', '')
                elif len(b.get('caption', '')) > 0:
                    lbl = Strip(b.get('caption', ''))
                elif len(b.get('summary', '')) > 0:
                    lbl = b.get('summary', '')
                elif len(b.get('source_title', '')) > 0:
                    lbl = b.get('source_title', '')
                else:
                    lbl = b.get('short_url', '')
                if len(item.get('summary', '')) > 0:
                    lbl2 = item.get('summary', '')
                else:
                    lbl2 = item.get('blog_name', '') + " / " + item.get(
                        'source_title', '') + "(" + item.get('slug_name',
                                                             '') + ")"
            except:
                lbl = b.get('blog_name', '')
                lbl2 = b.get('short_url', '')
            img = item.get('thumbnail_url', '')
            vidurl = item.get('video_url', '')
            if vidurl is not None and len(vidurl) > 10:
                if len(b.get('caption', '')) > 0:
                    lbl = Strip(b.get('caption', ''))
                litem = ListItem(label=lbl,
                                 label2=lbl2,
                                 icon=img,
                                 thumbnail=img,
                                 path=vidurl)
                litem.playable = True
                litem.is_folder = False
                if item.get('date', '') is not None:
                    rdate = str(item.get('date', '')).split(' ', 1)[0].strip()
                litem.set_info(info_type='video', info_labels={'Date': rdate})
                litem.set_art({'poster': img, 'thumbnail': img, 'fanart': img})
                pathdl = plugin.url_for(endpoint=download, urlvideo=vidurl)
                pathaddlike = plugin.url_for(endpoint=addlike,
                                             id=item.get('id', ''))
                litem.add_context_menu_items([
                    ('Download', 'RunPlugin({0})'.format(pathdl)),
                    ('Like', 'RunPlugin({0})'.format(pathaddlike)),
                ])
                litems.append(litem)
    item = listlikes[-1]
    plugin.set_setting('lastid', str(item.get('id', lastid)))
    savetags(alltags)
    litems.append(nextitem)
    return litems