[Python] Get the download address of music from the 5ige website-Python version

Source: Internet
Author: User

Today, I saw a <get 5ige website music> written by Eddy using VC. I felt good. I also wrote one for python on the rise, so I should be familiar with python.

Right-click the source code of the webpage. Note: you cannot download it directly. You need to download it using thunder or tornado. In addition, many websites, including videos, that are not in the source code, can use Google's Chrome browser's developer tool to sniff out the truth.

For example: http://voice.5ige.cn/ilmusic/voice/viewer.do? Artist = 4150.

True: http://fs.5ige.cn/fs/media/4150/1343096404845.mp3

Python code:

#! /Usr/bin/Python

#-*-Coding: UTF-8 -*-

"'

Created on 2012-8-30

@ Author: onebody

Parse 5ige.cn MP3 website

"'

Import urllib

Def parse (URL ):

Result = ""

Content = urllib. urlopen (URL). Read ()

# Print content

If Len (content)> 0:

I = content.find(registrant ″)

If I> = 0:

TMP = content [0: I + 4]. Strip ()

J = TMP. Find ("MP3:")

TMP = TMP [J + 6: Len (TMP)]. Strip ()

Result = TMP

Return result

Mp3_filename = parse ("http://voice.5ige.cn/ilmusic/voice/viewer.do? Artist = 4150 ″)

Source: http://fcjblog.com/python-get-5ige-website-music-download-python-version

Related Article

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.