loop for url

This commit is contained in:
Valentin CZERYBA 2023-04-10 16:02:40 +02:00
parent 4ddc4a7cd3
commit aa5c8893ec

View File

@ -76,38 +76,44 @@ if __name__ == '__main__':
importWp.fromDirectory(args.directory) importWp.fromDirectory(args.directory)
exit(0) exit(0)
if len(args.canalblog) > 0: if len(args.canalblog) > 0:
exportWp = WPExport.WPExport("", logger, args.parser, args.directory)
canalblog = args.canalblog.split(",")
for canal in canalblog:
try:
o = urlparse(canal)
o = o._replace(scheme="https")
url = o.geturl().replace(":///", "://")
except Exception as err:
logger.error("parsing error : {0}".format(err))
exit(1)
exportWp.setUrl(url)
webpage = exportWp.getUrlPage()
importWp.fromUrl(webpage)
if args.command == "export":
canalblog = args.url.split(",")
exportWp = WPExport.WPExport("", logger, args.parser, args.directory)
for canal in canalblog:
try: try:
o = urlparse(args.canalblog) o = urlparse(canal)
o = o._replace(scheme="https") o = o._replace(scheme="https")
url = o.geturl().replace(":///", "://") url = o.geturl().replace(":///", "://")
except Exception as err: except Exception as err:
logger.error("parsing error : {0}".format(err)) logger.error("parsing error : {0}".format(err))
exit(1) exit(1)
exportWp = WPExport.WPExport(url, logger, args.parser, args.directory) exportWp.setUrl(url)
webpage = exportWp.getUrlPage() if args.js is False:
importWp.fromUrl(webpage) exportWp.downloadJs()
if args.command == "export":
try:
o = urlparse(args.url)
o = o._replace(scheme="https")
url = o.geturl().replace(":///", "://")
except Exception as err:
logger.error("parsing error : {0}".format(err))
exit(1)
exportWp = WPExport.WPExport(url, logger, args.parser, args.directory)
if args.js is False:
exportWp.downloadJs()
if args.css is False: if args.css is False:
exportWp.downloadCss() exportWp.downloadCss()
if args.html is False or args.img is False: if args.html is False or args.img is False:
webpage = exportWp.getUrlPage() webpage = exportWp.getUrlPage()
if args.html is False: if args.html is False:
exportWp.downloadHTML(webpage) exportWp.downloadHTML(webpage)
if args.img is False: if args.img is False:
exportWp.downloadImg(webpage) exportWp.downloadImg(webpage)
exit(0) exit(0)