{"id":6,"date":"2024-04-17T20:15:38","date_gmt":"2024-04-17T12:15:38","guid":{"rendered":"http:\/\/101.133.225.47:8560\/?p=6"},"modified":"2024-05-10T07:20:08","modified_gmt":"2024-05-09T23:20:08","slug":"python%e7%ba%af%e4%bb%a3%e7%a0%81%e5%88%86%e4%ba%abqq%e9%9f%b3%e4%b9%90%e8%a7%a3%e6%9e%90%e6%90%9c%e7%b4%a2%e7%ad%89","status":"publish","type":"post","link":"https:\/\/nmsl.life\/index.php\/mcqtss\/python%e7%ba%af%e4%bb%a3%e7%a0%81%e5%88%86%e4%ba%abqq%e9%9f%b3%e4%b9%90%e8%a7%a3%e6%9e%90%e6%90%9c%e7%b4%a2%e7%ad%89\/","title":{"rendered":"[Python][\u7eaf\u4ee3\u7801\u5206\u4eab]QQ\u97f3\u4e50\u89e3\u6790,\u641c\u7d22\u7b49"},"content":{"rendered":"\n<p><strong>\u6e90\u7801,\u5168\u90e8\u529f\u80fd\u8bf4\u660e:https:\/\/github.com\/MCQTSS\/MCQTSS_QQMusic<\/strong><\/p>\n\n\n\n<p><strong>\u4ee3\u7801\u4ec5\u7528\u4e8e\u5b66\u4e60\u4ea4\u6d41<\/strong><\/p>\n\n\n\n<p><strong>\u91cc\u9762\u6240\u6709\u7684_headers\u90fd\u662f<\/strong><\/p>\n\n\n\n<p>{<br>\u00a0\u00a0&#8216;Accept&#8217;:\u00a0&#8216;*\/*&#8217;,<br>\u00a0\u00a0&#8216;Accept-Encoding&#8217;:\u00a0&#8216;gzip, deflate, br&#8217;,<br>\u00a0\u00a0&#8216;Accept-Language&#8217;:\u00a0&#8216;zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6&#8217;,<br>\u00a0\u00a0&#8216;Referer&#8217;:\u00a0&#8216;https:\/\/y.qq.com\/&#8217;,<br>\u00a0\u00a0&#8216;User-Agent&#8217;:\u00a0&#8216;Mozilla\/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X; zh-CN) AppleWebKit\/537.51.1 (&#8216;<br>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#8216;KHTML, like Gecko) Mobile\/17D50 UCBrowser\/12.8.2.1268 Mobile AliApp(TUnionSDK\/0.1.20.3) &#8216;<br>}<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>\u641c\u7d22:<\/strong><\/h1>\n\n\n\n<p>\u6700\u5f00\u59cb\u5176\u5b9e\u662f\u60f3\u7528\u7535\u8111\u7248\u7684\uff0c\u4e0d\u8fc7\u6700\u540e\u8fd8\u662f\u53d1\u73b0\u624b\u673a\u7248\u7684\u7f51\u9875\u7b80\u5355\u70b9<\/p>\n\n\n\n<p>\u4e0d\u8fc7\u73b0\u5728\u7535\u8111\u7248\u8c8c\u4f3c\u9700\u8981\u767b\u5f55\u540e\u624d\u80fd\u641c\u7d22<\/p>\n\n\n\n<p><strong>\u641c\u7d22\u4ee3\u7801:<\/strong><\/p>\n\n\n\n<p><strong>def search_music(name, limit=20): \u00a0# \u641c\u7d22\u6b4c\u66f2,name\u6b4c\u66f2\u540d,limit\u8fd4\u56de\u6570\u91cf<br>\u00a0 print(json.dumps({<br>\u00a0 \u00a0 \u00a0&#8216;w&#8217;: name,<br>\u00a0 \u00a0 \u00a0&#8216;t&#8217;: 0,<br>\u00a0 \u00a0 \u00a0&#8216;n&#8217;: limit,<br>\u00a0 \u00a0 \u00a0&#8216;page&#8217;: 1,<br>\u00a0 \u00a0 \u00a0&#8216;cr&#8217;: 1,<br>\u00a0 \u00a0 \u00a0&#8216;new_json&#8217;: 1,<br>\u00a0 \u00a0 \u00a0&#8216;format&#8217;: &#8216;json&#8217;,<br>\u00a0 \u00a0 \u00a0&#8216;platform&#8217;: &#8216;yqq.json&#8217;<br>\u00a0 }))<br>\u00a0 return requests.get(url=&#8217;https:\/\/c.y.qq.com\/soso\/fcgi-bin\/client_search_cp&#8217;, params={<br>\u00a0 \u00a0 \u00a0&#8216;w&#8217;: name,<br>\u00a0 \u00a0 \u00a0&#8216;t&#8217;: 0,<br>\u00a0 \u00a0 \u00a0&#8216;n&#8217;: limit,<br>\u00a0 \u00a0 \u00a0&#8216;page&#8217;: 1,<br>\u00a0 \u00a0 \u00a0&#8216;cr&#8217;: 1,<br>\u00a0 \u00a0 \u00a0&#8216;new_json&#8217;: 1,<br>\u00a0 \u00a0 \u00a0&#8216;format&#8217;: &#8216;json&#8217;,<br>\u00a0 \u00a0 \u00a0&#8216;platform&#8217;: &#8216;yqq.json&#8217;<br>\u00a0 }, timeout=1, headers=_headers).json()[&#8216;data&#8217;][&#8216;song&#8217;][&#8216;list&#8217;]<\/strong><\/p>\n\n\n\n<p>\u9664\u4e86\u8fd9\u79cd\u8bb0\u5f97\u8fd8\u6709\u8fd9\u79cd\u65b9\u6cd5<\/p>\n\n\n\n<p><a href=\"https:\/\/c.y.qq.com\/soso\/fcgi-bin\/client_search_cp?n=\u957f\u5ea6&amp;w=\u6b4c\u540d\">https:\/\/c.y.qq.com\/soso\/fcgi-bin\/client_search_cp?n=\u957f\u5ea6&amp;w=\u6b4c\u540d<\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u83b7\u53d6\u97f3\u4e50\u4e0b\u8f7d\u5730\u5740:<\/h1>\n\n\n\n<p>\u4e07\u80fd\u63d0\u4ea4\u63a5\u53e3:https:\/\/u.y.qq.com\/cgi-bin\/musicu.fcg?data=xxx<\/p>\n\n\n\n<p>\u7f51\u9875\u7248\u8fd8\u6709\u4e2asign=xxx\u7684\u65b9\u6cd5,\u6ca1\u7814\u7a76\u660e\u767d<\/p>\n\n\n\n<p>\u81f3\u4e8e\u80fd\u4e0d\u80fd\u89e3\u6790VIP\u6b4c\u66f2,\u770b\u4f60_cookies\u586b\u7684\u662f\u4e0d\u662f\u6709\u7eff\u94bb\u7684<\/p>\n\n\n\n<p><strong>\u4ee3\u7801:<\/strong><\/p>\n\n\n\n<p><code>def get_music_url(music_mid):\u00a0<br>\u00a0 uin = ''.join(random.sample('1234567890', 10))<br>\u00a0 data = {<br>\u00a0 \u00a0 \u00a0\"req\": {<br>\u00a0 \u00a0 \u00a0 \u00a0 \"module\": \"CDN.SrfCdnDispatchServer\",<br>\u00a0 \u00a0 \u00a0 \u00a0 \"method\": \"GetCdnDispatch\",<br>\u00a0 \u00a0 \u00a0 \u00a0 \"param\": {<br>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\"guid\": \"1535153710\",<br>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\"calltype\": 0,<br>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\"userip\": \"\"<br>\u00a0 \u00a0 \u00a0 \u00a0 }<br>\u00a0 \u00a0 \u00a0},<br>\u00a0 \u00a0 \u00a0\"req_0\": {<br>\u00a0 \u00a0 \u00a0 \u00a0 \"module\": \"vkey.GetVkeyServer\",<br>\u00a0 \u00a0 \u00a0 \u00a0 \"method\": \"CgiGetVkey\",<br>\u00a0 \u00a0 \u00a0 \u00a0 \"param\": {<br>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\"guid\": \"1535153710\",<br>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\"songmid\": [music_mid],<br>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\"songtype\": [0],<br>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\"uin\": uin,<br>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\"loginflag\": 1,<br>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\"platform\": \"20\",<br>\u00a0 \u00a0 \u00a0 \u00a0 }<br>\u00a0 \u00a0 \u00a0},<br>\u00a0 \u00a0 \u00a0\"comm\": {<br>\u00a0 \u00a0 \u00a0 \u00a0 \"uin\": uin,<br>\u00a0 \u00a0 \u00a0 \u00a0 \"format\": \"json\",<br>\u00a0 \u00a0 \u00a0 \u00a0 \"ct\": 24,<br>\u00a0 \u00a0 \u00a0 \u00a0 \"cv\": 0<br>\u00a0 \u00a0 \u00a0}<br>\u00a0 }<br>\u00a0 ret = json.loads(requests.get('https:\/\/u.y.qq.com\/cgi-bin\/musicu.fcg?data={}'.format(json.dumps(data)),<br>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 headers=_headers, cookies=_cookies).text)<br>\u00a0 if ret['code'] == 500001:\u00a0<br>\u00a0 \u00a0 \u00a0return 'Error'<br>\u00a0 return 'https:\/\/dl.stream.qqmusic.qq.com\/{}'.format(ret['req_0']['data']['midurlinfo'][0]['purl'])<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6e90\u7801,\u5168\u90e8\u529f\u80fd\u8bf4\u660e:https:\/\/github.com\/MCQTSS\/MCQTSS_QQMusic \u4ee3\u7801\u4ec5\u7528 &hellip; <a href=\"https:\/\/nmsl.life\/index.php\/mcqtss\/python%e7%ba%af%e4%bb%a3%e7%a0%81%e5%88%86%e4%ba%abqq%e9%9f%b3%e4%b9%90%e8%a7%a3%e6%9e%90%e6%90%9c%e7%b4%a2%e7%ad%89\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c[Python][\u7eaf\u4ee3\u7801\u5206\u4eab]QQ\u97f3\u4e50\u89e3\u6790,\u641c\u7d22\u7b49\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/nmsl.life\/index.php\/wp-json\/wp\/v2\/posts\/6","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nmsl.life\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nmsl.life\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nmsl.life\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nmsl.life\/index.php\/wp-json\/wp\/v2\/comments?post=6"}],"version-history":[{"count":1,"href":"https:\/\/nmsl.life\/index.php\/wp-json\/wp\/v2\/posts\/6\/revisions"}],"predecessor-version":[{"id":8,"href":"https:\/\/nmsl.life\/index.php\/wp-json\/wp\/v2\/posts\/6\/revisions\/8"}],"wp:attachment":[{"href":"https:\/\/nmsl.life\/index.php\/wp-json\/wp\/v2\/media?parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nmsl.life\/index.php\/wp-json\/wp\/v2\/categories?post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nmsl.life\/index.php\/wp-json\/wp\/v2\/tags?post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}