Python implementation for Qianqian Music MP3 download

Entering the Qianqian Music homepage and selecting Jay Chou’s “Confession Balloon” reveals that it’s a 2016 song with no preview available, which is sad. Is there a way to get the MP3 file? The answer is yes. A runnable program for music download is available at the end of the article.

Without further ado, I opened the charts and chose a new song that could be previewed; “Sheng Pi Zi” was the first one I could listen to.

Python implementation for Qianqian Music MP3 download

1. Analyze API information

Opening the developer tools, I found that music files are definitely submitted through an API. Among many requests, I found a request that could retrieve music files. See the image below:

Python implementation for Qianqian Music MP3 download Check the request details:

Python implementation for Qianqian Music MP3 download

The songid parameter can be found in the current URL: http://music.taihe.com/song/611238837. It’s simple. from should be “web” or “app”, etc. The format defining the return data type doesn’t need to be changed. method doesn’t need to be changed. The _ parameter is a 13-digit timestamp. callback is the prefix of the returned JSON data. The 1546915161467 after the underscore is a 13-digit timestamp, while the preceding 17200943498528136486 is unknown. We’ll try to use the known parameters to see if we can retrieve information without changing the unknown content.

……

阅读全文

python实现千千音乐mp3下载

进入千千音乐主页面,选择周杰伦的音乐告白气球,发现竟然是2016年的音乐试听都木有,悲伤。那么有没有办法可以获取到mp3文件呢?答案是肯定的。音乐下载可运行程序可在文末获取。

说干就干,打开榜单,选择新歌一首可以试听的,第一首生僻字就可以听。

《python实现千千音乐mp3下载》

1.分析接口信息

打开开发者工具,这种音乐文件肯定是通过api提交的,在毛毛多的请求中发现可以获取音乐文件的请求,看图

……

阅读全文

python画横线竖线作为分界线

在作图的时候,经常会碰到需要添加分界线的情况,那么python里面那些函数可以方便的画出水平横线或者垂直竖线呢,下面介绍两种可以方便的添加水平或者垂直直线的函数……

阅读全文

Linux挂载移动硬盘

机器重启后,移动硬盘就不识别了,需要重新挂载,但是使用fdisk -l之后并没有发现移动硬盘的踪迹。也就无从挂载了。

《Linux挂载移动硬盘》

挂载磁盘方法

首先使用fdisk -l查看当前硬盘状态。

    ➜  ~ fdisk -l 
    WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

    磁盘 /dev/sdb:320.1 GB, 320072933376 字节,625142448 个扇区
    Units = 扇区 of 1 * 512 = 512 bytes
    扇区大小(逻辑/物理):512 字节 / 512 字节
    I/O 大小(最小/最佳):512 字节 / 512 字节
    磁盘标签类型:gpt
    Disk identifier: AF1B577B-830C-4026-AC5F-37870D362B3C

    #         Start          End    Size  Type            Name
     1         2048       411647    200M  EFI System      EFI System Partition
     2       411648      2508799      1G  Microsoft basic 
     3      2508800    625141759  296.9G  Linux LVM       

    磁盘 /dev/mapper/centos-root:53.7 GB, 53687091200 字节,104857600 个扇区
    Units = 扇区 of 1 * 512 = 512 bytes
    扇区大小(逻辑/物理):512 字节 / 512 字节
    I/O 大小(最小/最佳):512 字节 / 512 字节

    磁盘 /dev/mapper/centos-swap:3623 MB, 3623878656 字节,7077888 个扇区
    Units = 扇区 of 1 * 512 = 512 bytes
    扇区大小(逻辑/物理):512 字节 / 512 字节
    I/O 大小(最小/最佳):512 字节 / 512 字节

    磁盘 /dev/mapper/centos-home:261.5 GB, 261468717056 字节,510681088 个扇区
    Units = 扇区 of 1 * 512 = 512 bytes
    扇区大小(逻辑/物理):512 字节 / 512 字节
    I/O 大小(最小/最佳):512 字节 / 512 字节

    磁盘 /dev/sda:1000.2 GB, 1000170586112 字节,1953458176 个扇区
    Units = 扇区 of 1 * 512 = 512 bytes
    扇区大小(逻辑/物理):512 字节 / 512 字节
    I/O 大小(最小/最佳):512 字节 / 512 字节
    磁盘标签类型:dos
    磁盘标识符:0x16f2a91f

       设备 Boot      Start         End      Blocks   Id  System
    /dev/sda1               1  4294967295  2147483647+  ee  GPT

我这里移动硬盘1T,可以知道就是最后的/dev/sda1,那么使用mount命令挂载即可

……

阅读全文

Mounting an External Hard Drive in Linux

After a machine restart, the external hard drive wasn’t recognized and needed to be remounted. However, after using fdisk -l, the external hard drive was nowhere to be found, making it impossible to mount.

Mounting an External Hard Drive in Linux

How to Mount a Disk

First, use fdisk -l to check the current hard drive status.

    ➜  ~ fdisk -l 
    WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

    Disk /dev/sdb: 320.1 GB, 320072933376 bytes, 625142448 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: gpt
    Disk identifier: AF1B577B-830C-4026-AC5F-37870D362B3C

    #         Start         End    Size  Type            Name
    1          2048      411647    200M  EFI System      EFI System Partition
    2        411648     2508799      1G  Microsoft basic
    3       2508800   625141759  296.9G  Linux LVM

    Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Disk /dev/mapper/centos-swap: 3623 MB, 3623878656 bytes, 7077888 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Disk /dev/mapper/centos-home: 261.5 GB, 261468717056 bytes, 510681088 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Disk /dev/sda: 1000.2 GB, 1000170586112 bytes, 1953458176 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x16f2a91f

          Device Boot      Start        End    Blocks  Id  System
    /dev/sda1             1 4294967295 2147483647+ ee  GPT

Here, my external hard drive is 1TB, which means it’s /dev/sda1. So, I can use the mount command to mount it:

……

阅读全文

Drawing Violin Plots with Seaborn

Introduction

A violin plot is used to display the distribution and probability density of multiple data groups. Similar to a box plot, it offers a better representation of data density. Violin plots are particularly useful when dealing with very large datasets that are difficult to display individually. Python’s Seaborn package makes it very convenient to create violin plots.

Parameters

Drawing Violin Plots with Seaborn

The parameters corresponding to each position in a violin plot are shown above. The middle line represents the box plot data, specifically the 25th, 50th (median), and 75th percentiles. The thin lines indicate the 95% confidence interval.

Drawing Violin Plots with Seaborn

Single Variable Data

While a box plot would suffice for a single variable, a violin plot can certainly be used as well:

    import seaborn as sns
    sns.set(color_codes=True)
    sns.set_style("white")
    df = sns.load_dataset('iris')
    sns.violinplot( y=df["sepal_length"] )

Drawing Violin Plots with Seaborn

……

阅读全文

seaborn画小提琴图(violin plot)

简介

小提琴图是用来展示多组数据的分布状态以及概率密度。跟箱线图类似,但是可以密度层面展示更好。在数据量非常大不方便一个一个展示的时候小提琴图特别适用。而python里面的seaborn包可以很方便的画出小提琴图。

参数

《seaborn画小提琴图(violin plot)》

小提琴图各位置对应参数,中间一条就是箱线图数据,25%,50%,75%位置,细线区间为95%置信区间。

……

阅读全文

Five Easy Steps to Achieve Linux Passwordless Login

SSH, which stands for Secure Shell, is a widely used and reliable program for securely executing commands remotely on Linux systems. SCP, used for secure file transfers, is also based on the SSH security protocol.

When you have many servers, frequently typing passwords can be quite troublesome. So, how can you log in without a password while maintaining security? Of course, it’s possible. Here, we’ll outline five steps to achieve passwordless login for Linux servers such as RHEL/CentOS 7.x/6.x/5.x and Fedora.

Five Easy Steps to Achieve Linux Passwordless Login

Let’s look at the environment:

    SSH Client : 192.168.1.12 ( Mac )
    SSH Remote Host : 192.168.1.11 ( CentOS 7 )

This article will demonstrate passwordless login from a Mac to a remote CentOS 7 server.

1. Generate SSH-Keygen Key Pair on Your Local Mac

First, use the following command in your Mac terminal to generate a key pair:

……

阅读全文

五步轻松实现linux免密登录

SSH英文全程Secure SHELL,是被广泛用于linux系统安全可靠的远程命令执行程序,而用来进行安全文件传输的SCP同样基于SSH的安全协议。

当服务器比较多的时候,每次都要频繁输入密码显得特别麻烦,那么怎样免密码登录且做到安全可靠呢,当然是可以的。这里我们将分为五步完成RHEL/CentOS 7.x/6.x/5.x and Fedora等linux类型服务器的免密码登录。

……

阅读全文

python里shadowcopy和deepcopy的区别

python中,经常会需要拷贝特定对象,在此可能就会遇到各种bug,原因就是明白这三种操作的区别,赋值,浅拷贝,深拷贝。

《python里shadowcopy和deepcopy的区别》

赋值(=),浅拷贝(copy)和深拷贝(deepcopy)比较容易区别开的是赋值和两种拷贝的区别,但是对于浅拷贝和深拷贝却不那么容易区分。

赋值语句并不会赋值对象,它仅仅是把变量和对象进行一个绑定。对一个对象的任何改变均会影响另一个对象。而拷贝可以在你改变其中一个对象的时候不改变另一个对象。

……

阅读全文

The difference between shadowcopy and deepcopy in python

In python, it is common to need to copy specific objects, and you might encounter various bugs because understanding the difference between these three operations is key: assignment, shallow copy, and deep copy.

“The difference between shadowcopy and deepcopy in python”

Assignment (=), shallow copy (copy), and deep copy (deepcopy) are relatively easy to distinguish regarding assignment vs. copying, but shallow copy and deep copy are harder to differentiate.

The assignment statement does not copy the object; it simply binds the variable to the object. Any change to one object will affect the other. Copying allows you to change one object without affecting the other.

The difference between shallow and deep copy is that shallow copy does not affect the other object when values change, but adding or deleting elements can affect it. Deep copy creates a completely independent object, and changes to one will not affect the other.

……

阅读全文

最近文章

分类

标签

友情链接

其它