Image Parser
import urllib.request def parse_links(source): links=[] t=str(source).split('<img src="') for i in t: r=str(i).split('"') links.append(r[0]) return links def download(links): name=0 for i in links: try: v=urllib.request.urlopen(i) f=open(str(name)+".jpg","wb") f.write(v.read()) f.close() name+=1 except:print("C") def load_source(website): s=urllib.request.urlopen(website) v=s.read() return v def main(): search=input("Start:") source=load_source("http://nzz.ch") links=parse_links(source) download(links) for i in links:print(i) print("END") main()
Author: Marcin
Language: Python 3.4
Infos:
A simple Script for filtering out Images of a website or just a html file. It's a simple parser that searches
for tags with Images in it and downloads these.
Video: https://www.youtube.com/watch?v=_-Lecym-BP0&feature=youtu.be
No comments:
Post a Comment