{"id":298,"date":"2021-08-12T06:15:00","date_gmt":"2021-08-12T06:15:00","guid":{"rendered":"https:\/\/262235.xyz\/?p=298"},"modified":"2021-08-12T06:15:00","modified_gmt":"2021-08-12T06:15:00","slug":"298","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2021\/08\/12\/298\/","title":{"rendered":"\u767e\u5ea6\u641c\u7d22\u7ed3\u679curl\u52a0\u5bc6\u7b97\u6cd5 Python\u6e90\u7801"},"content":{"rendered":"<p>\u767e\u5ea6\u641c\u7d22\u7ed3\u679c\u90fd\u662f\u52a0\u5bc6\u8fc7\u7684\uff0c\u6bd4\u5982\uff1a<\/p>\n<pre><code>lyvba.com --&gt; https:\/\/www.baidu.com\/link?url=a3f48d30fc293c5e471ef23de092fddc99b897cd745eeca534dc93\n<\/code><\/pre>\n<p>\u4ee5\u4e0b\u5c31\u662f\u7528python\u5b9e\u73b0\u52a0\u5bc6\u7684\u65b9\u6cd5\uff0c\u6b64\u65b9\u6cd5\u7684\u7f3a\u70b9\u662f\u65e0\u6cd5\u52a0\u5bc6https\u7684\u94fe\u63a5\uff0c\u7b97\u662f\u6bd4\u8f83\u8001\u7684\u7b97\u6cd5\uff0c\u4f46\u662f\u4ecd\u7136\u53ef\u4ee5\u7528(\u5e38\u88abseo\u4eba\u58eb\u7528\u4e8eshua\u6392\u540d\u7b49\u9886\u57df)\u3002<\/p>\n<pre><code>import os\nascii = [\n    [ ' ', '!', '\"', '#', '$', '%', '&amp;', \"'\", '(', ')', '*', '+', ',', '-', '.', '\/' ],\n    [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '&lt;', '=', '&gt;', '?' ],\n    [ '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L','M', 'N', 'O'  ],\n    [ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\',']', '^', '_' ],\n    [ '\"', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o' ],\n    [ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', ' ' ]]\ndata = [\n    [13, 10], [10, 1], [16, 15], [7, 6], [5, 13], [18, 9], [13, 11], [7, 12],\n    [10, 5], [15, 9], [15, 9], [13, 5], [16, 11], [0, 1], [8, 2], [8, 5],\n    [0, 0], [17, 15], [14, 8], [2, 1], [10, 5], [17, 14], [16, 5], [3, 8],\n    [14, 9], [5, 8], [15, 1], [3, 15], [13, 10], [10, 12], [5, 7], [0, 2],\n    [18, 14], [0, 15], [1, 6], [13, 5], [2, 1], [15, 14], [18, 8], [18, 9],\n    [1, 10], [14, 14], [13, 2], [5, 3], [5, 8], [0, 4], [1, 5], [16, 1],\n    [8, 1], [2, 5], [10, 7], [10, 15], [14, 14], [17, 3], [15, 0], [14, 5],\n    [7, 7], [3, 4], [14, 8], [12, 0], [13, 12], [12, 3], [6, 5], [3, 1],\n    [1, 14], [5, 4], [0, 12], [7, 0], [10, 7], [15, 12], [8, 2], [18, 15],\n    [3, 12], [1, 12], [0, 15], [17, 4], [17, 2], [11, 1], [3, 12], [11, 5],\n    [0, 13], [1, 1], [2, 12]]\ny = [\n    '0123456789abcdef', '1032547698badcfe', '23016745ab89efcd',\n    '32107654ba98fedc', '45670123cdef89ab', '54761032dcfe98ba',\n    '67452301efcdab89', '76543210fedcba98', '89abcdef01234567',\n    '98badcfe10325476', 'ab89efcd23016745', 'ba98fedc32107654',\n    'cdef89ab45670123', 'dcfe98ba54761032', 'efcdab8967452301',\n    'fedcba9876543210' ]\nx = [\n    '016745', '107654', '234567', '321076', '325476', '452301', '543210',\n    '670123', '765432', '761032', '89abcd', '89efcd', '98fedc', 'abcdef',\n    'badcfe', 'cdab89', 'dcba98', 'ef89ab', 'fe98ba' ]\n\ndef encode_url(url):\n    mi = ''\n    for i, ch in enumerate(url):\n        f_real_x = None\n        f_real_y = None\n        for real_x, real_y_chs in enumerate(ascii):\n            for real_y, real_y_ch in enumerate(real_y_chs):\n                if real_y_ch == ch:\n                    f_real_x = real_x\n                    f_real_y = real_y\n\n        if f_real_y is not None and f_real_x is not None:\n            this_data_x = x[data[i][0]]\n            encode_x = this_data_x[f_real_x]\n            mi = mi + encode_x\n            this_data_y = y[data[i][1]]\n            encode_y = this_data_y[f_real_y]\n            mi = mi + encode_y\n\n    return 'https:\/\/www.baidu.com\/link?url=a3f48d30fc293c5e471ef23de092fddc99' + mi\n\n#  \u8f93\u5165 lyvba.com  \u8f6c\u6362 b897cd745eeca534dc93\nif __name__ == '__main__':\n    t = encode_url(\"lyvba.com\")\n    print( \"lyvba.com\" + \" --&gt; \" + t)\n<\/code><\/pre>\n<p>\u8bbf\u95ee\u7f51\u5740\u5373\u53ef\u6b63\u5e38\u8df3\u8f6c\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u5982\u4f55\u83b7\u53d6\u52a0\u5bc6\u4e4b\u540e\u7684\u771f\u5b9e\u5730\u5740\u5c31\u7b80\u5355\u591a\u4e86\uff0c\u76f4\u63a5http\u8bbf\u95ee\u52a0\u5bc6\u540e\u7684\u5730\u5740\uff0c\u83b7\u53d6\u8fd4\u56de\u5934\u90e8\u91cc\u7684301\u8df3\u8f6c\u5730\u5740\u5c31\u884c\u4e86\u3002<\/p>\n<pre><code>import requests\nurl = 'https:\/\/www.baidu.com\/link?url=a3f48d30fc293c5e471ef23de092fddc99b897cd745eeca534dc93'\nr = requests.get(url)\n# print(r.text)\nprint(r.url)\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u767e\u5ea6\u641c\u7d22\u7ed3\u679c\u90fd\u662f\u52a0\u5bc6\u8fc7\u7684\uff0c\u6bd4\u5982\uff1a lyvba.com &#8211;&gt; https:\/\/www.baid [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,3],"tags":[45],"class_list":["post-298","post","type-post","status-publish","format-standard","hentry","category-learn","category-default","tag-python"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=298"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/298\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}