tree - Python Web Scraper (URL-Sub_URL Output) -
i have been trying figure out how without ridiculous amount of code past few days, can not find on it, google, stack overflow, etc.
i building advanced web scraper , output in tree type layout, example:
for aurl in aurls: print aurl burls = urlscraper(curl, scrape, savepgs) burl in burls: print burl curls = urlscraper(burl, scrape, savepgs) (this maintain repeating lot.)
the planned output this:
link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/ link.example.com/
i need go on until scraper has reached end of tree. sense on thinking much , going while loop. have built web scraping api homecoming depth of url scraping, url, , other factors not matter @ time.
i have made little function print depth of script:
def depthindent(depth): depthlevel = "" if depth == 1: depthlevel = depthlevel + ">" homecoming str(depthlevel) else: in range(0,depth): depthlevel = depthlevel + " " homecoming str(depthlevel) + "-"
i need able run loop not end until hits end of tree! help highly appreciated, illustration code nice brief explination too, it's annoying working on 1 error day!
summery: need display text @ given depth, not able observe depth. need print given output until end of tree.
thank you
python tree output depth scraper
No comments:
Post a Comment