-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoko.py
executable file
·36 lines (35 loc) · 927 Bytes
/
moko.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python
#coding:utf-8
from bs4 import BeautifulSoup
import requests
url='http://www.moko.cc/mtb.html'
r=requests.get(url, verify=False)
content=r.content
soup=BeautifulSoup(content,'lxml')
modlist=soup.find_all('div','sub_show')
link=[]
for i in modlist:
if i==modlist[-1] or i==modlist[0]:
continue
tmp=i.find_all('a')
for j in tmp:
if 'html' in j['href']:
link.append(j['href'])
print j['href']
print 'http://www.moko.cc'+link[0]
url2='http://www.moko.cc'+link[0]
r=requests.get(url2, verify=False)
content=r.content
soup=BeautifulSoup(content,'lxml')
alist=soup.find_all('div','thumbnail_box')
soup2=BeautifulSoup(str(alist),'lxml')
blist=soup2.find_all('dd')
for item in blist:
link=item.find('img')
try:
if '.png' in link['src']:
pass
else:
print link['src'].split('?')[0]
except:
continue