Skip to content

Instantly share code, notes, and snippets.

@f13end
Created April 23, 2020 21:12
Show Gist options
  • Save f13end/ca91212c2c211670edb06120af301877 to your computer and use it in GitHub Desktop.
Save f13end/ca91212c2c211670edb06120af301877 to your computer and use it in GitHub Desktop.
Auto listen for Soundcloud
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
# chrome_options.add_argument("--disable-extensions")
# chrome_options.add_argument("--headless")
chrome_options.add_argument("--mute-audio")
chrome_options.add_argument('--ignore-certificate-errors')
# options.add_argument("--test-type")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--incognito")
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument("--verbose")
from time import sleep
counter = 0
musiclink = null
class SoundCloudbot:
def __init__(self):
self.driver = webdriver.Chrome(options=chrome_options)
def visit(self):
global counter
self.driver.get(
musiclink)
sleep(5)
click = self.driver.find_element_by_xpath('//*[@id="content"]/div/div[2]/div/div[2]/div[2]/div/div/div[1]/a')
click.click()
sleep(20)
self.driver.delete_all_cookies()
self.driver.quit()
counter += 1
print(counter)
while True:
bot = SoundCloudbot()
bot.visit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment