son-link / am-altscraper

1 stars 1 forks source link

please! port to python3 #1

Open ftoledo opened 3 years ago

ftoledo commented 3 years ago

hi! I'm search for alternative scraper for attract mode i just found your project. I use debian and python2 will be deprecated. Can you port your script to python3 ? thanks!!

son-link commented 3 years ago

The truth is that I abandoned this project a few years ago, but yes, I can port it to Python 3. Now I'm on holidays and I have some projects in hand, but I think I can make time for it ;)

ftoledo commented 3 years ago

Great News!, thanks! i'm not python coder but with this changes, begin work. Then i notice that have a user password credentials hardcoded at the scraper url... This settings must be passed to script via cmdops or config file.

diff --git a/am-altscraper.py b/am-altscraper.py
index 3f45efd..83af30b 100755
--- a/am-altscraper.py
+++ b/am-altscraper.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #
 #      am-altscraper.py
@@ -25,12 +25,14 @@
 #  

 import sys, os, hashlib
-from urllib import ContentTooShortError, urlretrieve
+from urllib.error import ContentTooShortError
+from urllib.request import urlretrieve
 import json, binascii, requests, argparse, collections, glob, xmltodict
 import systems
+from importlib import reload

 reload(sys)
-sys.setdefaultencoding("utf-8")
+# sys.setdefaultencoding("utf-8")

 def CRC32_from_file(filename):
        buf = open(filename,'rb').read()
substring commented 1 year ago

Hi!

I've ported it to python3, and working on a bunch of enhancements. See my fork.