/
dl_porn609.py
executable file
·106 lines (93 loc) · 3.29 KB
/
dl_porn609.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env python3
import os
#import urllib.request
import climber
from bs4 import BeautifulSoup
import download as dl
def get_ep_num(soup):
li_sec = soup.find('div', {'id': 'list_tap'})
all_ep = li_sec.findAll('li', {'class': 'ep'})
return len(all_ep)
def get_iframe_video_link(soup):
ifrmae_link_sec = soup.find('iframe')
if ifrmae_link_sec == None:
return
return ifrmae_link_sec['src']
def get_video_page_source_link(soup):
link_sec = soup.find('source')
if link_sec == None:
return
return link_sec['src']
def get_final_video_link(link):
content = climber.get_content(link)
if content == None:
return
soup = BeautifulSoup(content)
if soup == None:
return
iframe_vlink = "http://www.porn609.com/{}".format(get_iframe_video_link(soup))
video_page = climber.get_content(iframe_vlink)
if video_page == None:
return
soup2 = BeautifulSoup(video_page)
if soup2 == None:
return
final_video_link = get_video_page_source_link(soup2)
return final_video_link
def dl_videos(link):
content = climber.get_content(link)
if content == None:
return
soup = BeautifulSoup(content)
boxes = soup.findAll('div', {'class': 'boxim'})
if boxes == None:
return
links = []
product_ids = []
for sec in boxes:
a_link_sec = sec.find('a')
if a_link_sec == None:
continue
a_link = a_link_sec['href']
a_title = a_link_sec['title']
product_id = a_title.split(' ')[3]
print("[{}] {}".format(product_id, a_link))
links.append(a_link)
product_ids.append(product_id)
for idx, each_link in enumerate(links):
content1 = climber.get_content(each_link)
if content1 == None:
continue
soup1 = BeautifulSoup(content1)
ep_num = get_ep_num(soup1)
vid_link = get_final_video_link(each_link)
if vid_link == '' or vid_link == None:
continue
# download this vid_link to product_id_1.mp4
first_file_path = "{}_1.mp4".format(product_ids[idx])
print("Download {} ...".format(first_file_path))
if os.path.exists(first_file_path):
print("{} exists, skip".format(first_file_path))
else:
dl.download_url(vid_link, first_file_path)
#print(vid_link)
for i in range(2, ep_num + 1):
new_link = "{}?ep={}".format(each_link, i)
vid_link1 = get_final_video_link(new_link)
if vid_link1 == '' or vid_link1 == None:
continue
#print(vid_link1)
to_path = "{}_{}.mp4".format(product_ids[idx], i)
print("Download {} ...".format(to_path))
if os.path.exists(to_path):
print("{} exists, skip".format(to_path))
else:
dl.download_url(vid_link1, to_path)
#dl_videos('http://www.porn609.com/?s=Hoshino+Asuka')
#dl_videos('http://www.porn609.com/?s=Katsuki+Yuuri')
#dl_videos('http://www.porn609.com/?s=Suzuki+Kiara')
dl_videos('http://www.porn609.com/?s=Kiyomi+Rei')
dl_videos('http://www.porn609.com/?s=Shirase+Erina')
dl_videos('http://www.porn609.com/?s=Kimino+Ayumi')
dl_videos('http://www.porn609.com/?s=Morikawa+Mau')
dl_videos('http://www.porn609.com/?s=Ayase+Meru')