-
Notifications
You must be signed in to change notification settings - Fork 0
/
sound_scraper.py
35 lines (24 loc) · 952 Bytes
/
sound_scraper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# import bs4
# import requests
# import numpy as np
# mp3_links = []
# for i in range(10):
# hostname = "https://www.myinstants.com"
# url = "%s/trending/us/?page=%d" % (hostname, i)
# print(mp3_links)
# response = requests.get(url)
# search_page = bs4.BeautifulSoup(response.text, features="lxml")
# buttons = search_page.find_all("div", {"class": "instant"})
# for button in buttons:
# path = button.find("a")["href"]
# sound_url = hostname + path
# response = requests.get(sound_url)
# sound_page = bs4.BeautifulSoup(response.text, features="lxml")
# for a in sound_page.find_all("a"):
# if a["href"][-4:] == ".mp3":
# mp3_links.append(hostname + a["href"])
# break
# np.savetxt("mp3_links.txt", np.array(mp3_links), fmt="%s")
import vlc
p = vlc.MediaPlayer("https://www.myinstants.com/media/sounds/movie_1.mp3")
p.play()