Esempio n. 1
0
def action(text):
    if text.find("YouTube") != -1:
        search_term = text[text.index("play") + 4:text.index("on YouTube")]
        got, dur = get_youtube(search_term)
        list = [got, dur]
        speak("playing" + search_term + "on youtube")
        push("youtube", list)

    elif text.find("turn on the lights") != -1:
        rqst.get("http://192.168.1.150:91/?socket=1On")
        speak("turning on lights")

    elif text.find("turn off the lights") != -1:
        rqst.get("http://192.168.1.150:91/?socket=1Off")
        speak("turning off lights")

    elif text.find("tell me something about") != -1:
        search_wiki = text[text.index("tell me something about ") +
                           len("tell me something about"):]
        got_wiki = wiki(search_wiki)
        img = find_image(search_wiki)

        to_send = [got_wiki, img]
        push("wiki", to_send)
        speak(got_wiki)

    elif text.find("show me a picture of") != -1:
        search_image = text[text.index("show me a picture of") +
                            len("show me a picture of"):].replace(" ", "")
        print(search_image)
        push("images", find_image(search_image))
        speak("ok! heres how" + search_image + "looks ")

    elif text.find("click a picture ") != -1:
        #click_picture()
        pass

    elif text.find("play") != -1:
        global search_music
        search_music = text[text.index("play") + len("play"):]
        speak("playing" + search_music)
        push("music", search_music)
        music_play(search_music)
        got, dur = get_youtube(search_music)
        time.sleep(dur)

    elif text.find("stop") != -1:
        mixer.music.pause()
        push("stop", "")

    elif text.find("continue") != -1:
        mixer.music.unpause()

    else:
        got = hound(text)
        push("text", got)
        speak(got)
Esempio n. 2
0
def gather_data(data_params):
    with open('config/chromedriver.json') as fh:
        chromedriver_path = json.load(fh)['chromedriver_path']

    print("Scraping data...")
    scrape_data(chromedriver_path, data_params['all_links_pickle_path'],
                data_params['fbworkouts_path'], data_params['comments_path'])
    print("Scraping done.")

    print("Querying Youtube API...")
    get_youtube(data_params['fbworkouts_path'],
                data_params['youtube_csv_path'])
    print("Querying done")
Esempio n. 3
0
def main():
    args = _args()
    parse_url = lp3_parser.URL.format(notowanie=args.notowanie, rok=args.rok)
    yt = youtube.get_youtube(args)

    f = urllib.request.urlopen(parse_url)
    parser = lp3_parser.LP3HTMLParser()
    parser.feed(f.read().decode(f.headers.get_content_charset()))
    video_ids = []
    for chl in parser.chart_list:
        if not chl:
            continue
        video = youtube.youtube_search(yt,
                                       q=' '.join(chl).strip().replace(
                                           '\n', ''))
        items = video.get('items', None)
        if items is not None:
            print('{}: {}'.format(' '.join(chl).strip().replace('\n', ''),
                                  items[0]['snippet']['title']))
            videoId = items[0]['id']['videoId']
            video_ids.append((videoId, items[0]['snippet']['title']))

    print(('Found {} videos'.format(len(video_ids))))
    playlist = youtube.create_playlist(
        yt, 'LP3 - {} ({})'.format(args.notowanie, args.rok),
        'Notowanie {notowanie} ({rok}) listy przebojów Trójki {url}'.format(
            notowanie=args.notowanie, rok=args.rok, url=parse_url))
    if playlist:
        print(('Playlist id: {}'.format(playlist['id'])))
        for video_id, title in video_ids:
            print(('Added {} - {}'.format(video_id, title)))
            youtube.add_video_to_playlist(yt, video_id, playlist['id'])
Esempio n. 4
0
def get_single_actor(id):
    from anime import get_layers_deep_string
    actor = actor_single(id).getCleanDict()
    actor.pop('_sa_instance_state')
    actorName = actor['first_name'] + " " + actor['last_name']
    youtube_ids = get_youtube(actorName)
    return render_template('actor_single.html', youtube_ids=youtube_ids, category="Actors", actor=actor, shows=show_by_actor(id), layer_string = get_layers_deep_string(1))
Esempio n. 5
0
def get_single_studio(id):
    from anime import get_layers_deep_string
    studio = studio_single(id).getCleanDict()
    studio.pop('_sa_instance_state')    
    studioName = studio['name']
    youtube_ids = get_youtube(studioName)
    return render_template('studio_single.html', youtube_ids=youtube_ids, studio=studio, id = id, shows=anime_studio(id), layer_string = get_layers_deep_string(1))
Esempio n. 6
0
def get_single_show(id):
    from anime import get_layers_deep_string
    show = anime_single(id).getCleanDict()
    show.pop('_sa_instance_state')
    showName = show['title_english']
    youtube_ids = get_youtube(showName)
    return render_template('show_single.html', youtube_ids=youtube_ids, anime=show, id = id, studio_mapping=studio_table_map(), actor_mapping=character_actor_mapping(id), layer_string = get_layers_deep_string(1))
Esempio n. 7
0
def play_music(music_name):
    yt_name = get_youtube(music_name)[0]
    ydl_opts = {
        'format':
        'bestaudio/best',
        'postprocessors': [{
            'key': 'FFmpegExtractAudio',
            'preferredcodec': 'wav',
            'preferredquality': '192',
        }],
    }

    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        ydl.download(['https://www.youtube.com/watch?v=' + yt_name])

    os.rename('_-' + yt_name + '.wav', "music/" + music_name + ".wav")

    push("music", music_name)
Esempio n. 8
0
def action(text):
    if text.find("YouTube") != -1:
        search_term = text[text.index("play") + 4:text.index("on YouTube")]
        got, dur = get_youtube(search_term)
        list = [got, dur]
        speak("playing" + search_term + "on youtube")
        push("youtube", list)

    elif text.find("turn on lights") != -1:
        rqst.get("http://192.168.1.150:91/?socket=1On")
        speak("turning on lights")

    elif text.find("turn off lights") != -1:
        rqst.get("http://192.168.1.150:91/?socket=1Off")
        speak("turning off lights")

    elif text.find("tell me something about") != -1:
        search_wiki = text[text.index("tell me something about") +
                           len("tell me something about"):]
        got_wiki = wiki(search_wiki)
        push("wiki", got_wiki)
        speak(got_wiki)

    elif text.find("show me a picture of") != -1:
        search_image = text[text.index("show me a picture of") +
                            len("show me a picture of"):].replace(" ", "")
        print(search_image)
        push("images", find_image(search_image))
        speak("ok! heres how" + search_image + "looks ")

    elif text.find("click a picture ") != -1:
        click_picture()

    elif text.find("play") != -1:
        global search_music
        search_music = text[text.index("play") + len("play"):]
        speak("playing" + search_music)
        push("music", search_music)
        worker().start()

    else:
        speak("sorry I don't know that one")
Esempio n. 9
0
 def run(self):
     t1 = threading.Thread(target=play_music(search_music))
     t1.start()
     got, dur = get_youtube(search_music)
     time.sleep(dur)
Esempio n. 10
0
def main():
    #d = get_updates()
    while True:
        answer = get_message()

        if answer != None:
            chat_id = answer["chat_id"]
            text = answer["text"]
        
            if text == "/btc":
                send_message(chat_id, get_btc())

            elif text == "/btc@JeffFosterUKBot":
                send_message(chat_id, get_btc())
            
            elif text == "/creator":
                send_message(chat_id, get_creator())
            
            elif text == "/creator@JeffFosterUKBot":
                send_message(chat_id, get_creator())

            elif text == "/roll":
                send_message(chat_id, get_roll())

            elif text == "/roll@JeffFosterUKBot":
                send_message(chat_id, get_roll())
        
            elif text == "/ask":
                send_message(chat_id, get_ask())

            elif text == "/ask@JeffFosterUKBot":
                send_message(chat_id, get_ask())

            elif text == "/discord":
                send_message(chat_id, get_discord())

            elif text == "/discord@JeffFosterUKBot":
                send_message(chat_id, get_discord())

            elif text == "/group":
                send_message(chat_id, get_group())

            elif text == "/group@JeffFosterUKBot":
                send_message(chat_id, get_group())

            elif text == "/group_steam":
                send_message(chat_id, get_groupsteam())

            elif text == "/group_steam@JeffFosterUKBot":
                send_message(chat_id, get_groupsteam())

            elif text == "/instagram":
                send_message(chat_id, get_instagram())

            elif text == "/instagram@JeffFosterUKBot":
                send_message(chat_id, get_instagram())

            elif text == "/steam":
                send_message(chat_id, get_steam())

            elif text == "/steam@JeffFosterUKBot":
                send_message(chat_id, get_steam())

            elif text == "/sub":
                send_message(chat_id, get_sub())

            elif text == "/sub@JeffFosterUKBot":
                send_message(chat_id, get_sub())

            elif text == "/trade":
                send_message(chat_id, get_trade())

            elif text == "/trade@JeffFosterUKBot":
                send_message(chat_id, get_trade())

            elif text == "/twitch":
                send_message(chat_id, get_twitch())

            elif text == "/twitch@JeffFosterUKBot":
                send_message(chat_id, get_twitch())

            elif text == "/vk":
                send_message(chat_id, get_vk())

            elif text == "/vk@JeffFosterUKBot":
                send_message(chat_id, get_vk())

            elif text == "/youtube":
                send_message(chat_id, get_youtube())

            elif text == "/youtube@JeffFosterUKBot":
                send_message(chat_id, get_youtube())

            elif "Бот," in text:
                send_message(chat_id, get_botsay())


        else:
            continue


        sleep(2)
Esempio n. 11
0
from youtube import get_recent_videos as get_youtube
from navertv import get_recent_videos as get_navertv
import pandas as pd
import os

print("Checking for new videos of ohmygirl ...")
path = os.getcwd() + "/chromedriver.exe"
path = path.replace("\\", "/")

youtube_list = get_youtube(path)
navertv_list = get_navertv(path)

try:

    youtube = pd.DataFrame(youtube_list)
    youtube.columns = ["title", "link"]
    youtube.to_html("오마이걸_유튜브.html")

    navertv = pd.DataFrame(navertv_list)
    navertv.columns = ["title", "link"]
    navertv.to_html("오마이걸_네이버tv.html")

    print("Done! You can see html files in your directory.")
except:
    print('Error!')
Esempio n. 12
0
 def refresh(self):
 	'''
 	used to refresh videos when needed!
 	'''
 	self.videos = yt.get_youtube()
Esempio n. 13
0
    def __init__(self):
    	
    	self.videos = yt.get_youtube()

        self.ID = id(self)
Esempio n. 14
0
def location(query):
    list = get_youtube(query)
    return jsonify(results=list)