示例#1
0
async def incoming_message_f(client, message):
    """/leech command"""
    i_m_sefg = await message.reply_text("processing", quote=True)
    is_zip = False
    if len(message.command) > 1:
        if message.command[1] == "archive":
            is_zip = True
    # get link from the incoming message
    dl_url, cf_name = extract_link(message.reply_to_message)
    LOGGER.info(dl_url)
    LOGGER.info(cf_name)
    if dl_url is not None:
        await i_m_sefg.edit_text("extracting links")
        # start the aria2c daemon
        aria_i_p = await aria_start()
        LOGGER.info(aria_i_p)
        current_user_id = message.from_user.id
        # create an unique directory
        new_download_location = os.path.join(DOWNLOAD_LOCATION,
                                             str(current_user_id),
                                             str(time.time()))
        # create download directory, if not exist
        if not os.path.isdir(new_download_location):
            os.makedirs(new_download_location)
        await i_m_sefg.edit_text("trying to download")
        # try to download the "link"
        sagtus, err_message = await call_apropriate_function(
            aria_i_p, dl_url, new_download_location, i_m_sefg, is_zip)
        if not sagtus:
            # if FAILED, display the error message
            await i_m_sefg.edit_text(err_message)
    else:
        await i_m_sefg.edit_text(
            "**Behen-ke-lawde link galat hai** or If magnet link type with bold else **Gand Marao.**"
        )
示例#2
0
async def incoming_message_f(client, message):
    """/leech command"""
    i_m_sefg = await message.reply_text("wait....processing", quote=True)
    is_zip = False
    if len(message.command) > 1:
        if message.command[1] == "archive":
            is_zip = True
    # get link from the incoming message
    dl_url, cf_name = extract_link(message.reply_to_message)
    LOGGER.info(dl_url)
    LOGGER.info(cf_name)
    if dl_url is not None:
        await i_m_sefg.edit_text("wait... as i extract links")
        # start the aria2c daemon
        aria_i_p = await aria_start()
        LOGGER.info(aria_i_p)
        current_user_id = message.from_user.id
        # create an unique directory
        new_download_location = os.path.join(DOWNLOAD_LOCATION,
                                             str(current_user_id),
                                             str(time.time()))
        # create download directory, if not exist
        if not os.path.isdir(new_download_location):
            os.makedirs(new_download_location)
        await i_m_sefg.edit_text("..patience ...while trying to download")
        # try to download the "link"
        sagtus, err_message = await call_apropriate_function(
            aria_i_p, dl_url, new_download_location, i_m_sefg, is_zip)
        if not sagtus:
            # if FAILED, display the error message
            await i_m_sefg.edit_text(err_message)
    else:
        await i_m_sefg.edit_text(
            "Oh my goodness! what have you entered. Please read /help")
示例#3
0
async def incoming_message_f(client, message):
    """/download command"""
    i_m_sefg = await message.reply_text("Sedang di proses", quote=True)
    is_zip = False
    if len(message.command) > 1:
        if message.command[1] == "archive":
            is_zip = True
    # get link from the incoming message
    dl_url, cf_name = extract_link(message.reply_to_message)
    LOGGER.info(dl_url)
    LOGGER.info(cf_name)
    if dl_url is not None:
        await i_m_sefg.edit_text("mengekstrak link")
        # start the aria2c daemon
        aria_i_p = await aria_start()
        LOGGER.info(aria_i_p)
        current_user_id = message.from_user.id
        # create an unique directory
        new_download_location = os.path.join(DOWNLOAD_LOCATION,
                                             str(current_user_id),
                                             str(time.time()))
        # create download directory, if not exist
        if not os.path.isdir(new_download_location):
            os.makedirs(new_download_location)
        await i_m_sefg.edit_text("sedang mencoba mengunduh")
        # try to download the "link"
        sagtus, err_message = await call_apropriate_function(
            aria_i_p, dl_url, new_download_location, i_m_sefg, is_zip)
        if not sagtus:
            # if FAILED, display the error message
            await i_m_sefg.edit_text(err_message)
    else:
        await i_m_sefg.edit_text("Mana Link/Magnet/Torrent nya?!?!?!")
示例#4
0
async def incoming_youtube_dl_f(client, message):
    """ /ytdl command """
    i_m_sefg = await message.reply_text("processing", quote=True)
    # LOGGER.info(message)
    # extract link from message
    dl_url, cf_name = extract_link(message.reply_to_message)
    LOGGER.info(dl_url)
    LOGGER.info(cf_name)
    if dl_url is not None:
        await i_m_sefg.edit_text("extracting links")
        current_user_id = message.from_user.id
        # create an unique directory
        user_working_dir = os.path.join(DOWNLOAD_LOCATION, str(current_user_id))
        # create download directory, if not exist
        if not os.path.isdir(user_working_dir):
            os.makedirs(user_working_dir)
        # list the formats, and display in button markup formats
        text_message, reply_markup = await extract_youtube_dl_formats(
            dl_url,
            user_working_dir
        )
        await i_m_sefg.edit_text(
            text=text_message,
            reply_markup=reply_markup
        )
    else:
        # if no links found, delete the "processing" message
        await i_m_sefg.delete()
async def incoming_message_f(client, message):
    """/leech command"""
    i_m_sefg = await message.reply_text("yuklanmoqda...", quote=True)
    is_zip = False
    if len(message.command) > 1:
        if message.command[1] == "archive":
            is_zip = True
    # get link from the incoming message
    dl_url, cf_name = extract_link(message.reply_to_message)
    LOGGER.info(dl_url)
    LOGGER.info(cf_name)
    if dl_url is not None:
        await i_m_sefg.edit_text("Linklar olinmoqda...")
        # start the aria2c daemon
        aria_i_p = await aria_start()
        LOGGER.info(aria_i_p)
        current_user_id = message.from_user.id
        # create an unique directory
        new_download_location = os.path.join(DOWNLOAD_LOCATION,
                                             str(current_user_id),
                                             str(time.time()))
        # create download directory, if not exist
        if not os.path.isdir(new_download_location):
            os.makedirs(new_download_location)
        await i_m_sefg.edit_text("Yuklab olinmoqda...")
        # try to download the "link"
        sagtus, err_message = await call_apropriate_function(
            aria_i_p, dl_url, new_download_location, i_m_sefg, is_zip)
        if not sagtus:
            # if FAILED, display the error message
            await i_m_sefg.edit_text(err_message)
    else:
        await i_m_sefg.edit_text(
            "Qandaydir xatolik boldi.Iltimos /help buyrugini yuboring.")
示例#6
0
async def incoming_youtube_dl_f(client, message):
    i_m_sefg = await message.reply_text("processing", quote=True)
    # LOGGER.info(message)
    dl_url, cf_name = extract_link(message.reply_to_message)
    LOGGER.info(dl_url)
    LOGGER.info(cf_name)
    if dl_url is not None:
        await i_m_sefg.edit_text("extracting links")
        current_user_id = message.from_user.id
        user_working_dir = os.path.join(DOWNLOAD_LOCATION,
                                        str(current_user_id))
        # create download directory, if not exist
        if not os.path.isdir(user_working_dir):
            os.makedirs(user_working_dir)
        text_message, reply_markup = await extract_youtube_dl_formats(
            dl_url, user_working_dir)
        await i_m_sefg.edit_text(text=text_message, reply_markup=reply_markup)
示例#7
0
async def incoming_youtube_dl_f(client, message):
    """ /ytdl command """
    i_m_sefg = await message.reply_text("processing", quote=True)
    # LOGGER.info(message)
    # extract link from message
    dl_url, cf_name = extract_link(message.reply_to_message)
    LOGGER.info("===============START YTDL")
    dl_url_folder = dl_url.replace("watch?v=", "").replace(";", "").replace(
        "-", "").replace(".", "").replace("+", "").replace("=", "").replace(
            "\\",
            "").replace("/", "").replace(":", "").replace("*", "").replace(
                "?",
                "").replace('"', "").replace("<", "").replace(">", "").replace(
                    "|", "").replace("https", "").replace("www", "").replace(
                        "youtube", "").replace("com", "").replace("com", "")
    LOGGER.info(dl_url)
    LOGGER.info(dl_url_folder)
    #LOGGER.info(cf_name)
    if dl_url is not None:
        await i_m_sefg.edit_text("extracting links")
        current_user_id = message.from_user.id
        # create an unique directory
        user_working_dir = os.path.join(DOWNLOAD_LOCATION,
                                        str(current_user_id), dl_url_folder)
        # create download directory, if not exist
        if not os.path.isdir(user_working_dir):
            os.makedirs(user_working_dir)
        # list the formats, and display in button markup formats
        thumb_image, text_message, reply_markup = await extract_youtube_dl_formats(
            dl_url, user_working_dir)
        if thumb_image is not None:
            await message.reply_photo(photo=thumb_image,
                                      quote=True,
                                      caption=text_message,
                                      reply_markup=reply_markup)
            await i_m_sefg.delete()
        else:
            await i_m_sefg.edit_text(text=text_message,
                                     reply_markup=reply_markup)
    else:
        # if no links found, delete the "processing" message
        await i_m_sefg.delete()
