import urllib.request
import re
import pdb
import webbrowser
from time import sleep
class Webpage:
def __init__(self, url):
# init page
self.url = url
header = {
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12D508 Safari/600.1.4'}
request = urllib.request.Request(url, headers=header)
sleep(2)
webpage = urllib.request.urlopen(request)
webpage = webpage.read()
webpage_decode = webpage.decode()
self.webpage = webpage_decode
DCIM = re.compile(r'来自')
title = DCIM.findall(webpage_decode)
if len(title) != 0:
webbrowser.open(url)
def Page(min ,max):
for i in range(min, max):
url ='http://yun.baidu.com/share/home?uk='+str(i)
yield url
if __name__ == '__main__':
for i in Page(1,5000):
Webpage(i)
1
knightdf 2016-04-01 13:06:05 +08:00
webbrowser.open(url)
|
2
leavic 2016-04-01 13:21:00 +08:00
10 年前,我们管这种一次打开 5000 个网页的东西叫做恶意脚本,确实很适合在愚人节用。
|
3
Tink 2016-04-01 13:32:19 +08:00
我昨晚下载完了,正在往数据库里导
|
4
Sequencer OP |
7
aksoft 2016-04-01 13:50:05 +08:00
今天是愚人节。。
|