<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Requests on 春江暮客</title>
    <link>https://www.bobobk.com/en/tags/requests/</link>
    <description>Recent content in Requests on 春江暮客</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Tue, 08 Jan 2019 05:31:43 +0000</lastBuildDate>
    <atom:link href="https://www.bobobk.com/en/tags/requests/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Python implementation for Qianqian Music MP3 download</title>
      <link>https://www.bobobk.com/en/216.html</link>
      <pubDate>Tue, 08 Jan 2019 05:31:43 +0000</pubDate>
      <guid>https://www.bobobk.com/en/216.html</guid>
      <description>&lt;p&gt;Entering the Qianqian Music homepage and selecting Jay Chou&amp;rsquo;s &amp;ldquo;Confession Balloon&amp;rdquo; reveals that it&amp;rsquo;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.&lt;/p&gt;&#xA;&lt;p&gt;Without further ado, I opened the charts and chose a new song that could be previewed; &amp;ldquo;Sheng Pi Zi&amp;rdquo; was the first one I could listen to.&lt;/p&gt;&#xA;&lt;h2 id=&#34;python-implementation-for-qianqian-music-mp3-download&#34;&gt;&lt;img src=&#34;https://www.bobobk.com/wp-content/uploads/2019/01/bangdan.webp&#34; alt=&#34;Python implementation for Qianqian Music MP3 download&#34;&gt;&lt;/h2&gt;&#xA;&lt;h2 id=&#34;1-analyze-api-information&#34;&gt;1. Analyze API information&lt;/h2&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://www.bobobk.com/wp-content/uploads/2019/01/music_net.webp&#34; alt=&#34;Python implementation for Qianqian Music MP3 download&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Check the request details:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://www.bobobk.com/wp-content/uploads/2019/01/qqyy_request.webp&#34; alt=&#34;Python implementation for Qianqian Music MP3 download&#34;&gt;&#xA;The &lt;strong&gt;songid&lt;/strong&gt; parameter can be found in the current URL: &lt;code&gt;http://music.taihe.com/song/611238837&lt;/code&gt;. It&amp;rsquo;s simple. &lt;code&gt;from&lt;/code&gt; should be &amp;ldquo;web&amp;rdquo; or &amp;ldquo;app&amp;rdquo;, etc. The &lt;code&gt;format&lt;/code&gt; defining the return data type doesn&amp;rsquo;t need to be changed. &lt;code&gt;method&lt;/code&gt; doesn&amp;rsquo;t need to be changed. The &lt;code&gt;_&lt;/code&gt; parameter is a 13-digit timestamp. &lt;code&gt;callback&lt;/code&gt; is the prefix of the returned JSON data. The &lt;code&gt;1546915161467&lt;/code&gt; after the underscore is a 13-digit timestamp, while the preceding &lt;code&gt;17200943498528136486&lt;/code&gt; is unknown. We&amp;rsquo;ll try to use the known parameters to see if we can retrieve information without changing the unknown content.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python implementation for Qianqian Music MP3 download</title>
      <link>https://www.bobobk.com/en/216.html</link>
      <pubDate>Tue, 08 Jan 2019 05:31:43 +0000</pubDate>
      <guid>https://www.bobobk.com/en/216.html</guid>
      <description>&lt;p&gt;Entering the Qianqian Music homepage and selecting Jay Chou&amp;rsquo;s &amp;ldquo;Confession Balloon&amp;rdquo; reveals that it&amp;rsquo;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.&lt;/p&gt;&#xA;&lt;p&gt;Without further ado, I opened the charts and chose a new song that could be previewed; &amp;ldquo;Sheng Pi Zi&amp;rdquo; was the first one I could listen to.&lt;/p&gt;&#xA;&lt;h2 id=&#34;python-implementation-for-qianqian-music-mp3-download&#34;&gt;&lt;img src=&#34;https://www.bobobk.com/wp-content/uploads/2019/01/bangdan.webp&#34; alt=&#34;Python implementation for Qianqian Music MP3 download&#34;&gt;&lt;/h2&gt;&#xA;&lt;h2 id=&#34;1-analyze-api-information&#34;&gt;1. Analyze API information&lt;/h2&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://www.bobobk.com/wp-content/uploads/2019/01/music_net.webp&#34; alt=&#34;Python implementation for Qianqian Music MP3 download&#34;&gt;&#xA;Check the request details:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://www.bobobk.com/wp-content/uploads/2019/01/qqyy_request.webp&#34; alt=&#34;Python implementation for Qianqian Music MP3 download&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;strong&gt;songid&lt;/strong&gt; parameter can be found in the current URL: &lt;code&gt;http://music.taihe.com/song/611238837&lt;/code&gt;. It&amp;rsquo;s simple. &lt;code&gt;from&lt;/code&gt; should be &amp;ldquo;web&amp;rdquo; or &amp;ldquo;app&amp;rdquo;, etc. The &lt;code&gt;format&lt;/code&gt; defining the return data type doesn&amp;rsquo;t need to be changed. &lt;code&gt;method&lt;/code&gt; doesn&amp;rsquo;t need to be changed. The &lt;code&gt;_&lt;/code&gt; parameter is a 13-digit timestamp. &lt;code&gt;callback&lt;/code&gt; is the prefix of the returned JSON data. The &lt;code&gt;1546915161467&lt;/code&gt; after the underscore is a 13-digit timestamp, while the preceding &lt;code&gt;17200943498528136486&lt;/code&gt; is unknown. We&amp;rsquo;ll try to use the known parameters to see if we can retrieve information without changing the unknown content.&lt;/p&gt;</description>
    </item>
    <item>
      <title>python3 requests module usage examples</title>
      <link>https://www.bobobk.com/en/198.html</link>
      <pubDate>Fri, 28 Dec 2018 04:57:52 +0000</pubDate>
      <guid>https://www.bobobk.com/en/198.html</guid>
      <description>The network module in python3 is much more convenient compared to python2. The requests package combines several python2 packages. This article explains the usage of requests with examples, serving as a review and future reference.</description>
    </item>
    <item>
      <title>Recursively download files python</title>
      <link>https://www.bobobk.com/en/85.html</link>
      <pubDate>Sat, 08 Dec 2018 06:42:32 +0000</pubDate>
      <guid>https://www.bobobk.com/en/85.html</guid>
      <description>I want to back up my website recently, but the size of the file downloaded by PHP is limited, and I am too lazy to install FTP to download it. So I thought of temporarily setting up a secondary domain name site, and then using python (python3)&amp;rsquo;s requests library to directly download all the files and folders in the root directory of the website to achieve the purpose of backup.</description>
    </item>
  </channel>
</rss>
