Last active
October 3, 2020 07:59
-
-
Save VeryCB/5193421 to your computer and use it in GitHub Desktop.
将淘客URL转换为商品的真实URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import requests | |
import urllib | |
def get_real_url(taoke_url): | |
_refer = requests.get(taoke_url).url | |
headers = {'Referer': _refer} | |
return requests.get(urllib.unquote(_refer.split('tu=')[1]), headers=headers).url.split('&ali_trackid=')[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment