Example #1
0
    def validate_elements(val_brutebot):

        global val2_output

        tmp_driver = Browser(showWindow=False, proxy=brutebot.proxy)
        tmp_driver.go_to(val_brutebot.target)
        time.sleep(val_brutebot.time_in_seconds)

        x = tmp_driver.exists(val_brutebot.uid, css_selector=str('input[type=text][id="{}"]').format(brutebot.uid))
        y = tmp_driver.exists(val_brutebot.pid, css_selector=str('input[type=password][id="{}"]').format(brutebot.pid))
        z = tmp_driver.exists(val_brutebot.button_name,
                              css_selector=str('button[type=submit][value="{}"]'
                                               or 'input[type=submit][value="{}"]').format(brutebot.button_name))

        if x and y and z:
            time.sleep(val_brutebot.time_in_seconds)
            tmp_driver.close_current_tab()
            val2_output = True
            print_green(f"[!] The specified URL and the login page elements seem OK.\n")
            sys.exit()
        else:
            print_red(
                '[!] Error: The specified URL / login page elements could not be found. Please check & try again.\n\n'
                '[!] Exiting program!\n')
            val2_output = False
            sys.exit()
Example #2
0
def getPage():
    global queries
    global soup

    print("Scarico la pagina")
    web = Browser()
    web.go_to(url_login)
    web.type(email, into='E-mail')
    web.type(password, into='Password')
    web.click('ACCEDI', classname='submit_access')
    time.sleep(delay)
    web.click('OFFERTE DI LAVORO')
    time.sleep(delay)
    page = web.get_page_source()
    web.close_current_tab()

    soup = BeautifulSoup(str(page), 'html.parser')

    print("Cerco il box degli annunci")
    soup = soup.find("div", id="js-grid-blog-posts")

    print("Inzio a filtrare i risultati per regione")
    global regioni_cercate
    for reg in regioni_cercate:
        print("Filtro per: " + reg)
        filter(soup, reg)
    print("Ho concluso l'esecuzione")
Example #3
0
def login(ip, password):
    web = Browser()
    web.go_to('https://'+ ip +':4444/')
    web.type('admin' , into='Username' , id='ELEMENT_login_username')
    web.type(password , into='Password' , id='ELEMENT_login_password')
    web.click('Login' , tag='div' , id='ELEMENT_login_button')
    time.sleep(15);
    web.close_current_tab();
Example #4
0
def getEvent(url):

    if 'facebook.com/events/' in url:
        web = Browser()
        web.go_to(url)
        try:
            newEvent = Event()
            pagina = web.find_elements(id='content_container')

            eventHead= pagina[0].find_element_by_id('event_header')
            primary= eventHead.find_element_by_id('event_header_primary')
            link= primary.find_element_by_tag_name('img').get_attribute('src')
            titlu= primary.find_element_by_id('seo_h1_tag').text
            newEvent.title=titlu

            newEvent.tags= tags_controller.get_Tags(newEvent.title)

            newEvent.image_link=link

            sumar= eventHead.find_element_by_id('event_summary')
            data= sumar.find_element_by_id('event_time_info')

            for x in data.find_elements_by_css_selector("*"):
               if x.get_attribute('content'):
                    y = x.get_attribute('content').split('to')
                    newEvent.date = parser.parse(y[0])

            x= data.find_element_by_xpath("./following-sibling::li")
            location= x.text[x.text.find('\n'):x.text.rfind('\n')]
            newEvent.location=location


            detalii=pagina[0].find_element_by_id('reaction_units')
            for elem in detalii.find_elements_by_css_selector("*"):
                if elem.get_attribute('data-testid') == 'event-permalink-details':
                    newEvent.description = elem.text
                    newEvent.tags+= tags_controller.get_Tags(newEvent.description)

            if detalii.find_element_by_tag_name('ul'):
                newEvent.tags += tags_controller.get_Tags(detalii.find_element_by_tag_name('ul').text)

            newEvent.put()

            web.close_current_tab()

        except :
            print("Nu am putut colecta toate datele")
    else:
        print('Bad url')
Example #5
0
def webot(user, passwd):
    web = Browser(False)
    web.go_to("https://midas.unioeste.br/login/#/")
    time.sleep(5)
    web.type(user, id="login-username")
    web.type(passwd, id="login-password")
    web.press(web.Key.ENTER)
    time.sleep(5)
    web.click('Academus')
    time.sleep(5)
    web.click('Matrículas')
    time.sleep(3)
    data = web.get_page_source()
    web.close_current_tab()
    return data
Example #6
0
        def download_file_rj(music_or_video, file_type, regex_file, ch_actions):
            context.bot.send_message(chat_id=chat_id, text="کمی صبر کنید...")
            if res != "inv":
                web = Browser()
                web.go_to(url)
                s = web.get_page_source()
                web.close_current_tab()
                soup = BeautifulSoup(s, 'html.parser')
                # finde mp3 link
                file_name = str(re.findall(fr"{regex_file}", str(soup)))
                file_name = file_name.replace("['", "")
                file_name = file_name.replace("']", "")
                file_url = f"https://host2.rj-mw1.com/{file_type}{file_name}.mp{music_or_video}"
                req = urllib.request.Request(file_url)
                with urllib.request.urlopen(req) as response:
                    the_file_url_page = str(response.read())
                if the_file_url_page != "b'Not found'":
                    wget.download(file_url, f'{file_name}.mp{music_or_video}')
                else:
                    try:
                        os.remove(f"{file_name}.mp{music_or_video}")
                    except:
                        pass
                    file_url = f"https://host1.rj-mw1.com/{file_type}{file_name}.mp{music_or_video}"
                    wget.download(file_url, f'{file_name}.mp{music_or_video}')
                file_caption = str(file_name) #name fixed
                file_caption = file_caption.replace("-"," ")
                if str(file_name) == "[]":
                    context.bot.send_chat_action(chat_id, ChatAction.TYPING)
                    context.bot.send_message(chat_id=chat_id, text="لینک اشتباه است. \n\n لطفا لینک آهنگ یا موزیک ویدیوی مورد نظر را از رادیو جوان بفرستید.")
                else:
                    if ch_actions == "music":
                        context.bot.send_chat_action(chat_id, ChatAction.UPLOAD_AUDIO)
                        context.bot.send_audio(chat_id=chat_id, audio=open(f"./{file_name}.mp{music_or_video}", "rb"), caption=f"{file_caption}")
                    elif ch_actions == "video":
                        context.bot.send_chat_action(chat_id, ChatAction.UPLOAD_VIDEO)
                        context.bot.send_video(chat_id=chat_id, video=open(f"./{file_name}.mp{music_or_video}", "rb"), caption=f"{file_caption}")

                if os.path.exists(f"{file_name}.mp{music_or_video}"):
                    os.remove(f"{file_name}.mp{music_or_video}")
Example #7
0
def main():
    url = input("Please Input The Petition Link You Want To Sign:")
    # times= input('Sign How M')
    # avgtime=[]
    c=0
    err=0
    # if
    while True:
        try:
            start = time.process_time()

            URL='https://generator.email/'
            driver1 = webdriver.Chrome(executable_path='chromedriver.exe')
            driver1.minimize_window()
            driver1.get(URL)
            try:
                WebDriverWait(driver1, 10).until(EC.presence_of_element_located((By.ID,'email_ch_text')))
            except:
                driver1.refresh()
                WebDriverWait(driver1, 10).until(EC.presence_of_element_located((By.ID,'email_ch_text')))

            e=driver1.find_element_by_id('email_ch_text').text 
            print(e)

            v='1234567890qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM@#$%^&*-_=+,./?;:'
            def checkvalid(e):
                for i in e:
                    if i not in v:
                        return False
                return True

            if checkvalid(e) == False:
                print('shit email')
                driver1.quit()
                continue
            else:
                pass
            a=random.randint(0, len(names))
            b=random.randint(0, len(surnames))
            web2 = Browser()
            web2.minimize_window()

            web2.go_to(url)
            web2.type(names[a],into = 'First Name')
            web2.type(surnames[b],into = 'Last Name')
            web2.type(e,into = 'Email Address')

            web2.click('Sign Now')
            time.sleep(3)

            web2.close_current_tab()

            time.sleep(3)
            driver1.refresh()

            def checkexist(text):
                try:
                    driver1.find_element_by_link_text(text)
                except:
                    return False
                return True
            time.sleep(3)
            check = checkexist('Confirm your signature by clicking here.')
            d=0
            while check == False:
                time.sleep(3)
                driver1.refresh()
                time.sleep(5)
                check = checkexist('Confirm your signature by clicking here.')
                d=d+1
                if d>5:
                    print(f'looped {d} times,failed')
                    break
                else:
                    pass
            else:
                print(f'looped {d} times,succesed')
                driver1.find_element_by_link_text('Confirm your signature by clicking here.').click()
                driver1.minimize_window
                time.sleep(3)
                driver1.quit()
                c=c+1
                print(f'SIGNED {c} TIMES')
                
            # driver1.quit()
            
            end = time.process_time()
            t=end - start
            # avgtime.append(t)
            print(f'It takes {t} to complete')
            
        # except KeyboardInterrupt:
        #     sys.exit()
        except:
            driver1.quit()
            print(f'error in {c} times')
            print('Something sent wrong,please close the program and try again')
Example #8
0
    time.sleep(time_load_article)
    anime_content = web.get_page_source()
    anime_soup = BeautifulSoup(anime_content, 'html.parser')
    anime_op_list = []  #Formateo la lista
    anime_ed_list = []  #Formateo la lista
    # opening/ending theme
    for song_list in anime_soup.find_all("div", {"class": "opnening"}):
        for song in song_list.find_all("span"):
            song_cleaned = re.sub("^#\d{1,2}:\s|\s\([\da-zA-Z,\s\-]+\)$", "",
                                  song.getText())
            anime_op_list.append(song_cleaned)
    for song_list in anime_soup.find_all("div", {"class": "ending"}):
        for song in song_list.find_all("span"):
            song_cleaned = re.sub("^#\d{1,2}:\s|\s\([\da-zA-Z,\s\-]+\)$", "",
                                  song.getText())
            anime_ed_list.append(song_cleaned)
    # append to db
    db = db.append(
        pd.Series([
            anime_title, anime_link, ", ".join(anime_op_list),
            ", ".join(anime_ed_list)
        ],
                  index=db.columns),
        ignore_index=True
    )  #Si te rayas con el orden de las cosas ¿? no te bote error

#Tao se la come x2

# - - - Save file - - -
web.close_current_tab()
db.to_csv('I_am_a_file_a_csv_file_tho.csv', index=False)
Example #9
0
def input_url(update: Update, context:CallbackContext):
    while True:
        chat_id = update.message.chat_id
        # input url

        url = update.message.text

        # --------------------
        # check url
        url_check_regex = re.findall(r"(www\.radiojavan\.com/mp3s/mp3/)", url)
        url_check_regex_app = re.findall(r"(rj\.app/m/)", url)
        url_check_regex_podcast_app = re.findall(r"rj\.app/p/", url)
        url_check_regex_podcast = re.findall(r"www\.radiojavan\.com/podcasts/podcast/", url)
        url_check_regex_video = re.findall(r"www\.radiojavan\.com/videos/video/", url)
        url_check_regex_video_app = re.findall(r"rj\.app/v/", url)
        url_check_regex_playlist = re.findall(r"www\.radiojavan\.com/playlists/playlist/", url)
        url_check_regex_playlist_app = re.findall(r"rj\.app/pm/", url)
        list_url = [
            url_check_regex,
            url_check_regex_app,
            url_check_regex_podcast,
            url_check_regex_podcast_app,
            url_check_regex_video,
            url_check_regex_video_app,
            url_check_regex_playlist,
            url_check_regex_playlist_app
        ]
        what_is_link_type = ""
        count = 0
        for check_url_link_list in list_url:
            if str(check_url_link_list) != "[]" :
                url = url
                what_is_link_type = check_url_link_list
            else:
                count += 1
        res = ""


        if count == 6:
            context.bot.send_chat_action(chat_id, ChatAction.TYPING)
            context.bot.send_message(chat_id=chat_id, text="لینک اشتباه است. \n\n لطفا لینک آهنگ یا موزیک ویدیوی مورد نظر را از رادیو جوان بفرستید.")
            res = "inv"
            break

        # try to download
        files_url = {
            "music": "media/mp3/mp3-256/",
            "podcast": "media/podcast/mp3-192/",
            "video_lq": "media/music_video/lq/",
            "video_hd": "media/music_video/hd/",
            "video_hq": "media/music_video/hq/",
            "video_4k": "media/music_video/4k/"
        }
        regex_music_and_video = {
            "music": "RJ\.currentMP3Perm\ =\ \'(.*)\'\;",
            "video": "RJ\.videoPermlink\ =\ \'(.*)\'\;"
        }
        def download_file_rj(music_or_video, file_type, regex_file, ch_actions):
            context.bot.send_message(chat_id=chat_id, text="کمی صبر کنید...")
            if res != "inv":
                web = Browser()
                web.go_to(url)
                s = web.get_page_source()
                web.close_current_tab()
                soup = BeautifulSoup(s, 'html.parser')
                # finde mp3 link
                file_name = str(re.findall(fr"{regex_file}", str(soup)))
                file_name = file_name.replace("['", "")
                file_name = file_name.replace("']", "")
                file_url = f"https://host2.rj-mw1.com/{file_type}{file_name}.mp{music_or_video}"
                req = urllib.request.Request(file_url)
                with urllib.request.urlopen(req) as response:
                    the_file_url_page = str(response.read())
                if the_file_url_page != "b'Not found'":
                    wget.download(file_url, f'{file_name}.mp{music_or_video}')
                else:
                    try:
                        os.remove(f"{file_name}.mp{music_or_video}")
                    except:
                        pass
                    file_url = f"https://host1.rj-mw1.com/{file_type}{file_name}.mp{music_or_video}"
                    wget.download(file_url, f'{file_name}.mp{music_or_video}')
                file_caption = str(file_name) #name fixed
                file_caption = file_caption.replace("-"," ")
                if str(file_name) == "[]":
                    context.bot.send_chat_action(chat_id, ChatAction.TYPING)
                    context.bot.send_message(chat_id=chat_id, text="لینک اشتباه است. \n\n لطفا لینک آهنگ یا موزیک ویدیوی مورد نظر را از رادیو جوان بفرستید.")
                else:
                    if ch_actions == "music":
                        context.bot.send_chat_action(chat_id, ChatAction.UPLOAD_AUDIO)
                        context.bot.send_audio(chat_id=chat_id, audio=open(f"./{file_name}.mp{music_or_video}", "rb"), caption=f"{file_caption}")
                    elif ch_actions == "video":
                        context.bot.send_chat_action(chat_id, ChatAction.UPLOAD_VIDEO)
                        context.bot.send_video(chat_id=chat_id, video=open(f"./{file_name}.mp{music_or_video}", "rb"), caption=f"{file_caption}")

                if os.path.exists(f"{file_name}.mp{music_or_video}"):
                    os.remove(f"{file_name}.mp{music_or_video}")
        if what_is_link_type == url_check_regex_podcast:
            context.bot.send_message(chat_id=chat_id, text="به دلیل محدودیت ارسال فایل های حجم بالا توسط ربات ها از سمت تلگرام ، امکان ارسال پادکست وجود ندارد...")
        elif what_is_link_type == url_check_regex_podcast_app:
            context.bot.send_message(chat_id=chat_id, text="به دلیل محدودیت ارسال فایل های حجم بالا توسط ربات ها از سمت تلگرام ، امکان ارسال پادکست وجود ندارد...")
        elif what_is_link_type == url_check_regex:
            download_file_rj("3",files_url["music"],regex_music_and_video["music"], "music")
        elif what_is_link_type == url_check_regex_app:
            download_file_rj("3",files_url["music"],regex_music_and_video["music"], "music")
        elif what_is_link_type == url_check_regex_playlist:
            web = Browser()
            web.go_to(url)
            play_list_source_page = web.get_page_source()
            web.close_current_tab()
            soup_playlist = BeautifulSoup(play_list_source_page, "html.parser")
            list_artists_playlist = soup_playlist.findAll("span", {"class": "artist"})
            list_songs_playlist = soup_playlist.findAll("span", {"class": "song"})
            playlist_count = 0
            context.bot.send_message(chat_id=chat_id, text="🔴 توجه 🔴 : \n\n ممکن است برخی آهنگ های موجود در پلی لیست ناقص فرستاده شوند و یا فرستاده نشود و پیام لینک اشتباه است نمایش داده شود . در صورت نیاز بعد از اتمام دانلود پلی لیست و مشاهده پیام :)  لینک آهنگ فرستاده نشده یا خراب را از اپلیکیشن یا وب سایت رادیو جوان ارسال کنید.🌷🌹")
            for artists in list_artists_playlist:
                re_artists = re.findall(r"(?=>).*(?=<)", str(artists))
                re_songs = re.findall(r"(?=>).*(?=<)", str(list_songs_playlist[playlist_count]))
                url = f"www.radiojavan.com/mp3s/mp3/{re_artists[0]}-{re_songs[0]}"
                playlist_count += 1
                url = url.replace(" ", "-")
                url = url.replace("['>", "")
                url = url.replace("']", "")
                url = url.replace(">", "")
                download_file_rj("3", files_url["music"], regex_music_and_video["music"], "music")

        elif what_is_link_type == url_check_regex_playlist_app:
            web = Browser()
            web.go_to(url)
            play_list_source_page = web.get_page_source()
            web.close_current_tab()
            soup_playlist = BeautifulSoup(play_list_source_page, "html.parser")
            list_artists_playlist = soup_playlist.findAll("span", {"class": "artist"})
            list_songs_playlist = soup_playlist.findAll("span", {"class": "song"})
            playlist_count = 0
            context.bot.send_message(chat_id=chat_id,
                                     text="🔴 توجه 🔴 : \n\n ممکن است برخی آهنگ های موجود در پلی لیست ناقص فرستاده شوند و یا فرستاده نشود و پیام لینک اشتباه است نمایش داده شود . در صورت نیاز بعد از اتمام دانلود پلی لیست و مشاهده پیام :)  لینک آهنگ فرستاده نشده یا خراب را از اپلیکیشن یا وب سایت رادیو جوان ارسال کنید.🌷🌹")
            for artists in list_artists_playlist:
                re_artists = re.findall(r"(?=>).*(?=<)", str(artists))
                re_songs = re.findall(r"(?=>).*(?=<)", str(list_songs_playlist[playlist_count]))
                url = f"www.radiojavan.com/mp3s/mp3/{re_artists[0]}-{re_songs[0]}"
                playlist_count += 1
                url = url.replace(" ", "-")
                url = url.replace("['>", "")
                url = url.replace("']", "")
                url = url.replace(">", "")
                download_file_rj("3", files_url["music"], regex_music_and_video["music"], "music")
        elif what_is_link_type == url_check_regex_video_app:
            try:
                context.bot.send_message(chat_id=chat_id, text="متاسفانه به دلیل محدودیت حجم آپلود فایل توسط ربات ها از سمت تلگرام ، موزیک ویدیو فقط با کیفیت 480p LQ برایتان آپلود خواهد شد . \n\n منتظر دریافت موزیک ویدیو باشید...")
                download_file_rj("4", files_url["video_lq"], regex_music_and_video["video"], "video")
            except:
                pass
        elif what_is_link_type == url_check_regex_video:
            try:
                context.bot.send_message(chat_id=chat_id, text="متاسفانه به دلیل محدودیت حجم آپلود فایل توسط ربات ها از سمت تلگرام ، موزیک ویدیو فقط با کیفیت 480p LQ برایتان آپلود خواهد شد .\n\n منتظر دریافت موزیک ویدیو باشید...")
                download_file_rj("4", files_url["video_lq"], regex_music_and_video["video"], "video")
            except:
                pass
        context.bot.send_message(chat_id=chat_id, text=":)")
        break
Example #10
0
class Spotibot(threading.Thread):

    # List of accounts the bot can use
    accounts: []

    # URL of the song to be played
    song: str

    # The player which open a browser window
    player: Browser

    # Time how long the song should be played in average in seconds
    time_to_play: int

    # Time of the tolerance in seconds (needed for human like behaviour)
    tolerance: int

    # Id of the bot
    bot_id: int

    # Init of the bot by setting the parameters of the bot
    def __init__(self, accounts: [], song: str, bot_id: int, time_to_play: int, tolerance: int):
        threading.Thread.__init__(self)
        self.player = Browser()
        self.song = song
        self.accounts = accounts
        self.bot_id = bot_id
        self.time_to_play = time_to_play
        self.tolerance = tolerance
        self.daemon = True

    # Run method which executes if the Thread is getting started
    def run(self):
        self.play()

    # While bot is active concurrently login, play and logout with the given accounts
    def play(self):
        current_player = self.player
        while True:
            for acc in self.accounts:
                self.login(acc)

                # Press "play"
                current_player.click(classname="_11f5fc88e3dec7bfec55f7f49d581d78-scss")

                # Play song for a calculated time
                sleep(self.play_like_a_human(self.time_to_play, self.tolerance))
                self.logout()

    # Login to a given Spotify account
    def login(self, login_data: str):
        username = login_data.split(",")[0]
        password = login_data.split(",")[1]
        current_player = self.player
        current_player.go_to(self.song)
        sleep(2)
        current_player.click(text="ANMELDEN")
        sleep(2)
        current_player.type(username, id="login-username")
        current_player.type(password, id="login-password")
        sleep(2)
        current_player.press(current_player.Key.ENTER)
        sleep(2)

    # Logout from the current account
    def logout(self):
        current_player = self.player
        current_player.click(classname="_34098cfd13d48e2910679f35aea2c377-scss")
        sleep(2)
        current_player.click(text="Abmelden")
        sleep(2)

    # Calculate a random time in seconds for a given time with a given tolerance
    def play_like_a_human(self, time_to_play: int, tolerance: int):
        return random.randint(time_to_play - tolerance, time_to_play + tolerance)

    # Close the current tab
    def terminate(self):
        self.player.close_current_tab()