Last active
August 29, 2015 13:57
-
-
Save seyrenus/9685311 to your computer and use it in GitHub Desktop.
mtimes spider
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
def moviespider(): | |
url = 'http://theater.mtime.com/China_Sichuan_Province_Luzhou_XuYongXian/3527/' | |
page = urllib2.urlopen(url) | |
soup = bs(page) | |
original = soup.find_all(class_='table') | |
m_count = len(original) | |
movie_list = [] | |
movie_name = [] | |
movie_time = [] | |
movie_price = [] | |
for i in range(0,m_count): | |
name_temp = [] | |
time_temp = [] | |
price_temp = [] | |
name_temp.append(original[i].find(class_='c_000').text) | |
for t in original[i].find_all('strong'): | |
time_temp.append(t.text) | |
time_temp=qc(time_temp) | |
for p in original[i].find_all('em'): | |
price_temp.append(p.text) | |
movie_name.extend(name_temp) | |
movie_time.append(time_temp) | |
movie_price.append(price_temp) | |
movie_list.append(movie_name) | |
movie_list.append(movie_time) | |
movie_list.append(movie_price) | |
return movie_list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment