diff --git a/src/main/kotlin/bandcampdownloader/CollectionPageJSoup.kt b/src/main/kotlin/bandcampcollectiondownloader/BandcampCollectionDownloader.kt similarity index 100% rename from src/main/kotlin/bandcampdownloader/CollectionPageJSoup.kt rename to src/main/kotlin/bandcampcollectiondownloader/BandcampCollectionDownloader.kt diff --git a/src/main/kotlin/bandcampdownloader/DownloadPageSelenium.kt b/src/main/kotlin/bandcampdownloader/DownloadPageSelenium.kt deleted file mode 100644 index 7c04913..0000000 --- a/src/main/kotlin/bandcampdownloader/DownloadPageSelenium.kt +++ /dev/null @@ -1,54 +0,0 @@ -package bandcampdownloader - -import org.openqa.selenium.By -import org.openqa.selenium.WebDriver -import org.openqa.selenium.firefox.FirefoxDriver -import org.openqa.selenium.support.ui.ExpectedCondition -import org.openqa.selenium.support.ui.ExpectedConditions -import org.openqa.selenium.support.ui.WebDriverWait -import java.io.FileOutputStream -import java.net.URL -import java.nio.channels.Channels -import java.nio.channels.ReadableByteChannel - - - -fun main(args: Array<String>) { - System.setProperty("webdriver.gecko.driver", "/home/zerwan/Applications/geckodriver-v0.21.0-linux64/geckodriver"); - - val driver = FirefoxDriver() - val wait = WebDriverWait(driver, 10) - try { - driver.get("https://bandcamp.com/download?from=collection&payment_id=1994465229&sig=d36377b10094ec86c1bd41a5700bc7cd&sitem_id=17410034") - - // Find and click on format list toggle - val formatListToggle = driver.findElement(By.cssSelector(".item-format")) - formatListToggle.click() - - // Find and click and the Ogg format - val oggLocator = By.cssSelector(".formats-container ul li:nth-of-type(5)") - val ogg = driver.findElement(oggLocator) - wait.until(ExpectedConditions.elementToBeClickable(oggLocator)) - ogg.click() - - // Find the download link and retrieve URL - val locator = By.cssSelector("a.item-button") - wait.until(ExpectedConditions.elementToBeClickable(locator)) - val download = driver.findElement(locator) - val url = download.getAttribute("href") - - // Quit driver - driver.quit() - - // Download - val website = URL(url) - val rbc = Channels.newChannel(website.openStream()) - val fos = FileOutputStream("/home/zerwan/tmp/album.zip") - fos.channel.transferFrom(rbc, 0, java.lang.Long.MAX_VALUE) - println(url) - - } finally { - //Close the browser - driver.quit() - } -} \ No newline at end of file diff --git a/src/main/kotlin/bandcampdownloader/LoginSelenium.kt b/src/main/kotlin/bandcampdownloader/LoginSelenium.kt deleted file mode 100644 index 42f1ea9..0000000 --- a/src/main/kotlin/bandcampdownloader/LoginSelenium.kt +++ /dev/null @@ -1,42 +0,0 @@ -package bandcampdownloader - -import org.openqa.selenium.By -import org.openqa.selenium.firefox.FirefoxDriver -import org.openqa.selenium.support.ui.ExpectedConditions -import org.openqa.selenium.support.ui.WebDriverWait - -fun main(args: Array<String>) { - System.setProperty("webdriver.gecko.driver", "/home/zerwan/Applications/geckodriver-v0.21.0-linux64/geckodriver"); - val driver = FirefoxDriver() - val wait = WebDriverWait(driver, 600) - try { - driver.get("https://bandcamp.com/login") - - // Find and fill username field - val usernameField = driver.findElement(By.id("username-field")) - usernameField.sendKeys("oWbf1axApJRg8gRKlrE7U7ZDiooJJaXYHa5ZefM_bandcamp@bousse.fr") - - // Find and fill password field - val passwordField = driver.findElement(By.id("password-field")) - passwordField.sendKeys("y1Dh2kttnLZYeT5RuNkylmptY") - - // Find and press submit button - val button = driver.findElement(By.tagName("button")) - button.click() - - // Wait until login is done - wait.until(ExpectedConditions.titleContains("collection")) - - // Get resulting cookies - val cookies = driver.manage().cookies - println(cookies) - - // Quit driver - driver.quit() - - - } finally { - // Quit driver - driver.quit() - } -} \ No newline at end of file