diff --git a/.gitignore b/.gitignore
index e2d1dc0..e966af1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,5 @@ build/
src/settings.cfg
tab_scraper/
release_notes.txt
+src copy/utils.py
+.DS_Store
diff --git a/README.md b/README.md
index 0803bd2..fac450a 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,16 @@
# tab-scraper
-An interface for downloading guitar tabs from Ultimate Guitar.
+
+An interface for downloading guitar tabs from Ultimate Guitar. Please check the news at the bottom.
![ui-image](screens/ui-screen.png)
Get screenshots of Guitar Chords, Tabs, Bass Tabs and Ukulele Chords with no clutter.
-Chords | Tab
-:------:|:------|
-![chords](screens/feather-chords.png) | ![tab](screens/sultans-tab.png)
+| Chords | Tab |
+| :---------------------------------: | :---------------------------- |
+| ![chords](screens/feather-chords.png) | ![tab](screens/sultans-tab.png) |
-You can also download GuitarPro and PowerTab files.
+You can also download GuitarPro and PowerTab files. ` `
All files are sorted into directories for quick and easy access.
### Prerequisites
@@ -25,17 +26,18 @@ All files are sorted into directories for quick and easy access.
#### Command Line
-1. Open settings.cfg and enter in the root directory where you would like all tabs to be stored e.g. username/Music/Tabs/
-2. Download [Geckodriver](https://github.com/mozilla/geckodriver/releases) and put the geckodriver executable into the src directory.
+1. Open settings.cfg and enter in the root directory where you would like all tabs to be stored e.g. ``username/Music/Tabs/ ``
+2. Download [Geckodriver](https://github.com/mozilla/geckodriver/releases) and put the geckodriver executable into the ``src`` directory.
3. Run `pip install -r requirements.txt`
-4. run `python tab_scraper.py` from src directory.
+4. run `python tab_scraper.py` from ``src`` directory.
### Built With
- Python 3
-
- [PyQT5](https://pypi.org/project/PyQt5/)
-
- [Selenium](https://selenium-python.readthedocs.io/)
-
- [Geckodriver](https://github.com/mozilla/geckodriver/releases)
+
+### News
+
+I am assuming the original author has given up on this project, as I myself forked it and began working on it over a year ago (and also promptly disappeared from the project) and there have been no updates since. I'll do my best to get this working again on all platforms, but I cannot make any promises. I'll likely take the existing GUI and rebuild it using libraries I'm familiar with, and build new logic to go in the back end as well. Keep an eye out for updates.
diff --git a/jsonout.txt b/jsonout.txt
new file mode 100644
index 0000000..2230b86
--- /dev/null
+++ b/jsonout.txt
@@ -0,0 +1,134 @@
+[
+ {
+ "artist_name": "TesseracT",
+ "artist_url": "/artist/tesseract_29262",
+ "song_name": "Juno",
+ "marketing_type": "official",
+ "tab_url": "https://www.ultimate-guitar.com/pro/?utm_source=UltimateGuitar&utm_medium=Search&utm_campaign=UG+Search&utm_content=Official+Version&artist=TesseracT&song=juno&tab_id=2433301",
+ "device": null,
+ "app_link": "//www.ultimate-guitar.com/send?ug_from=yozio_splash&url=https://play.google.com/store/apps/details?id=com.ultimateguitar.tabs&ug_campaign=UG_TPAndroid_SearchTpLink_SearchPage_mobile0&referrer=utm_campaign=UG_TPAndroid_SearchTpLink_SearchPage_mobile0",
+ "highlight": {
+ "song_name": [
+ [
+ 0,
+ 4
+ ]
+ ],
+ "artist_name": [
+ [
+ 0,
+ 9
+ ]
+ ]
+ }
+ },
+ {
+ "artist_name": "TesseracT",
+ "artist_url": "/artist/tesseract_29262",
+ "song_name": "Juno",
+ "marketing_type": "TabPro",
+ "rating": 4.8404,
+ "votes": 7,
+ "tab_url": "https://www.ultimate-guitar.com/pro/?utm_source=UltimateGuitar&utm_medium=Search&utm_campaign=UG+Search&artist=TesseracT&song=juno&tab_id=2425607",
+ "device": null,
+ "app_link": "//www.ultimate-guitar.com/send?ug_from=yozio_splash&url=https://play.google.com/store/apps/details?id=com.ultimateguitar.tabs&ug_campaign=UG_TPAndroid_SearchTpLink_SearchPage_mobile0&referrer=utm_campaign=UG_TPAndroid_SearchTpLink_SearchPage_mobile0",
+ "highlight": {
+ "song_name": [
+ [
+ 0,
+ 4
+ ]
+ ],
+ "artist_name": [
+ [
+ 0,
+ 9
+ ]
+ ]
+ }
+ },
+ {
+ "id": 2390557,
+ "song_id": 2743409,
+ "song_name": "Juno",
+ "artist_id": 29262,
+ "artist_name": "TesseracT",
+ "type": "Pro",
+ "part": "",
+ "version": 1,
+ "votes": 10,
+ "rating": 4.80031,
+ "date": "1527099921",
+ "status": "approved",
+ "preset_id": 28177,
+ "tab_access_type": "public",
+ "tp_version": 1,
+ "tonality_name": "Fm",
+ "version_description": "Whole song transcription, all instruments, ambient guitar and lyrics included. Multiple notation/time signature interpretations for similar parts as it's quite ambiguous. The Tab Pro conversion by UG has a few weird things going on, and the lyrics don't align like in the original file, so keep that in mind.",
+ "verified": 0,
+ "recording": {
+ "is_acoustic": 0,
+ "tonality_name": "",
+ "performance": null,
+ "recording_artists": []
+ },
+ "artist_url": "https://www.ultimate-guitar.com/artist/tesseract_29262",
+ "tab_url": "https://tabs.ultimate-guitar.com/tab/tesseract/juno-guitar-pro-2390557"
+ },
+ {
+ "id": 2395961,
+ "song_id": 2743409,
+ "song_name": "Juno",
+ "artist_id": 29262,
+ "artist_name": "TesseracT",
+ "type": "Pro",
+ "part": "",
+ "version": 2,
+ "votes": 0,
+ "rating": 0,
+ "date": "1528113155",
+ "status": "approved",
+ "preset_id": 28177,
+ "tab_access_type": "public",
+ "tp_version": 2,
+ "tonality_name": "",
+ "version_description": "",
+ "verified": 0,
+ "recording": {
+ "is_acoustic": 0,
+ "tonality_name": "",
+ "performance": null,
+ "recording_artists": []
+ },
+ "artist_url": "https://www.ultimate-guitar.com/artist/tesseract_29262",
+ "tab_url": "https://tabs.ultimate-guitar.com/tab/tesseract/juno-guitar-pro-2395961"
+ },
+ {
+ "id": 2425607,
+ "song_id": 2743409,
+ "song_name": "Juno",
+ "artist_id": 29262,
+ "artist_name": "TesseracT",
+ "type": "Pro",
+ "part": "",
+ "version": 3,
+ "votes": 7,
+ "rating": 4.8404,
+ "date": "1531581826",
+ "status": "approved",
+ "preset_id": 28177,
+ "tab_access_type": "public",
+ "tp_version": 3,
+ "tonality_name": "F",
+ "version_description": "I saw TesseracT in Paris to be sure of finger placement.",
+ "verified": 0,
+ "recording": {
+ "is_acoustic": 0,
+ "tonality_name": "",
+ "performance": null,
+ "recording_artists": []
+ },
+ "artist_url": "https://www.ultimate-guitar.com/artist/tesseract_29262",
+ "tab_url": "https://tabs.ultimate-guitar.com/tab/tesseract/juno-guitar-pro-2425607"
+ }
+]
\ No newline at end of file
diff --git a/new/utilities.py b/new/utilities.py
new file mode 100644
index 0000000..d3a455c
--- /dev/null
+++ b/new/utilities.py
@@ -0,0 +1,81 @@
+# To do:
+# Check for updates in search results page on UG
+# Build new GUI (likely using tkinter, as I'm not that familiar with PyQt5)
+# Build functions to search on UG and parse search results using updated Selenium
+# Connect GUI and utility functions
+import os,sys,json
+import subprocess
+import sys
+from tqdm import tqdm
+def install(package):
+ subprocess.check_call([sys.executable, "-m", "pip", "install", package])
+fail = False
+try:
+ from bs4 import BeautifulSoup as bs
+except ImportError:
+ fail = True
+ print(f'WARNING: MODULE BeautifulSoup4 MISSING, ATTEMPTING TO INSTALL')
+ install('beautifulsoup4')
+from datetime import date, timedelta
+try:
+ from selenium import webdriver
+ from selenium.webdriver.chrome.service import Service
+except ImportError:
+ fail = True
+ print(f'WARNING: MODULE selenium MISSING, ATTEMPTING TO INSTALL')
+ install('selenium')
+from time import sleep
+try:
+ from webdriver_manager.chrome import ChromeDriverManager
+except ImportError:
+ fail = True
+ print(f'WARNING: MODULE webdriver-manager MISSING, ATTEMPTING TO INSTALL')
+ install('webdriver-manager')
+try:
+ import requests
+except ImportError:
+ fail = True
+ print(f'WARNING: MODULE requests MISSING, ATTEMPTING TO INSTALL')
+ install('requests')
+if fail == True:
+ print(f'WARNING: ONE OR MORE MODULES WERE MISSING AND HAVE BEEN INSTALLED. THE PROGRAM WILL NEED TO BE RE-RUN AS A RESULT.')
+ quit()
+# set up currentdir variable
+currentdir = os.path.dirname(os.path.realpath(__file__))
+parentdir = os.path.dirname(currentdir)
+sys.path.append(parentdir)
+# creating a simple logger
+logger = open(os.path.join(currentdir,'logfile.txt'),'w')
+# create a webdriver instance using selenium, set chrome options to headless to avoid a window popping up every time you scrape
+from selenium.webdriver.chrome.options import Options
+chrome_options = Options()
+# set chrome options "headless" to ensure a window doesn't pop up
+chrome_options.add_argument("--headless")
+# and the below line to simulate an actual browser window size
+chrome_options.add_argument("--window-size=1100,1000")
+# the below line instantiates the driver instance, with a simple webdriver check
+driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),options=chrome_options)
+# the below line gives us a useragent header to pretend to be a real browser
+driver.execute_cdp_cmd('Network.setUserAgentOverride', {"userAgent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.53 Safari/537.36'})
+
+
+
+SEARCH_URL = "https://www.ultimate-guitar.com/search.php?search_type=title&value={}"
+RESULTS_PATTERN = "\"\;results\"\;:(\[.*?\]),\"\;pagination\"\;"
+#RESULTS_PATTERN = "\"results\":(\[.*?\]),\"pagination\""
+RESULTS_COUNT_PATTERN = "\"\;tabs\"\;,\"\;results_count\"\;:([0-9]+?),\"\;results\"\;"
+#RESULTS_COUNT_PATTERN = "\"tabs\",\"results_count\":([0-9]+?),\"results\""
+DOWNLOAD_TIMEOUT = 15
+# retrieves a URL and returns a soup object
+def retrieve(url):
+ # retrieve the page using our driver instance
+ driver.get(url)
+ # sleep for 3 seconds to allow the page to fully load, and also to simulate human behavior
+ sleep(3)
+ # get the page source to scrape through for information
+ data = driver.page_source
+ # turn it into a soup object and return it
+ soup = bs(data, features="html.parser")
+ driver.close()
+ return soup
+
diff --git a/scrapetest.txt b/scrapetest.txt
new file mode 100644
index 0000000..04d9380
--- /dev/null
+++ b/scrapetest.txt
@@ -0,0 +1,1028 @@
+
+
+
+