Example #1
0
def dmmphoto(update, context):
    searchid = context.args[0]
    #chat_id = update.message.chat_id
    list_of_urls = prephotos(searchid)
    if list_of_urls == []:
        if len(context.args) == 1:
            searchidd = context.args[0]
            searchidd = searchidd.replace('-',' ')
        else:
            searchidd = ' '.join(context.args[:])
        boxlist,stitle = dmmsearch(searchidd,'onlysearch')
        if boxlist == '選択した条件で商品は存在しませんでした':
            update.message.reply_text('没有找到 %s 预览图片'%searchid)
            return
        #print(boxlist)
        firstlist = boxlist[0]
        wcid = firstlist.get('cid')
        list_of_urls = prephotos(wcid)
    
    if len(list_of_urls)<=10:
        media_group = []
        for number, url in enumerate(list_of_urls):
            media_group.append(telegram.InputMediaPhoto(media=url, caption="Turtle" + str(number)))
        update.message.reply_media_group(media=media_group)
    else:
        list_of_urls = split_list(list_of_urls,10) 
        for i in list_of_urls:
            media_group = []
            for number, url in enumerate(i):
            #print(telegram.InputMediaPhoto(media=url, caption="Photos" + str(number)))
                media_group.append(telegram.InputMediaPhoto(media=url, caption="Photos" + str(number)))
        #print(media_group)
            update.message.reply_media_group(media=media_group)
Example #2
0
def dmmsearchh(update, context):
    if len(context.args) == 1:
        searchstr = context.args[0]

    else:
        searchstr = ' '.join(context.args[:])

    #print(searchstr)

    text = dmmsearch(searchstr)
    update.message.reply_markdown(text)
Example #3
0
def dmmsearchh(update, context):
    if len(context.args) == 1:
        searchstr = context.args[0]
        
    else:
        searchstr = ' '.join(context.args[:])
        
    #print(searchstr)
    
    text = dmmsearch(searchstr)
    msg = long_message(update,context,text,'markdown')
Example #4
0
def dmmvideo(update, context):
    searchid = context.args[0]
    #text = str(prevideo(searchid))
    #update.message.reply_video(text)
    nocid = 0
    if len(context.args) == 1:
        gang = '-'
        searchidd = context.args[0]
        if gang in searchidd:
            nocid = 1
            searchidd = searchidd.replace('-', ' ')
    else:
        nocid = 1
        searchidd = ' '.join(context.args[:])
    if nocid == 1:
        boxlist, stitle = dmmsearch(searchidd, 'onlysearch')
        if boxlist == '選択した条件で商品は存在しませんでした':
            update.message.reply_text('没有找到 %s 预览视频' % searchid)
            return
        #print(boxlist)
        firstlist = boxlist[0]
        searchid = firstlist.get('cid')
    try:
        result = str(truevideo(searchid))
    except:
        print('尝试使用selenium引擎失败')
        result = str(prevideo(searchid))

    try:

        update.message.reply_video(result)

    except:
        result_hd = result
        update.message.reply_text(
            '原视频超出telegram大小限制,将发送低画质版本,可复制原画质链接到浏览器查看!---%s' % result_hd)
        result = result.replace('mhb', 'dmb')
        try:
            update.message.reply_video(result)
        except:
            result = result.replace('dmb', 'sm')
            update.message.reply_video(result)
Example #5
0
def dmmcid(update, context):
    searchid = context.args[0]
    if len(context.args) == 1:
        searchidd = context.args[0]
        searchidd = searchidd.replace('-', ' ')
    else:
        searchidd = ' '.join(context.args[:])
    text, notitle = dmmonecid(searchid)
    if notitle == 1:
        #update.message.reply_text('没有找到%s的cid信息,自动尝试使用/search功能搜索' %searchid)
        boxlist, stitle = dmmsearch(searchidd, 'onlysearch')
        if boxlist == '選択した条件で商品は存在しませんでした':
            update.message.reply_text('没有找到 %s 的cid信息,自动搜索无结果:%s' %
                                      (searchid, boxlist))
            return
        #print(boxlist)
        firstlist = boxlist[0]
        wcid = firstlist.get('cid')
        text, notitle = dmmonecid(wcid)

        update.message.reply_markdown(text)

    else:
        update.message.reply_markdown(text)