示例#8
0
async def incoming_message_f(client, message):
    """/leech command"""
    i_m_sefg = await message.reply_text("processing", quote=True)
    is_zip = False
    if len(message.command) > 1:
        if message.command[1] == "archive":
            is_zip = True
    # get link from the incoming message
    #LOGGER.info("is_zip===============================")
    #LOGGER.info(is_zip)
    dl_url, cf_name = extract_link(message.reply_to_message)
    #LOGGER.info(dl_url)
    #LOGGER.info(cf_name)
    if dl_url is not None:
        akcm = dl_url.split('\n')
        akcm = list(filter(lambda x: x != "", akcm))
        for akc_url in akcm:
            await i_m_sefg.edit_text("extracting links")
            # start the aria2c daemon
            aria_i_p = await aria_start()
            LOGGER.info("   ")
            LOGGER.info(aria_i_p)
            current_user_id = message.from_user.id
            # create an unique directory
            new_download_location = os.path.join(DOWNLOAD_LOCATION,
                                                 str(current_user_id),
                                                 str(time.time()))
            # create download directory, if not exist
            if not os.path.isdir(new_download_location):
                os.makedirs(new_download_location)
            await i_m_sefg.edit_text("trying to download")
            # try to download the "link"
            sagtus, err_message = await call_apropriate_function(
                aria_i_p, akc_url, new_download_location, i_m_sefg, is_zip)
            if not sagtus:
                # if FAILED, display the error message
                await i_m_sefg.edit_text(err_message)
            await asyncio.sleep(EDIT_SLEEP_TIME_OUT)
    else:
        await i_m_sefg.edit_text(
            "**ERR**! What have you entered. Please read /help")
示例#9
0
async def incoming_message_f(client, message):
    i_m_sefg = await message.reply_text("processing", quote=True)
    # LOGGER.info(message)
    dl_url, cf_name = extract_link(message.reply_to_message)
    LOGGER.info(dl_url)
    LOGGER.info(cf_name)
    if dl_url is not None:
        await i_m_sefg.edit_text("extracting links")
        aria_i_p = await aria_start()
        LOGGER.info(aria_i_p)
        new_download_location = os.path.join(
            DOWNLOAD_LOCATION, str(time.time()),
            cf_name if cf_name is not None else "")
        # create download directory, if not exist
        if not os.path.isdir(new_download_location):
            os.makedirs(new_download_location)
        await i_m_sefg.edit_text("trying to download")
        sagtus, err_message = await call_apropriate_function(
            aria_i_p, dl_url, new_download_location, i_m_sefg)
        if not sagtus:
            await i_m_sefg.edit_text(err_message)
    else:
        await i_m_sefg.edit_text(
            "**FCUK**! wat have you entered. Please read /help")
示例#10
0
async def incoming_message_f(client, message):
    """/leech command"""
    i_m_sefg = await message.reply_text("processing", quote=True)
    is_zip = False
    is_unzip = False
    if len(message.command) > 1:
        if message.command[1] == "archive":
            is_zip = True
        elif message.command[1] == "unzip":
            is_unzip = True
    # get link from the incoming message
    dl_url, cf_name = extract_link(message.reply_to_message)
    LOGGER.info(dl_url)
    LOGGER.info(cf_name)
    if dl_url is not None:
        if "pluralsight.com" in dl_url:
            await i_m_sefg.edit_text("extracting links")
            aria_i_p = await aria_start()
            LOGGER.info(aria_i_p)
            current_user_id = message.from_user.id
            new_download_location = os.path.join(
                DOWNLOAD_LOCATION,
                str(current_user_id),
                str(time.time())
            )
            new_download_location = new_download_location+"/"
            # create download directory, if not exist
            if not os.path.isdir(new_download_location):
                os.makedirs(new_download_location)
            await i_m_sefg.edit_text("trying to download")

            harm = await plu_dl(dl_url,
            i_m_sefg,
            new_download_location
            )
            LOGGER.info(harm)
            i_m_sefg = await message.reply_text("All Clips Uploaded", quote=True)
    
        else:
            await i_m_sefg.edit_text("extracting links")
            # start the aria2c daemon
            aria_i_p = await aria_start()
            LOGGER.info(aria_i_p)
            current_user_id = message.from_user.id
            # create an unique directory
            new_download_location = os.path.join(
                DOWNLOAD_LOCATION,
                str(current_user_id),
                str(time.time())
            )
            # create download directory, if not exist
            if not os.path.isdir(new_download_location):
                os.makedirs(new_download_location)
            await i_m_sefg.edit_text("trying to download")
            # try to download the "link"
            sagtus, err_message = await call_apropriate_function(
                aria_i_p,
                dl_url,
                new_download_location,
                i_m_sefg,
                is_zip,
                is_unzip
            )
            if not sagtus:
                # if FAILED, display the error message
                await i_m_sefg.edit_text(err_message)
    else:
            await i_m_sefg.edit_text("Send Link And Then Reply /leech")
示例#11
0
async def incoming_message_f(client, message):
    """/leech command"""
    i_m_sefg = await message.reply_text("processing", quote=True)
    is_zip = False
    is_unzip = False
    is_convert = False
    if len(message.command) > 1:
        if message.command[1] == "archive":
            is_zip = True
        elif message.command[1] == "unzip":
            is_unzip = True
        elif message.command[1] == "convert":
            is_convert = True
    # get link from the incoming message
    if not message.reply_to_message:
        i_m_sefg = await message.reply_text("No link or No File Found",
                                            quote=True)
    elif message.reply_to_message.document:
        hell = await message.reply_to_message.download(
            file_name=DOWNLOAD_LOCATION)
        sent_message_to_update_tg_p = i_m_sefg
        current_user_id = message.from_user.id
        new_download_location = os.path.join(DOWNLOAD_LOCATION,
                                             str(current_user_id),
                                             str(time.time()))

        LOGGER.info(new_download_location)

        if not os.path.isdir(new_download_location):
            os.makedirs(new_download_location)
        new_download_location = new_download_location + "/"
        #i_m_sefg = await message.reply_text(text=hell, quote=True)
        with open(hell) as foe:
            for rec in foe:
                url = rec
                LOGGER.info(url)
                if "?a=view" in url:
                    url = url.replace("?a=view", "")
                command = [
                    "youtube-dl",
                    "--no-warnings",
                    "--console-title",
                    "-c",
                    "--retries=10",
                    #"--max-sleep-interval=20",
                    "-o" + new_download_location + "%(title)s.%(ext)s",
                    url
                ]
                process = call(command, shell=False)
        if is_convert:
            a = os.listdir(new_download_location)
            b = a[0]
            #convert_file(new_download_location,'same',300,False)
            new_download_location = new_download_location + b
            new_download_location = os.path.abspath(new_download_location)
            convert_file(new_download_location, 'same', 300, False)
        to_upload_file = new_download_location
        response = {}
        LOGGER.info(response)
        user_id = sent_message_to_update_tg_p.reply_to_message.from_user.id
        final_response = await upload_to_tg(sent_message_to_update_tg_p,
                                            to_upload_file, user_id, response)

    else:
        sent_message_to_update_tg_p = i_m_sefg
        i_m_sefg = await message.reply_text("is not", quote=True)
        dl_url, cf_name = extract_link(message.reply_to_message)
        LOGGER.info(dl_url)
        LOGGER.info(cf_name)

        if dl_url is not None:
            await i_m_sefg.edit_text("extracting links")
            # start the aria2c daemon

            #aria_i_p = await aria_start()
            #LOGGER.info(aria_i_p)

            current_user_id = message.from_user.id
            # create an unique directory
            new_download_location = os.path.join(DOWNLOAD_LOCATION,
                                                 str(current_user_id),
                                                 str(time.time()))
            new_download_location = new_download_location + "/"
            # create download directory, if not exist
            if not os.path.isdir(new_download_location):
                os.makedirs(new_download_location)
            await i_m_sefg.edit_text("trying to download")
            url = dl_url
            command = [
                "youtube-dl",
                "--no-warnings",
                "--console-title",
                "-c",
                "--retries=10",
                #"--max-sleep-interval=20",
                "-o" + new_download_location + "%(title)s.%(ext)s",
                url
            ]
            process = call(command, shell=False)
            if is_convert:
                a = os.listdir(new_download_location)
                b = a[0]
                #convert_file(new_download_location,'same',300,False)
                new_download_location = new_download_location + b
                #convert_file(new_download_location,'same',300,False)
                conurl = convert_link(url, 'same', 300, False)
                i_m_sefg1 = await message.reply_text(text=conurl, quote=True)
            if is_unzip:
                a = os.listdir(new_download_location)
                b = a[0]
                new_download_location = new_download_location + b
                new_download_location = await create_unzip(
                    new_download_location)
                to_upload_file = new_download_location
                response = {}
                LOGGER.info(response)
                user_id = current_user_id  #sent_message_to_update_tg_p.reply_to_message.from_user.id
                final_response = await upload_to_tg(
                    sent_message_to_update_tg_p, to_upload_file, user_id,
                    response)
            else:
                to_upload_file = new_download_location
                response = {}
                LOGGER.info(response)
                user_id = current_user_id  #sent_message_to_update_tg_p.reply_to_message.from_user.id
                final_response = await upload_to_tg(
                    sent_message_to_update_tg_p, to_upload_file, user_id,
                    response)

        # try to download the "link"
        """