This article describes how to use python to get a brief introduction to Douban movies.
The code is as follows:
#! /Usr/bin/env python
# Coding: UTF-8
Import re, sys
Import urllib
From bs4 import BeautifulSoup
Global r_url
Def hq_url ():
So_url = "http://movie.douban.com/subject_search? Search_text ="
Data = urllib. urlopen (so_url + gjz). read ()
R = re. findall (r 'r_url = re. sub ('"','', r [0])
Ymdata = urllib. urlopen (r_url). read ()
Soup = BeautifulSoup (ymdata)
Wz = soup ('span ', {'properties': 'V: summary '})
Title = re. findall (r'name = "title" value = "(.*?) "', Ymdata)
Zy = re. findall (r'name = "desc" value = "(.*?) "', Ymdata)
Imdb = re. findall (r ':
Shijian = re. findall (r '(.*?) ', Ymdata)
Print u "IMDB movie network link"
Print imdb
Print u "Douban movie link"
Print r_url
Print '* 70
Print title [0]
Print zy [0]
Print "movie introduction"
Print '* 70
Print wz
If _ name __= = '_ main __':
Gjz = raw_input ("Enter the movie name:"). strip ()
Hq_url ()