Skip to content

Instantly share code, notes, and snippets.

@VeryCB
Last active October 3, 2020 07:59
Show Gist options
  • Save VeryCB/5193421 to your computer and use it in GitHub Desktop.
Save VeryCB/5193421 to your computer and use it in GitHub Desktop.
将淘客URL转换为商品的真实URL
#!/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