Created
November 15, 2020 04:25
-
-
Save mooware/1e5c901c585ce8110f435c178764e203 to your computer and use it in GitHub Desktop.
Download games2jolly games for Flashpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os.path | |
import sqlite3 | |
import urllib.request | |
def main(): | |
db = sqlite3.connect(os.path.join('Data', 'flashpoint.sqlite')) | |
cur = db.execute("SELECT launchCommand FROM game WHERE launchCommand LIKE '%games2jolly%'") | |
urls = [s for (s,) in cur.fetchall()] | |
for index, url in enumerate(urls): | |
print('{}/{} {}'.format(index + 1, len(urls), url)) | |
urlpath = os.path.normpath(url.split('://')[1]) | |
filepath = os.path.join("Server", "htdocs", urlpath) | |
try: | |
with urllib.request.urlopen(url) as req: | |
with open(filepath, 'wb') as f: | |
f.write(req.read()) | |
except: | |
print('failed to get {}'.format(url)) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment