Created
May 14, 2017 06:10
-
-
Save sauravtom/84acea1c081994895d3b644da2e30559 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from bs4 import BeautifulSoup | |
import requests | |
import webbrowser | |
# http://s.imgur.com/a/ksnRO/zip | |
def main(): | |
arr = [] | |
url = 'http://imgur.com/a/ksnRO/layout/blog' | |
html = requests.get(url).text; | |
soup = BeautifulSoup( html ) | |
for node in soup.find_all('div',{'class' : 'post-image'}): | |
try: | |
image_url = node.img.get('src') | |
arr.append(image_url) | |
#webbrowser.open('http:'+image_url) | |
#break | |
except AttributeError: | |
print node | |
pass | |
print len(arr) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment