Created
November 17, 2020 15:48
-
-
Save lovemyliwu/8d014f06997793483ce091bc26a17c21 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import binascii | |
file = open('douyin_signature.csv', 'wb') | |
bom = binascii.unhexlify(''.join("EF BB BF".split())) | |
file.write(bom) | |
file.write('unique_id,signature'.encode()) | |
def get_signature(unique_id): | |
import requests | |
response = requests.get(f'https://www.iesdouyin.com/web/api/v2/user/info/?unique_id={unique_id}').json() | |
return response['user_info']['signature'] | |
for item in items: | |
signature=get_signature(item) | |
file.write(f'{item},"{signature}"\n'.encode()) | |
file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment