Skip to content

Instantly share code, notes, and snippets.

@BababaBlue
Created December 30, 2018 03:44
Show Gist options
  • Save BababaBlue/8f1784a6ddc7bedcd87de3bee5073f2c to your computer and use it in GitHub Desktop.
Save BababaBlue/8f1784a6ddc7bedcd87de3bee5073f2c to your computer and use it in GitHub Desktop.
this was used to get the website urls
import mysql.connector
a=[]
b=[]
with open('list.txt') as f:
for row in f:
row=row.strip('\n')
a.append(row)
mydb = mysql.connector.connect(
host="#",
user="#",
passwd="#",
database="#"
)
mycursor = mydb.cursor()
for tablename in a:
tablename1=str(tablename)
mycursor.execute("SELECT option_value FROM %s WHERE option_id=1"%tablename1)
myresult = mycursor.fetchall()
for x in myresult:
b.append(x)
with open("websites.txt", "w") as f:
for s in b:
f.write(str(s) +"\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment