Python get Douban movie introduction code sharing

Source: Internet
Author: User
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 ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.