add serial for url
This commit is contained in:
parent
7c75116c5b
commit
05a3a28c6f
@ -21,6 +21,8 @@ if __name__ == '__main__':
|
|||||||
import_parser.add_argument("--directory", help="HTML directory", default="")
|
import_parser.add_argument("--directory", help="HTML directory", default="")
|
||||||
import_parser.add_argument("--canalblog", help="URL Canalblog", default="")
|
import_parser.add_argument("--canalblog", help="URL Canalblog", default="")
|
||||||
import_parser.add_argument("--wordpress", help="URL Wordpress", required=True)
|
import_parser.add_argument("--wordpress", help="URL Wordpress", required=True)
|
||||||
|
import_parser.add_argument("--serial", help="Serial execution", action="store_true")
|
||||||
|
|
||||||
|
|
||||||
export_parser = subparsers.add_parser("export")
|
export_parser = subparsers.add_parser("export")
|
||||||
|
|
||||||
@ -76,13 +78,26 @@ if __name__ == '__main__':
|
|||||||
importWp.fromFile(args.file.split(","))
|
importWp.fromFile(args.file.split(","))
|
||||||
exit(0)
|
exit(0)
|
||||||
if len(args.directory) > 0:
|
if len(args.directory) > 0:
|
||||||
|
directory = args.directory.split(",")
|
||||||
|
if args.serial is False:
|
||||||
for i in wordpress:
|
for i in wordpress:
|
||||||
importWp.setUrl(i)
|
importWp.setUrl(i)
|
||||||
importWp.fromDirectory(args.directory)
|
for j in directory:
|
||||||
|
importWp.fromDirectory(j)
|
||||||
|
else:
|
||||||
|
if len(directory) != len(wordpress):
|
||||||
|
logger.error("ERREUR : Le nombre de dossier n'est pas equivalent au nombre d'URL wordpress")
|
||||||
|
exit(1)
|
||||||
|
for i in range(0, len(wordpress)-1):
|
||||||
|
importWp.setUrl(wordpress[i])
|
||||||
|
importWp.fromDirectory(directory[i])
|
||||||
exit(0)
|
exit(0)
|
||||||
if len(args.canalblog) > 0:
|
if len(args.canalblog) > 0:
|
||||||
exportWp = WPExport.WPExport("", logger, args.parser, args.directory)
|
exportWp = WPExport.WPExport("", logger, args.parser, args.directory)
|
||||||
canalblog = args.canalblog.split(",")
|
canalblog = args.canalblog.split(",")
|
||||||
|
wordpress = args.wordpress.split(",")
|
||||||
|
|
||||||
|
if serial is False:
|
||||||
for canal in canalblog:
|
for canal in canalblog:
|
||||||
try:
|
try:
|
||||||
o = urlparse(canal)
|
o = urlparse(canal)
|
||||||
@ -93,7 +108,26 @@ if __name__ == '__main__':
|
|||||||
exit(1)
|
exit(1)
|
||||||
exportWp.setUrl(url)
|
exportWp.setUrl(url)
|
||||||
webpage = exportWp.getUrlPage()
|
webpage = exportWp.getUrlPage()
|
||||||
|
for j in wordpress:
|
||||||
|
importWp.setUrl(j)
|
||||||
importWp.fromUrl(webpage)
|
importWp.fromUrl(webpage)
|
||||||
|
else:
|
||||||
|
if len(canalblog) != len(wordpress):
|
||||||
|
logger.error("ERREUR : Le nombre de dossier n'est pas equivalent au nombre d'URL wordpress")
|
||||||
|
exit(1)
|
||||||
|
for i in range(0, len(canalblog)-1):
|
||||||
|
try:
|
||||||
|
o = urlparse(canalblog[i])
|
||||||
|
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.setUrl(wordpress[i])
|
||||||
|
importWp.fromUrl(webpage)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if args.command == "export":
|
if args.command == "export":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user