Procházet zdrojové kódy

Some error improvements

notcammy před 7 roky
rodič
revize
be609718b7
3 změnil soubory, kde provedl 58 přidání a 2 odebrání
  1. 8 1
      pyinstalive/downloader.py
  2. 4 1
      pyinstalive/initialize.py
  3. 46 0
      requirements.txt

+ 8 - 1
pyinstalive/downloader.py

@@ -6,7 +6,7 @@ import subprocess
 import threading
 
 from instagram_private_api_extensions import live, replay
-from instagram_private_api import ClientError, ClientThrottledError
+from instagram_private_api import ClientError, ClientThrottledError, ClientConnectionError
 
 from .logger import log, seperator
 from .comments import CommentsDownloader
@@ -170,6 +170,13 @@ def get_user_info(user_to_record):
 	try:
 		user_res = instagram_api.username_info(user_to_record)
 		user_id = user_res.get('user', {}).get('pk')
+	except ClientConnectionError as e:
+		if "timed out" in str(e):
+			log('[E] Could not get information for "{:s}": The connection has timed out.'.format(user_to_record), "RED")
+		else:
+			log('[E] Could not get information for "{:s}".\n[E] Error message: {:s}\n[E] Code: {:d}\n[E] Response: {:s}'.format(user_to_record, str(e), e.code, e.error_response), "RED")
+		seperator("GREEN")
+		sys.exit(1)
 	except Exception as e:
 		log('[E] Could not get information for "{:s}".\n[E] Error message: {:s}\n[E] Code: {:d}\n[E] Response: {:s}'.format(user_to_record, str(e), e.code, e.error_response), "RED")
 		seperator("GREEN")

+ 4 - 1
pyinstalive/initialize.py

@@ -287,6 +287,7 @@ def run():
 	parser.add_argument('--noreplayx', help=argparse.SUPPRESS, metavar='IGNORE')
 
 	args, unknown = parser.parse_known_args()
+	
 	if unknown:
 		log("[E] The following invalid argument(s) were provided: ", "RED") 
 		log('', "GREEN") 
@@ -300,7 +301,8 @@ def run():
     args.password and not
     args.record and not
     args.info and not
-    args.config):
+    args.config and not
+    args.noreplays):
 		show_info(config)
 		sys.exit(0)
 	
@@ -308,6 +310,7 @@ def run():
 		new_config()
 		sys.exit(0)
 
+
 	if os.path.exists('pyinstalive.ini'):
 		try:
 			config.read('pyinstalive.ini')

+ 46 - 0
requirements.txt

@@ -0,0 +1,46 @@
+aiohttp==1.0.5
+altgraph==0.15
+async-timeout==2.0.0
+beautifulsoup4==4.6.0
+certifi==2018.1.18
+chardet==3.0.4
+colorama==0.3.9
+configparser==3.5.0
+cx-Freeze==5.1.1
+decorator==4.0.11
+discord==0.0.2
+discord.py==0.16.12
+future==0.16.0
+idna==2.6
+imageio==2.1.2
+instagram-private-api==1.4.0
+instagram-private-api-extensions==0.3.6
+logzero==1.3.1
+lyricwikia==0.1.9
+macholib==1.9
+moviepy==0.2.3.2
+multidict==3.3.2
+mutagen==1.40.0
+numpy==1.14.1
+oauthlib==2.0.6
+olefile==0.44
+pafy==0.5.3.1
+pathlib==1.0.1
+pefile==2017.11.5
+Pillow==5.0.0
+PyInstaller==3.3.1
+pypiwin32==223
+python-twitter==3.4
+pywin32==223
+PyYAML==3.12
+requests==2.18.4
+requests-oauthlib==0.8.0
+six==1.11.0
+spotipy==2.4.4
+titlecase==0.12.0
+tqdm==4.11.2
+unicode-slugify==0.1.3
+Unidecode==1.0.22
+urllib3==1.22
+websockets==3.4
+youtube-dl==2018.1.21