Searching Stores for Musician Signed Merch [Automate Your Autographs – Series 3]

Artists frequently offer signed merch on their online music stores. If you are a big fan of musicians, it can be hard to keep track of them all and very time consuming to keep checking their websites just in case they decide to offer autographs. The third installment of Automate Your Autographs addresses that problem. It takes your favorite artists and does all the tedious checking for you 24 hours a day.

The program will then search Google for their stores as well as Looney Tunes Record Store and Newbury Comics which often sell signed CDs.

Join Us on Facebook!

Log in or sign up to view
See posts, photos and more on Facebook.

Three Steps to Check Stores for Autographs

Simple Prep-Work

  1. Create two text files. The first will be for the artists you want to monitor. Just put the singer or band’s name in separated by a new line. The second is a list of shop URLs (not the main page but where they sell merch). You can populate either list or both but you will have to have both documents even if one is blank.

Just a Few Clicks

2. Unzip the program and double click the .exe file to run it.

Easy to Use

3. You will get a black box which prompts you to enter information. First type in the full file path to your text file with artist’s names. Then do the same for the list of URLs. The results will start rolling in automatically after that.

Easy Step-By-Step Usage Video

Source Code

import requests
from googlesearch import search
import datetime
import time
import urllib3

urllib3.disable_warnings()

s = requests.Session()
a = requests.adapters.HTTPAdapter(max_retries=5)
b = requests.adapters.HTTPAdapter(max_retries=5)
s.mount('http://', a)
s.mount('https://', b)

headers = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
                         "Chrome/78.0.3904.108 Safari/537.36"}
try:
    Artists = []
    ArtistsFile = input('Please enter the name of the .txt file containing your artist names with complete file path. ')
    Artists1 = open(ArtistsFile, "r")
    for x in Artists1:
        Artists.append(x.strip("\n"))

except Exception as e:
    print("type error: " + str(e))
    time.sleep(1)
    quit()
try:
    Shops = []
    ShopFile = input('Please enter the name of the .txt file containing the shop urls with complete file path. ')
    Shops1 = open(ShopFile, "r")
    for x in Shops1:
        Shops.append(x.strip("\n"))

except Exception as e:
    print("type error: " + str(e))
    time.sleep(1)
    quit()

OldHits = []

Hits = []

Counter = 0

while True:
    print('Searching Google for web pages...')
    for x in Artists:
        try:
            query = x + '(merch,store,shop)'
            for j in search(query):
                if 'redbubble' not in j:
                    page = s.get(j, headers=headers, verify=False)
                    if ('AUTOGRAPH' or ' SIGNED ') in page.text.upper():
                        print(repr(j) + ' success')

                    else:
                        pass
        except Exception as e:
            print("type error: " + str(e))
            time.sleep(5)
            pass
    print('Searching Newburycomics for artists...')
    Site = r'https://www.newburycomics.com/collections/autographed-cds'
    page2 = requests.get(Site, headers=headers, verify=False)
    for x in Artists:
        try:
            if x.upper() in page2.text.upper():
                print(str(x) + ' at newburycomics.com')

            else:
                pass
        except Exception as e:
            print("type error: " + str(e))
            time.sleep(7)
            pass
    print('Searching Looneytunes for artists...')
    Site2 = r'https://www.looneytuneslongisland.com/autographeditems?page=2'
    page3 = requests.get(Site2, headers=headers, verify=False)
    for x in Artists:
        try:
            if x.upper() in page3.text.upper():
                print(str(x) + ' at ltcds.com')

            else:
                pass
        except Exception as e:
            print("type error: " + str(e))
            time.sleep(7)
            pass
    # Takes the list of merch pages from Shops and searches each page for "signed" or "autograph"
    # Hits are added to the Hits list and compared to OldHits list which are the hits from the previous
    # iteration of the loop.
    print(r"Searching Artist's pages for merch...")
    for x in Shops:
        try:
            SiteX = x
            pageX = requests.get(SiteX, headers=headers, verify=False)
            if (' SIGNED ' or 'AUTOGRAPH') in pageX.text.upper():
                Hits.append(x)
            else:
                pass
        except Exception as e:
            print("type error: " + str(e))
            time.sleep(7)
            pass
    # I only want the full list of hits printed out once. After that it only becomes important to see changes between
    # Hits and OldHits.
    if Counter > 0:
        print(set(Hits))
    for z in set(Hits):
        try:
            if z not in set(OldHits):
                print('******** ' 'NEW HIT AT ' + str(z) + ' *********')

            else:
                pass
        except Exception as e:
            print("type error: " + str(e))
            time.sleep(7)
            pass
    OldHits = list(set(Hits))
    print('Last check ' + str(datetime.datetime.now()))
    s.cookies.clear()
    Counter += 1
    time.sleep(120)

Executable File for Windows Users

Published by Tim Santens

I am a gamer and autograph collector. I love writing about both and sharing the stories I find.

Leave a Reply

Your email address will not be published.

I accept the Privacy Policy