-
-
Save anonymous/3a17a705163b622d83d6 to your computer and use it in GitHub Desktop.
This file contains 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
import re | |
import urllib2 | |
import time | |
max_page = 1 | |
sleep = 1 | |
dict_ = {} | |
for i in range(0,max_page+1): | |
time.sleep(sleep) | |
response = urllib2.urlopen('http://v2ex.com/go/afterdark?p='+str(max_page)) | |
for link in re.findall('href="/t/.*?"',response.read()): | |
time.sleep(sleep) | |
response0 = urllib2.urlopen('http://v2ex.com'+link[6:-1]).read() | |
for p_url in re.findall('(http://ww[0-9]\.sinaimg\.cn/.*?/.*?\.(jpg|png|gif))',response0): | |
if p_url[0] not in dict_: | |
print p_url[0] | |
dict_[p_url[0]] = '' | |
for p_url in re.findall('(http://i\.imgur\.com/.*?\.(jpg|png|gif))',response0): | |
if p_url[0] not in dict_: | |
print p_url[0] | |
dict_[p_url[0]] = '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment